Re: [PATCH] kill bio->bi_set

From: Jens Axboe
Date: Sat Jul 23 2005 - 16:01:47 EST


On Sat, Jul 23 2005, Peter Osterlund wrote:
> Jens Axboe <axboe@xxxxxxx> writes:
>
> > Dunno why I didn't notice before, but ->bi_set is totally unnecessary
> > bloat of struct bio. Just define a proper destructor for the bio and it
> > already knows what bio_set it belongs too.
>
> This causes crashes on my computer.

Did I neglect to mention it was untested? :)

> > +void bio_free(struct bio *bio, struct bio_set *bio_set)
> > {
> > const int pool_idx = BIO_POOL_IDX(bio);
> > - struct bio_set *bs = bio->bi_set;
> >
> > BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS);
> >
> > - mempool_free(bio->bi_io_vec, bs->bvec_pools[pool_idx]);
> > - mempool_free(bio, bs->bio_pool);
> > + mempool_free(bio->bi_io_vec, fs_bio_set->bvec_pools[pool_idx]);
> > + mempool_free(bio, fs_bio_set->bio_pool);
> > +}
>
> This function uses fs_bio_set instead of the function parameter
> bio_set.

Clear mistake, thanks.

> > @@ -171,8 +175,6 @@ struct bio *bio_alloc_bioset(unsigned in
> > bio->bi_max_vecs = bvec_slabs[idx].nr_vecs;
> > }
> > bio->bi_io_vec = bvl;
> > - bio->bi_destructor = bio_destructor;
> > - bio->bi_set = bs;
> > }
>
> This change means that all code that calls bio_alloc_bioset() must now

Correct. The alternative was to require a destructor function passed
into bio_alloc_bioset().

> set bi_destructor, but this is forgotten in bio_clone() in bio.c and
> in split_bvec() in dm.c.

Thanks, I'll go over these and submit a fixed version.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/