diff options
author | Mike Snitzer <snitzer@redhat.com> | 2022-02-17 23:40:09 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2022-02-21 15:36:23 -0500 |
commit | 66bdaa4302d3b58d1f8f2afcdd424addc9a80e3c (patch) | |
tree | 3bfaf65022420ee2a0e079581a16cc2694aadc66 /drivers/md/dm.c | |
parent | 96c9865cb6dd068a74f844e1c14114b7e676f727 (diff) | |
download | lwn-66bdaa4302d3b58d1f8f2afcdd424addc9a80e3c.tar.gz lwn-66bdaa4302d3b58d1f8f2afcdd424addc9a80e3c.zip |
dm: fold __clone_and_map_data_bio into __split_and_process_bio
Fold __clone_and_map_data_bio into its only caller.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7d1bf59c4663..bed236d604f8 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1207,25 +1207,6 @@ static void bio_setup_sector(struct bio *bio, sector_t sector, unsigned len) bio->bi_iter.bi_size = to_bytes(len); } -/* - * Creates a bio that consists of range of complete bvecs. - */ -static int __clone_and_map_data_bio(struct clone_info *ci, struct dm_target *ti, - sector_t sector, unsigned *len) -{ - struct bio *bio = ci->bio, *clone; - - clone = alloc_tio(ci, ti, 0, len, GFP_NOIO); - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); - clone->bi_iter.bi_size = to_bytes(*len); - - if (bio_integrity(bio)) - bio_integrity_trim(clone); - - __map_bio(clone); - return 0; -} - static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci, struct dm_target *ti, unsigned num_bios, unsigned *len) @@ -1380,6 +1361,7 @@ static bool __process_abnormal_io(struct clone_info *ci, struct dm_target *ti, */ static int __split_and_process_bio(struct clone_info *ci) { + struct bio *clone; struct dm_target *ti; unsigned len; int r; @@ -1393,9 +1375,13 @@ static int __split_and_process_bio(struct clone_info *ci) len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count); - r = __clone_and_map_data_bio(ci, ti, ci->sector, &len); - if (r < 0) - return r; + clone = alloc_tio(ci, ti, 0, &len, GFP_NOIO); + bio_advance(clone, to_bytes(ci->sector - clone->bi_iter.bi_sector)); + clone->bi_iter.bi_size = to_bytes(len); + if (bio_integrity(clone)) + bio_integrity_trim(clone); + + __map_bio(clone); ci->sector += len; ci->sector_count -= len; |