Blob Blame History Raw
From: Johannes Thumshirn <jthumshirn@suse.de>
Date: Wed, 7 Nov 2018 14:58:14 +0100
Subject: block: respect virtual boundary mask in bvecs
Git-commit: df376b2ed51a2777c3398e038992f62523c0f932
Patch-mainline: v4.20-rc2
References: bsc#1113412

With drivers that are settting a virtual boundary constrain, we are
seeing a lot of bio splitting and smaller I/Os being submitted to the
driver.

This happens because the bio gap detection code does not account cases
where PAGE_SIZE - 1 is bigger than queue_virt_boundary() and thus will
split the bio unnecessarily.

Cc: Jan Kara <jack@suse.cz>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 include/linux/blkdev.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1643,7 +1643,7 @@ static inline void put_dev_sector(Sector
 static inline bool __bvec_gap_to_prev(struct request_queue *q,
 				struct bio_vec *bprv, unsigned int offset)
 {
-	return offset ||
+	return (offset & queue_virt_boundary(q)) ||
 		((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
 }
 
@@ -1696,7 +1696,7 @@ static inline bool bio_will_gap(struct r
 			bio_get_first_bvec(prev_rq->bio, &pb);
 		else
 			bio_get_first_bvec(prev, &pb);
-		if (pb.bv_offset)
+		if (pb.bv_offset & queue_virt_boundary(q))
 			return true;
 
 		/*