mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
block: Generalized bio pool freeing
With the old code, when you allocate a bio from a bio pool you have to implement your own destructor that knows how to find the bio pool the bio was originally allocated from. This adds a new field to struct bio (bi_pool) and changes bio_alloc_bioset() to use it. This makes various bio destructors unnecessary, so they're then deleted. v6: Explain the temporary if statement in bio_put Signed-off-by: Kent Overstreet <[email protected]> CC: Jens Axboe <[email protected]> CC: NeilBrown <[email protected]> CC: Alasdair Kergon <[email protected]> CC: Nicholas Bellinger <[email protected]> CC: Lars Ellenberg <[email protected]> Acked-by: Tejun Heo <[email protected]> Acked-by: Nicholas Bellinger <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
eeea3ac912
commit
395c72a707
8 changed files with 21 additions and 103 deletions
|
|
@ -162,23 +162,12 @@ static const struct block_device_operations drbd_ops = {
|
|||
.release = drbd_release,
|
||||
};
|
||||
|
||||
static void bio_destructor_drbd(struct bio *bio)
|
||||
{
|
||||
bio_free(bio, drbd_md_io_bio_set);
|
||||
}
|
||||
|
||||
struct bio *bio_alloc_drbd(gfp_t gfp_mask)
|
||||
{
|
||||
struct bio *bio;
|
||||
|
||||
if (!drbd_md_io_bio_set)
|
||||
return bio_alloc(gfp_mask, 1);
|
||||
|
||||
bio = bio_alloc_bioset(gfp_mask, 1, drbd_md_io_bio_set);
|
||||
if (!bio)
|
||||
return NULL;
|
||||
bio->bi_destructor = bio_destructor_drbd;
|
||||
return bio;
|
||||
return bio_alloc_bioset(gfp_mask, 1, drbd_md_io_bio_set);
|
||||
}
|
||||
|
||||
#ifdef __CHECKER__
|
||||
|
|
|
|||
Loading…
Reference in a new issue