Skip to content

Commit 382761d

Browse files
Christoph Hellwigsnitm
authored andcommitted
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. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 8506774 commit 382761d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/md/dm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,9 +1443,6 @@ static int __send_empty_flush(struct clone_info *ci)
14431443
BUG_ON(bio_has_data(ci->bio));
14441444
while ((ti = dm_table_get_target(ci->map, target_nr++)))
14451445
__send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL);
1446-
1447-
bio_disassociate_blkg(ci->bio);
1448-
14491446
return 0;
14501447
}
14511448

@@ -1633,6 +1630,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,
16331630
ci.bio = &flush_bio;
16341631
ci.sector_count = 0;
16351632
error = __send_empty_flush(&ci);
1633+
bio_uninit(ci.bio);
16361634
/* dec_pending submits any data associated with flush */
16371635
} else if (op_is_zone_mgmt(bio_op(bio))) {
16381636
ci.bio = bio;
@@ -1707,6 +1705,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map,
17071705
ci.bio = &flush_bio;
17081706
ci.sector_count = 0;
17091707
error = __send_empty_flush(&ci);
1708+
bio_uninit(ci.bio);
17101709
/* dec_pending submits any data associated with flush */
17111710
} else {
17121711
struct dm_target_io *tio;

0 commit comments

Comments
 (0)