aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c7
-rw-r--r--block/blk-mq.c16
-rw-r--r--block/blk-mq.h1
3 files changed, 23 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index d709c0e3a2ac..aebe676225e6 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2342,7 +2342,12 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
2342 if (q->mq_ops) { 2342 if (q->mq_ops) {
2343 if (blk_queue_io_stat(q)) 2343 if (blk_queue_io_stat(q))
2344 blk_account_io_start(rq, true); 2344 blk_account_io_start(rq, true);
2345 blk_mq_sched_insert_request(rq, false, true, false, false); 2345 /*
2346 * Since we have a scheduler attached on the top device,
2347 * bypass a potential scheduler on the bottom device for
2348 * insert.
2349 */
2350 blk_mq_request_bypass_insert(rq);
2346 return BLK_STS_OK; 2351 return BLK_STS_OK;
2347 } 2352 }
2348 2353
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3f18cff80050..98a18609755e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1401,6 +1401,22 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
1401 blk_mq_hctx_mark_pending(hctx, ctx); 1401 blk_mq_hctx_mark_pending(hctx, ctx);
1402} 1402}
1403 1403
1404/*
1405 * Should only be used carefully, when the caller knows we want to
1406 * bypass a potential IO scheduler on the target device.
1407 */
1408void blk_mq_request_bypass_insert(struct request *rq)
1409{
1410 struct blk_mq_ctx *ctx = rq->mq_ctx;
1411 struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(rq->q, ctx->cpu);
1412
1413 spin_lock(&hctx->lock);
1414 list_add_tail(&rq->queuelist, &hctx->dispatch);
1415 spin_unlock(&hctx->lock);
1416
1417 blk_mq_run_hw_queue(hctx, false);
1418}
1419
1404void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, 1420void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
1405 struct list_head *list) 1421 struct list_head *list)
1406 1422
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 98252b79b80b..ef15b3414da5 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -54,6 +54,7 @@ int blk_mq_alloc_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
54 */ 54 */
55void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, 55void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
56 bool at_head); 56 bool at_head);
57void blk_mq_request_bypass_insert(struct request *rq);
57void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, 58void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
58 struct list_head *list); 59 struct list_head *list);
59 60