Skip to content

Commit 57c3651

Browse files
committed
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: Ming Lei <ming.lei@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent d445bd9 commit 57c3651

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/md/dm.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
13201320

13211321
__bio_clone_fast(clone, bio);
13221322

1323-
if (unlikely(bio_integrity(bio) != NULL)) {
1323+
if (bio_integrity(bio)) {
13241324
int r;
13251325

13261326
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,
13361336
return r;
13371337
}
13381338

1339-
bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
1340-
clone->bi_iter.bi_size = to_bytes(len);
1341-
1342-
if (unlikely(bio_integrity(bio) != NULL))
1343-
bio_integrity_trim(clone);
1339+
bio_trim(clone, sector - clone->bi_iter.bi_sector, len);
13441340

13451341
return 0;
13461342
}

0 commit comments

Comments
 (0)