From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 4/4] block: re-flow blk_mq_rq_ctx_init()
Date: Tue, 19 Oct 2021 09:33:00 -0600 [thread overview]
Message-ID: <20211019153300.623322-5-axboe@kernel.dk> (raw)
In-Reply-To: <20211019153300.623322-1-axboe@kernel.dk>
Now that we have flags passed in, we can do a final re-arrange of the
flow of blk_mq_rq_ctx_init() so we're always writing request in the
order in which it is laid out.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
block/blk-mq.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 77c2c3220128..4a671d1d47ac 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -307,6 +307,17 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
struct request_queue *q = data->q;
struct request *rq = tags->static_rqs[tag];
+ rq->q = q;
+ rq->mq_ctx = ctx;
+ rq->mq_hctx = hctx;
+ rq->cmd_flags = data->cmd_flags;
+
+ if (data->flags & BLK_MQ_REQ_PM)
+ data->rq_flags |= RQF_PM;
+ if (blk_queue_io_stat(q))
+ data->rq_flags |= RQF_IO_STAT;
+ rq->rq_flags = data->rq_flags;
+
if (!(data->rq_flags & RQF_ELV)) {
rq->tag = tag;
rq->internal_tag = BLK_MQ_NO_TAG;
@@ -314,22 +325,12 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
rq->tag = BLK_MQ_NO_TAG;
rq->internal_tag = tag;
}
-
- if (data->flags & BLK_MQ_REQ_PM)
- data->rq_flags |= RQF_PM;
- if (blk_queue_io_stat(q))
- data->rq_flags |= RQF_IO_STAT;
- rq->rq_flags = data->rq_flags;
+ rq->timeout = 0;
if (blk_mq_need_time_stamp(rq))
rq->start_time_ns = ktime_get_ns();
else
rq->start_time_ns = 0;
- /* csd/requeue_work/fifo_time is initialized before use */
- rq->q = q;
- rq->mq_ctx = ctx;
- rq->mq_hctx = hctx;
- rq->cmd_flags = data->cmd_flags;
rq->rq_disk = NULL;
rq->part = NULL;
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
@@ -341,7 +342,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
#if defined(CONFIG_BLK_DEV_INTEGRITY)
rq->nr_integrity_segments = 0;
#endif
- rq->timeout = 0;
rq->end_io = NULL;
rq->end_io_data = NULL;
--
2.33.1
prev parent reply other threads:[~2021-10-19 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 15:32 [PATCHSET 0/4] Last round of alloc side optimizations Jens Axboe
2021-10-19 15:32 ` [PATCH 1/4] block: add rq_flags to struct blk_mq_alloc_data Jens Axboe
2021-10-19 18:42 ` Keith Busch
2021-10-19 18:48 ` Jens Axboe
2021-11-03 19:54 ` Guenter Roeck
2021-11-03 19:56 ` Jens Axboe
2021-11-03 21:41 ` Guenter Roeck
2021-11-03 23:29 ` Jens Axboe
2021-10-19 15:32 ` [PATCH 2/4] block: pass in blk_mq_tags to blk_mq_rq_ctx_init() Jens Axboe
2021-10-19 15:32 ` [PATCH 3/4] block: prefetch request to be initialized Jens Axboe
2021-10-19 15:33 ` Jens Axboe [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=20211019153300.623322-5-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@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