diff mbox series

[08/13] block: add a missing BIOVEC_SEG_BOUNDARY check in bio_add_pc_page

Message ID 20180904191431.20102-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/13] arm: remove the unused BIOVEC_MERGEABLE define | expand

Commit Message

Christoph Hellwig Sept. 4, 2018, 7:14 p.m. UTC
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 <hch@lst.de>
---
 block/bio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 7f7230140b66..d15a228d1bfc 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -729,7 +729,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: