aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2018-06-15 09:35:33 -0400
committerMike Snitzer <snitzer@redhat.com>2018-06-15 09:35:33 -0400
commitbbb683cf88f58742233c3551d1b9839a5fe5bbf8 (patch)
tree06ea625a320366ca042db3975b8d3eeddbe30592
parent48debafe4f2feabcc99f8e2659e80557e3ca6b39 (diff)
downloadlinux-dm-bbb683cf88f58742233c3551d1b9839a5fe5bbf8.tar.gz
dm: use bio_split() when splitting out the already processed bio
Notice: this object is not reachable from any branch.
Use of bio_clone_bioset() is inefficient if there is no need to clone the original bio's bio_vec array. Best to use the bio_clone_fast() variant. Also, just using bio_advance() is only part of what is needed to properly setup the clone -- it doesn't account for the various bio_integrity() related work that also needs to be performed (see bio_split). Address both of these issues by switching from bio_clone_bioset() to bio_split(). Fixes: 18a25da8 ("dm: ensure bio submission follows a depth-first tree walk") Cc: stable@vger.kernel.org # 4.15+, requires removal of '&' before md->queue->bio_split Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Notice: this object is not reachable from any branch.
-rw-r--r--drivers/md/dm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 20a8d63754bfe..dfb4783ad09f3 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1582,10 +1582,9 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,
* the usage of io->orig_bio in dm_remap_zone_report()
* won't be affected by this reassignment.
*/
- struct bio *b = bio_clone_bioset(bio, GFP_NOIO,
- &md->queue->bio_split);
+ struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count,
+ GFP_NOIO, &md->queue->bio_split);
ci.io->orig_bio = b;
- bio_advance(bio, (bio_sectors(bio) - ci.sector_count) << 9);
bio_chain(b, bio);
ret = generic_make_request(bio);
break;