Message ID | 20190119180506.1300-2-snitzer@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dm: fix various issues with bio splitting code | expand |
On Sat, Jan 19, 2019 at 01:05:03PM -0500, Mike Snitzer wrote: > 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(). > > Signed-off-by: Mike Snitzer <snitzer@redhat.com> > --- > drivers/md/dm.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index d67c95ef8d7e..fcb97b0a5743 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, > > __bio_clone_fast(clone, bio); > > - if (unlikely(bio_integrity(bio) != NULL)) { > + if (bio_integrity(bio)) { > int r; > > 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, > return r; > } > > - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); > - clone->bi_iter.bi_size = to_bytes(len); > - > - if (unlikely(bio_integrity(bio) != NULL)) > - bio_integrity_trim(clone); > + bio_trim(clone, sector - clone->bi_iter.bi_sector, len); > > return 0; > } > -- > 2.15.0 > Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d67c95ef8d7e..fcb97b0a5743 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, __bio_clone_fast(clone, bio); - if (unlikely(bio_integrity(bio) != NULL)) { + if (bio_integrity(bio)) { int r; 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, return r; } - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); - clone->bi_iter.bi_size = to_bytes(len); - - if (unlikely(bio_integrity(bio) != NULL)) - bio_integrity_trim(clone); + bio_trim(clone, sector - clone->bi_iter.bi_sector, len); return 0; }
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(). Signed-off-by: Mike Snitzer <snitzer@redhat.com> --- drivers/md/dm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)