diff options
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r-- | block/blk-merge.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index 5f2448253797..1ffc58977835 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -308,6 +308,17 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req, | |||
308 | return ll_new_hw_segment(q, req, bio); | 308 | return ll_new_hw_segment(q, req, bio); |
309 | } | 309 | } |
310 | 310 | ||
311 | /* | ||
312 | * blk-mq uses req->special to carry normal driver per-request payload, it | ||
313 | * does not indicate a prepared command that we cannot merge with. | ||
314 | */ | ||
315 | static bool req_no_special_merge(struct request *req) | ||
316 | { | ||
317 | struct request_queue *q = req->q; | ||
318 | |||
319 | return !q->mq_ops && req->special; | ||
320 | } | ||
321 | |||
311 | static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | 322 | static int ll_merge_requests_fn(struct request_queue *q, struct request *req, |
312 | struct request *next) | 323 | struct request *next) |
313 | { | 324 | { |
@@ -319,7 +330,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | |||
319 | * First check if the either of the requests are re-queued | 330 | * First check if the either of the requests are re-queued |
320 | * requests. Can't merge them if they are. | 331 | * requests. Can't merge them if they are. |
321 | */ | 332 | */ |
322 | if (req->special || next->special) | 333 | if (req_no_special_merge(req) || req_no_special_merge(next)) |
323 | return 0; | 334 | return 0; |
324 | 335 | ||
325 | /* | 336 | /* |
@@ -416,7 +427,7 @@ static int attempt_merge(struct request_queue *q, struct request *req, | |||
416 | 427 | ||
417 | if (rq_data_dir(req) != rq_data_dir(next) | 428 | if (rq_data_dir(req) != rq_data_dir(next) |
418 | || req->rq_disk != next->rq_disk | 429 | || req->rq_disk != next->rq_disk |
419 | || next->special) | 430 | || req_no_special_merge(next)) |
420 | return 0; | 431 | return 0; |
421 | 432 | ||
422 | if (req->cmd_flags & REQ_WRITE_SAME && | 433 | if (req->cmd_flags & REQ_WRITE_SAME && |
@@ -515,7 +526,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |||
515 | return false; | 526 | return false; |
516 | 527 | ||
517 | /* must be same device and not a special request */ | 528 | /* must be same device and not a special request */ |
518 | if (rq->rq_disk != bio->bi_bdev->bd_disk || rq->special) | 529 | if (rq->rq_disk != bio->bi_bdev->bd_disk || req_no_special_merge(rq)) |
519 | return false; | 530 | return false; |
520 | 531 | ||
521 | /* only merge integrity protected bio into ditto rq */ | 532 | /* only merge integrity protected bio into ditto rq */ |