Commit 57c36519 authored by Mike Snitzer's avatar Mike Snitzer

dm: fix clone_bio() to trigger blk_recount_segments()

DM's clone_bio() now benefits from using bio_trim() by fixing the fact
that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does;
which triggers blk_recount_segments() via bio_phys_segments().
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent d445bd9c
...@@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, ...@@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
__bio_clone_fast(clone, bio); __bio_clone_fast(clone, bio);
if (unlikely(bio_integrity(bio) != NULL)) { if (bio_integrity(bio)) {
int r; int r;
if (unlikely(!dm_target_has_integrity(tio->ti->type) && if (unlikely(!dm_target_has_integrity(tio->ti->type) &&
...@@ -1336,11 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, ...@@ -1336,11 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
return r; return r;
} }
bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); bio_trim(clone, sector - clone->bi_iter.bi_sector, len);
clone->bi_iter.bi_size = to_bytes(len);
if (unlikely(bio_integrity(bio) != NULL))
bio_integrity_trim(clone);
return 0; return 0;
} }
......
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