Skip to content

Commit

Permalink
block: add a missing BIOVEC_SEG_BOUNDARY check in bio_add_pc_page
Browse files Browse the repository at this point in the history
The actual recaculation of segments in __blk_recalc_rq_segments will
do this check, so there is no point in forcing it if we know it won't
succeed.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Sep 24, 2018
1 parent 6a9f5f2 commit 0e25339
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,9 @@ int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page
}

/* If we may be able to merge these biovecs, force a recount */
if (bio->bi_vcnt > 1 && biovec_phys_mergeable(bvec-1, bvec))
if (bio->bi_vcnt > 1 &&
biovec_phys_mergeable(bvec - 1, bvec) &&
BIOVEC_SEG_BOUNDARY(q, bvec - 1, bvec))
bio_clear_flag(bio, BIO_SEG_VALID);

done:
Expand Down

0 comments on commit 0e25339

Please sign in to comment.