[Drbd-dev] Re: drbd uses wrong API for struct bio

Lars Marowsky-Bree lmb at suse.de
Mon Jan 24 10:58:54 CET 2005

On 2005-01-24T10:10:07, Jens Axboe <axboe at suse.de> wrote:

> drbd_ee_init() doesn't look good. First of all, it makes assumptions
> about what bio_init() would do - it doesn't clear the entire bio to 0.
> This is the type of thing that exposes bugs when we add or change parts
> of the bio stuff, please uncomment that bio_init() call. It does set
> bio->bi_max_vecs, however it needs changing to passing the bdev in so we
> can use bio_add_page() instead. drbd_ee_bio_prepare() looks strange, it
> sets vec length but doesn't assign the page or offset. Again, it should
> use the proper api (bio_add_page()). If it had used bio_init(), it would
> not have to set BIO_UPTODATE manually either.

I may be missing something here, but the interaction between
drbd_ee_init() and drbd_ee_bio_prepare() doesn't map neatly to the
bio_init() + bio_add_page() API. Part of the setup happens in
_ee_init(), but the other half in _prepare(), so that neither one has
all information readily available to use the correct bio_*() API.

Philipp, is it guaranteed that the drbd_dev for which drbd_ee_init()
is invoked is the same one drbd_ee_bio_prepare will be called later?

    Lars Marowsky-Brée <lmb at suse.de>

High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business

More information about the drbd-dev mailing list