aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2015-02-11 10:20:13 -0500
committerJens Axboe <axboe@fb.com>2015-02-11 11:23:52 -0500
commit854fbb9c699e34fe4889e6907c4fc73889192223 (patch)
tree862ba8836f31df9793c5efb23e8bd04d5b2dad1d /block
parent201f201c33220f53856fd300e1990b779538d67f (diff)
block: prevent request-to-request merging with gaps if not allowed
If the queue has SG_GAPS set, we must not merge across an sg gap. This is caught for the bio case, but currently not for the more rare case of merging two requests directly. Signed-off-by: Keith Busch <keith.busch@intel.com> Cut the dm bits, those will go through the dm tree, and fixed the test_bit() test. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-merge.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 89b97b5e0881..9476b1528ded 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -385,6 +385,14 @@ static bool req_no_special_merge(struct request *req)
385 return !q->mq_ops && req->special; 385 return !q->mq_ops && req->special;
386} 386}
387 387
388static int req_gap_to_prev(struct request *req, struct request *next)
389{
390 struct bio *prev = req->biotail;
391
392 return bvec_gap_to_prev(&prev->bi_io_vec[prev->bi_vcnt - 1],
393 next->bio->bi_io_vec[0].bv_offset);
394}
395
388static int ll_merge_requests_fn(struct request_queue *q, struct request *req, 396static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
389 struct request *next) 397 struct request *next)
390{ 398{
@@ -399,6 +407,10 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
399 if (req_no_special_merge(req) || req_no_special_merge(next)) 407 if (req_no_special_merge(req) || req_no_special_merge(next))
400 return 0; 408 return 0;
401 409
410 if (test_bit(QUEUE_FLAG_SG_GAPS, &q->queue_flags) &&
411 req_gap_to_prev(req, next))
412 return 0;
413
402 /* 414 /*
403 * Will it become too large? 415 * Will it become too large?
404 */ 416 */