aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c8
-rw-r--r--block/blk-mq.c3
2 files changed, 6 insertions, 5 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index fe81e19099a1..5b6f768a7c01 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1471,6 +1471,8 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
1471 * added on the elevator at this point. In addition, we don't have 1471 * added on the elevator at this point. In addition, we don't have
1472 * reliable access to the elevator outside queue lock. Only check basic 1472 * reliable access to the elevator outside queue lock. Only check basic
1473 * merging parameters without querying the elevator. 1473 * merging parameters without querying the elevator.
1474 *
1475 * Caller must ensure !blk_queue_nomerges(q) beforehand.
1474 */ 1476 */
1475bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio, 1477bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
1476 unsigned int *request_count) 1478 unsigned int *request_count)
@@ -1480,9 +1482,6 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
1480 bool ret = false; 1482 bool ret = false;
1481 struct list_head *plug_list; 1483 struct list_head *plug_list;
1482 1484
1483 if (blk_queue_nomerges(q))
1484 goto out;
1485
1486 plug = current->plug; 1485 plug = current->plug;
1487 if (!plug) 1486 if (!plug)
1488 goto out; 1487 goto out;
@@ -1561,7 +1560,8 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
1561 * Check if we can merge with the plugged list before grabbing 1560 * Check if we can merge with the plugged list before grabbing
1562 * any locks. 1561 * any locks.
1563 */ 1562 */
1564 if (blk_attempt_plug_merge(q, bio, &request_count)) 1563 if (!blk_queue_nomerges(q) &&
1564 blk_attempt_plug_merge(q, bio, &request_count))
1565 return; 1565 return;
1566 1566
1567 spin_lock_irq(q->queue_lock); 1567 spin_lock_irq(q->queue_lock);
diff --git a/block/blk-mq.c b/block/blk-mq.c
index fec8fcc4f8a4..ef7ed5e95d6d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1087,7 +1087,8 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio)
1087 return; 1087 return;
1088 } 1088 }
1089 1089
1090 if (use_plug && blk_attempt_plug_merge(q, bio, &request_count)) 1090 if (use_plug && !blk_queue_nomerges(q) &&
1091 blk_attempt_plug_merge(q, bio, &request_count))
1091 return; 1092 return;
1092 1093
1093 if (blk_mq_queue_enter(q)) { 1094 if (blk_mq_queue_enter(q)) {