Commit 4ef2c5c2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

dm: use bio_uninit instead of bio_disassociate_blkg

bio_uninit is the proper API to clean up a BIO that has been allocated
on stack or inside a structure that doesn't come from the BIO allocator.
Switch dm to use that instead of bio_disassociate_blkg, which really is
an implementation detail.  Note that the bio_uninit calls are also moved
to the two callers of __send_empty_flush, so that they better pair with
the bio_init calls used to initialize them.
Acked-by: default avatarTejun Heo <tj@kernel.org>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 826f2f48
...@@ -1452,9 +1452,6 @@ static int __send_empty_flush(struct clone_info *ci) ...@@ -1452,9 +1452,6 @@ static int __send_empty_flush(struct clone_info *ci)
BUG_ON(bio_has_data(ci->bio)); BUG_ON(bio_has_data(ci->bio));
while ((ti = dm_table_get_target(ci->map, target_nr++))) while ((ti = dm_table_get_target(ci->map, target_nr++)))
__send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL);
bio_disassociate_blkg(ci->bio);
return 0; return 0;
} }
...@@ -1642,6 +1639,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, ...@@ -1642,6 +1639,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,
ci.bio = &flush_bio; ci.bio = &flush_bio;
ci.sector_count = 0; ci.sector_count = 0;
error = __send_empty_flush(&ci); error = __send_empty_flush(&ci);
bio_uninit(ci.bio);
/* dec_pending submits any data associated with flush */ /* dec_pending submits any data associated with flush */
} else if (op_is_zone_mgmt(bio_op(bio))) { } else if (op_is_zone_mgmt(bio_op(bio))) {
ci.bio = bio; ci.bio = bio;
...@@ -1716,6 +1714,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, ...@@ -1716,6 +1714,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map,
ci.bio = &flush_bio; ci.bio = &flush_bio;
ci.sector_count = 0; ci.sector_count = 0;
error = __send_empty_flush(&ci); error = __send_empty_flush(&ci);
bio_uninit(ci.bio);
/* dec_pending submits any data associated with flush */ /* dec_pending submits any data associated with flush */
} else { } else {
struct dm_target_io *tio; struct dm_target_io *tio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment