From: Ming Lei <tom.leiming@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH next 4/4] blk-mq: initialize req->q in allocation
Date: Thu, 17 Apr 2014 23:49:38 +0800 [thread overview]
Message-ID: <1397749778-14485-5-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1397749778-14485-1-git-send-email-tom.leiming@gmail.com>
The patch basically reverts the patch of(blk-mq:
initialize request on allocation) in Jens's tree(already
in -next), and only initialize req->q in allocation
for two reasons:
- presumed cache hotness on completion
- blk_rq_tagged(rq) depends on reset of req->mq_ctx
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
block/blk-mq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1eff3d9..b7a51ed 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -82,7 +82,6 @@ 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->tags->rqs[tag];
- blk_rq_init(hctx->queue, rq);
rq->tag = tag;
return rq;
@@ -187,6 +186,7 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
if (blk_queue_io_stat(q))
rw_flags |= REQ_IO_STAT;
+ rq->q = q;
rq->mq_ctx = ctx;
rq->cmd_flags = rw_flags;
rq->start_time = jiffies;
@@ -258,6 +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);
}
@@ -1194,6 +1195,7 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set,
left -= to_do * rq_size;
for (j = 0; j < to_do; j++) {
tags->rqs[i] = p;
+ blk_rq_init(NULL, tags->rqs[i]);
if (set->ops->init_request) {
if (set->ops->init_request(set->driver_data,
tags->rqs[i], hctx_idx, i,
--
1.7.9.5
prev parent reply other threads:[~2014-04-17 15:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 15:49 [PATCH next 0/4] blk-mq: misc changes Ming Lei
2014-04-17 15:49 ` [PATCH next 1/4] blk-mq: free hctx->ctx_map when init failed Ming Lei
2014-04-18 14:21 ` Christoph Hellwig
2014-04-17 15:49 ` [PATCH next 2/4] blk-mq: fix allocation of set->tags Ming Lei
2014-04-18 14:22 ` Christoph Hellwig
2014-04-17 15:49 ` [PATCH next 3/4] blk-mq: user (1 << order) to implement order_to_size() Ming Lei
2014-04-17 19:03 ` Jörg-Volker Peetz
2014-04-17 19:13 ` Max Filippov
2014-04-18 15:47 ` Ming Lei
2014-04-18 19:23 ` Jörg-Volker Peetz
2014-04-19 3:17 ` Ming Lei
2014-04-19 5:05 ` Jens Axboe
2014-04-17 15:49 ` Ming Lei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397749778-14485-5-git-send-email-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).