diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-10-19 17:33:00 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-27 16:43:15 +0200 |
commit | c7b84d4226adaa601e9f73574ef123d1500cf712 (patch) | |
tree | ae9bb82d960e7a6ec7d6d4530907899006060b6a | |
parent | block: prefetch request to be initialized (diff) | |
download | linux-c7b84d4226adaa601e9f73574ef123d1500cf712.tar.xz linux-c7b84d4226adaa601e9f73574ef123d1500cf712.zip |
block: re-flow blk_mq_rq_ctx_init()
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>
Link: https://lore.kernel.org/r/20211019153300.623322-5-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-mq.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 7cdb10f96aa6..ec966e0b172d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -323,6 +323,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; @@ -330,22 +341,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 @@ -357,7 +358,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; |