From: "Adam J. Richter" <adam@yggdrasil.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@zip.com.au, axboe@suse.de
Subject: Re: bio_chain: proposed solution for bio_alloc failure and large IO simplification
Date: Fri, 14 Jun 2002 21:38:29 -0700 [thread overview]
Message-ID: <200206150438.VAA27728@adam.yggdrasil.com> (raw)
I wrote:
> Anyhow, I can write bio_chain in a separate file without
>touching changing any existing code in the kernel, if I am not going
>to implement the merge hint. I think I will do just that so that
>we have something that we can discuss more concretely.
In case anyone is intersted, here is a sample implementation
that compiles. I do not know if it works. I have renamed it
recycle_bio. This version allocates a bio on the stack (56 bytes
on x86). I also wrote a version that avoided the stack allocation,
but added a field "void *bi_destructor_private;" to struct bio.
Adam J. Richter __ ______________ 575 Oroville Road
adam@yggdrasil.com \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
/* In bio.h: */
extern struct bio *__recycle_bio(struct bio *oldbio);
static inline struct bio *recycle_bio(struct bio *oldbio,
int gfp_mask, int nvecs) {
struct bio *newbio;
if (nvecs > oldbio->bi_max)
BUG();
if ((newbio = bio_alloc(gfp_mask, nvecs)) != NULL) {
submit_bio(oldbio->bi_rw, oldbio);
return newbio;
} else
return __recycle_bio(oldbio);
}
/* In bio.c: */
struct bio_completion {
struct bio bio;
struct completion done;
};
static void fake_destruct(struct bio *bio)
{
struct bio_completion *stackbio;
stackbio = list_entry(bio, struct bio_completion, bio);
complete(&stackbio->done);
}
struct bio *__recycle_bio(struct bio *bio)
{
struct bio_completion stackbio;
stackbio.bio = *bio;
stackbio.bio.bi_destructor = fake_destruct;
init_completion(&stackbio.done);
submit_bio(stackbio.bio.bi_rw, &stackbio.bio);
wait_for_completion(&stackbio.done);
return bio;
}
EXPORT_SYMBOL(__recycle_bio);
next reply other threads:[~2002-06-15 4:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-15 4:38 Adam J. Richter [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-06-15 20:24 Adam J. Richter
2002-06-17 6:37 ` Jens Axboe
2002-06-15 20:01 Adam J. Richter
2002-06-15 20:22 ` Andrew Morton
2002-06-15 10:30 Adam J. Richter
2002-06-15 19:50 ` Andrew Morton
2002-06-17 6:36 ` Jens Axboe
2002-06-17 7:09 ` Andrew Morton
2002-06-15 9:10 Adam J. Richter
2002-06-15 9:14 ` Jens Axboe
2002-06-15 8:52 Adam J. Richter
2002-06-15 9:00 ` Jens Axboe
2002-06-15 8:45 Adam J. Richter
2002-06-15 8:50 ` Jens Axboe
2002-06-15 0:22 Adam J. Richter
2002-06-14 23:39 Adam J. Richter
2002-06-14 23:58 ` Andrew Morton
2002-06-15 1:38 ` Oliver Xymoron
2002-06-15 7:55 ` Jens Axboe
2002-06-14 16:52 Adam J. Richter
2002-06-14 23:00 ` Andrew Morton
2002-06-14 23:29 ` William Lee Irwin III
2002-06-14 23:38 ` Andrew Morton
2002-06-15 7:55 ` Jens Axboe
2002-06-14 1:56 Adam J. Richter
2002-06-14 2:24 ` Andreas Dilger
2002-06-14 14:57 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200206150438.VAA27728@adam.yggdrasil.com \
--to=adam@yggdrasil.com \
--cc=akpm@zip.com.au \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®