public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BIO usage questions
@ 2002-01-25 21:59 Badari Pulavarty
  2002-01-25 23:06 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Badari Pulavarty @ 2002-01-25 21:59 UTC (permalink / raw)
  To: axboe, linux-kernel, andrea; +Cc: pbadari, suparna, gerrit

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.

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 ?

Please let me know.

Thanks,
Badari
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: BIO usage questions
  2002-01-25 21:59 BIO usage questions Badari Pulavarty
@ 2002-01-25 23:06 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2002-01-25 23:06 UTC (permalink / raw)
  To: Badari Pulavarty; +Cc: linux-kernel, andrea, suparna, gerrit

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-25 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-25 21:59 BIO usage questions Badari Pulavarty
2002-01-25 23:06 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox