Commit 841bac2c authored by Jens Axboe's avatar Jens Axboe

blk-mq: get rid of manual run of queue with __blk_mq_run_hw_queue()

Two cases:

1) blk_mq_alloc_request() needlessly re-runs the queue, after
   calling into the tag allocation without NOWAIT set. We don't
   need to do that.

2) blk_mq_map_request() should just use blk_mq_run_hw_queue() with
   the async flag set to false.
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 491221f8
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
static DEFINE_MUTEX(all_q_mutex); static DEFINE_MUTEX(all_q_mutex);
static LIST_HEAD(all_q_list); static LIST_HEAD(all_q_list);
static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx);
/* /*
* Check if any of the ctx's have pending work in this hardware queue * Check if any of the ctx's have pending work in this hardware queue
*/ */
...@@ -228,19 +226,9 @@ struct request *blk_mq_alloc_request(struct request_queue *q, int rw, ...@@ -228,19 +226,9 @@ struct request *blk_mq_alloc_request(struct request_queue *q, int rw,
ctx = blk_mq_get_ctx(q); ctx = blk_mq_get_ctx(q);
hctx = q->mq_ops->map_queue(q, ctx->cpu); hctx = q->mq_ops->map_queue(q, ctx->cpu);
blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx); blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx);
rq = __blk_mq_alloc_request(&alloc_data, rw, 0); rq = __blk_mq_alloc_request(&alloc_data, rw, 0);
if (!rq && !(flags & BLK_MQ_REQ_NOWAIT)) {
__blk_mq_run_hw_queue(hctx);
blk_mq_put_ctx(ctx); blk_mq_put_ctx(ctx);
ctx = blk_mq_get_ctx(q);
hctx = q->mq_ops->map_queue(q, ctx->cpu);
blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx);
rq = __blk_mq_alloc_request(&alloc_data, rw, 0);
ctx = alloc_data.ctx;
}
blk_mq_put_ctx(ctx);
if (!rq) { if (!rq) {
blk_queue_exit(q); blk_queue_exit(q);
return ERR_PTR(-EWOULDBLOCK); return ERR_PTR(-EWOULDBLOCK);
...@@ -1225,7 +1213,7 @@ static struct request *blk_mq_map_request(struct request_queue *q, ...@@ -1225,7 +1213,7 @@ static struct request *blk_mq_map_request(struct request_queue *q,
blk_mq_set_alloc_data(&alloc_data, q, BLK_MQ_REQ_NOWAIT, ctx, hctx); blk_mq_set_alloc_data(&alloc_data, q, BLK_MQ_REQ_NOWAIT, ctx, hctx);
rq = __blk_mq_alloc_request(&alloc_data, op, op_flags); rq = __blk_mq_alloc_request(&alloc_data, op, op_flags);
if (unlikely(!rq)) { if (unlikely(!rq)) {
__blk_mq_run_hw_queue(hctx); blk_mq_run_hw_queue(hctx, false);
blk_mq_put_ctx(ctx); blk_mq_put_ctx(ctx);
trace_block_sleeprq(q, bio, op); trace_block_sleeprq(q, bio, op);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment