summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Bjørling <mb@silverwolf.dk>2012-07-13 10:40:50 -0600
committerJens Axboe <axboe@kernel.dk>2012-10-04 11:04:36 +0200
commitc13b67f65027514c313734a17dfde186f2577f4d (patch)
tree6557b99b8705fa459b74331641048ad53fd5dc10
parente26df4267bcfb0414d72e1a4484daf12a4710755 (diff)
multiqueue: mq_ops->map_queue can depend on the the index in ctx. We therefore initialize this structure before first calling hctx.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-mq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index e7a06e7c0ea9..7c3749be4bac 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -639,13 +639,13 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_reg *reg,
for_each_possible_cpu(i) {
struct blk_mq_ctx *__ctx = per_cpu_ptr(ctx, i);
- hctx = q->mq_ops->map_queue(q, __ctx);
- hctx->nr_ctx++;
-
memset(__ctx, 0, sizeof(*__ctx));
- spin_lock_init(&__ctx->lock);
__ctx->index = i;
+ spin_lock_init(&__ctx->lock);
INIT_LIST_HEAD(&__ctx->rq_list);
+
+ hctx = q->mq_ops->map_queue(q, __ctx);
+ hctx->nr_ctx++;
}
/*