diff options
author | Christoph Hellwig <hch@lst.de> | 2014-04-14 10:30:10 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-15 14:03:03 -0600 |
commit | ed44832dea8a74f909e0187f350201402927f5e5 (patch) | |
tree | 995f626a425e9daef055a540ea7e6ff8ed559959 | |
parent | e9b267d91f6ddbc694cb40aa962b0b2cec03971d (diff) | |
download | linux-ed44832dea8a74f909e0187f350201402927f5e5.tar.gz linux-ed44832dea8a74f909e0187f350201402927f5e5.tar.bz2 linux-ed44832dea8a74f909e0187f350201402927f5e5.zip |
blk-mq: initialize request on allocation
If we want to share tag and request allocation between queues we cannot
initialize the request at init/free time, but need to initialize it
at allocation time as it might get used for different queues over its
lifetime.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/blk-mq.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 48d2d8495f5e..2a5a0fed10a3 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -82,6 +82,7 @@ static struct request *__blk_mq_alloc_request(struct blk_mq_hw_ctx *hctx, tag = blk_mq_get_tag(hctx->tags, gfp, reserved); if (tag != BLK_MQ_TAG_FAIL) { rq = hctx->rqs[tag]; + blk_rq_init(hctx->queue, rq); rq->tag = tag; return rq; @@ -257,9 +258,7 @@ static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx, const int tag = rq->tag; struct request_queue *q = rq->q; - blk_rq_init(hctx->queue, rq); blk_mq_put_tag(hctx->tags, tag); - blk_mq_queue_exit(q); } @@ -1122,7 +1121,6 @@ static int blk_mq_init_rq_map(struct blk_mq_hw_ctx *hctx, left -= to_do * rq_size; for (j = 0; j < to_do; j++) { hctx->rqs[i] = p; - blk_rq_init(hctx->queue, hctx->rqs[i]); if (reg->ops->init_request) { error = reg->ops->init_request(driver_data, hctx, hctx->rqs[i], i); |