@@ -340,7 +340,10 @@ void __blk_run_queue(struct request_queue *q)
if (unlikely(blk_queue_stopped(q)))
return;
- __blk_run_queue_uncond(q);
+ if (WARN_ON_ONCE(q->mq_ops))
+ blk_mq_run_hw_queues(q, true);
+ else
+ __blk_run_queue_uncond(q);
}
EXPORT_SYMBOL(__blk_run_queue);
@@ -80,8 +80,14 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
}
__elv_add_request(q, rq, where);
- __blk_run_queue(q);
- spin_unlock_irq(q->queue_lock);
+
+ if (q->mq_ops) {
+ spin_unlock_irq(q->queue_lock);
+ blk_mq_run_hw_queues(q, false);
+ } else {
+ __blk_run_queue(q);
+ spin_unlock_irq(q->queue_lock);
+ }
}
EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
@@ -265,8 +265,10 @@ static void flush_end_io(struct request *flush_rq, int error)
* kblockd.
*/
if (queued || fq->flush_queue_delayed) {
- WARN_ON(q->mq_ops);
- blk_run_queue_async(q);
+ if (q->mq_ops)
+ blk_mq_run_hw_queues(q, true);
+ else
+ blk_run_queue_async(q);
}
fq->flush_queue_delayed = 0;
if (!blk_use_sched_path(q))
@@ -346,8 +348,12 @@ static void flush_data_end_io(struct request *rq, int error)
* After populating an empty queue, kick it to avoid stall. Read
* the comment in flush_end_io().
*/
- if (blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error))
- blk_run_queue_async(q);
+ if (blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error)) {
+ if (q->mq_ops)
+ blk_mq_run_hw_queues(q, true);
+ else
+ blk_run_queue_async(q);
+ }
}
static void mq_flush_data_end_io(struct request *rq, int error)
@@ -627,7 +627,10 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
* with anything. There's no point in delaying queue
* processing.
*/
- __blk_run_queue(q);
+ if (q->mq_ops)
+ blk_mq_run_hw_queues(q, true);
+ else
+ __blk_run_queue(q);
break;
case ELEVATOR_INSERT_SORT_MERGE:
Use MQ variants for MQ, legacy ones for legacy. Signed-off-by: Jens Axboe <axboe@fb.com> --- block/blk-core.c | 5 ++++- block/blk-exec.c | 10 ++++++++-- block/blk-flush.c | 14 ++++++++++---- block/elevator.c | 5 ++++- 4 files changed, 26 insertions(+), 8 deletions(-)