mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, andrea@suse.de, suparna@in.ibm.com,
	gerrit@us.ibm.com
Subject: Re: BIO usage questions
Date: Sat, 26 Jan 2002 00:06:00 +0100	[thread overview]
Message-ID: <20020126000600.F1296@suse.de> (raw)
In-Reply-To: <200201252159.g0PLxun17423@eng2.beaverton.ibm.com>
In-Reply-To: <200201252159.g0PLxun17423@eng2.beaverton.ibm.com>

On Fri, Jan 25 2002, Badari Pulavarty wrote:
> Hi,
> 
> I have few questions on usage of "bio" in 2.5.X.
> 
> 1) It is acceptable to use "bio" instead of "kio" for doing RAW IO
>    and direct IO ? Currently, "kio" are getting converted to "bio"
>    anywhy. why not use "bio" directly ?
> 
>    I am planning to do this. But I was wondering what are the issues
>    here.

Sure you can do that, you would probably have to provide quite a bit of
the mapping infrastructure (or make it generic, probably Ben's work in
this area would be the best way forward). But bio is a generic container
for block I/O, and you are allowed to use it directly.

> 2) I don't see how to wait for a "bio" to complete. I don't see any
>    wait_queue in bio structure. How can I wait for bio to complete ?

allocate a private bio, and you 'own' the bi_private and bi_end_io. So
you could do something ala

	DECLARE_COMPLETION(wait);

	bio = bio_alloc(GFP_XXX, 1);
	/* fill in bvec, target, etc */
	bio->bi_private = &wait;
	bio->bi_end_io = my_end_io;

	...

	wait_for_completion(&wait);

int my_end_io(struct bio *bio, int nr_sectors)
{
	struct completion *wait = bio->bi_private;

	/* do end i/o stuff */
	...

	/* wake up waiters */
	complete(wait);
	return 0;
}

-- 
Jens Axboe


      reply	other threads:[~2002-01-25 23:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-25 21:59 Badari Pulavarty
2002-01-25 23:06 ` Jens Axboe [this message]

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=20020126000600.F1296@suse.de \
    --to=axboe@suse.de \
    --cc=andrea@suse.de \
    --cc=gerrit@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    --cc=suparna@in.ibm.com \
    /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

Powered by JetHome