From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
James Smart <james.smart@broadcom.com>
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH 08/13] nvme-fc: store the generic nvme_ctrl in set->driver_data
Date: Tue, 20 Sep 2022 19:16:06 +0200 [thread overview]
Message-ID: <20220920171611.1289361-9-hch@lst.de> (raw)
In-Reply-To: <20220920171611.1289361-1-hch@lst.de>
Point the private data to the generic controller structure in preparation
of using the common tagset init/exit code and use the chance the cleanup
the init_hctx methods a bit.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/fc.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index ee376111f5610..d707cf93f1f4b 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1829,7 +1829,7 @@ nvme_fc_exit_request(struct blk_mq_tag_set *set, struct request *rq,
{
struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq);
- return __nvme_fc_exit_request(set->driver_data, op);
+ return __nvme_fc_exit_request(to_fc_ctrl(set->driver_data), op);
}
static int
@@ -2135,7 +2135,7 @@ static int
nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq,
unsigned int hctx_idx, unsigned int numa_node)
{
- struct nvme_fc_ctrl *ctrl = set->driver_data;
+ struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data);
struct nvme_fcp_op_w_sgl *op = blk_mq_rq_to_pdu(rq);
int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0;
struct nvme_fc_queue *queue = &ctrl->queues[queue_idx];
@@ -2206,36 +2206,28 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
}
}
-static inline void
-__nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, struct nvme_fc_ctrl *ctrl,
- unsigned int qidx)
+static inline int
+__nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int qidx)
{
+ struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data);
struct nvme_fc_queue *queue = &ctrl->queues[qidx];
hctx->driver_data = queue;
queue->hctx = hctx;
+ return 0;
}
static int
-nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
- unsigned int hctx_idx)
+nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int hctx_idx)
{
- struct nvme_fc_ctrl *ctrl = data;
-
- __nvme_fc_init_hctx(hctx, ctrl, hctx_idx + 1);
-
- return 0;
+ return __nvme_fc_init_hctx(hctx, data, hctx_idx + 1);
}
static int
nvme_fc_init_admin_hctx(struct blk_mq_hw_ctx *hctx, void *data,
unsigned int hctx_idx)
{
- struct nvme_fc_ctrl *ctrl = data;
-
- __nvme_fc_init_hctx(hctx, ctrl, hctx_idx);
-
- return 0;
+ return __nvme_fc_init_hctx(hctx, data, hctx_idx);
}
static void
@@ -2862,7 +2854,7 @@ nvme_fc_complete_rq(struct request *rq)
static void nvme_fc_map_queues(struct blk_mq_tag_set *set)
{
- struct nvme_fc_ctrl *ctrl = set->driver_data;
+ struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data);
int i;
for (i = 0; i < set->nr_maps; i++) {
@@ -2923,7 +2915,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
ctrl->tag_set.cmd_size =
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
ctrl->lport->ops->fcprqst_priv_sz);
- ctrl->tag_set.driver_data = ctrl;
+ ctrl->tag_set.driver_data = &ctrl->ctrl;
ctrl->tag_set.nr_hw_queues = ctrl->ctrl.queue_count - 1;
ctrl->tag_set.timeout = NVME_IO_TIMEOUT;
@@ -3546,7 +3538,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
ctrl->admin_tag_set.cmd_size =
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
ctrl->lport->ops->fcprqst_priv_sz);
- ctrl->admin_tag_set.driver_data = ctrl;
+ ctrl->admin_tag_set.driver_data = &ctrl->ctrl;
ctrl->admin_tag_set.nr_hw_queues = 1;
ctrl->admin_tag_set.timeout = NVME_ADMIN_TIMEOUT;
ctrl->admin_tag_set.flags = BLK_MQ_F_NO_SCHED;
--
2.30.2
next prev parent reply other threads:[~2022-09-20 17:17 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 17:15 consolidate tagset / misc request_queue allocation Christoph Hellwig
2022-09-20 17:15 ` [PATCH 01/13] nvme: add common helpers to allocate and free tagsets Christoph Hellwig
2022-09-20 21:42 ` Chaitanya Kulkarni
2022-09-21 3:37 ` Chao Leng
2022-09-22 5:45 ` Christoph Hellwig
2022-09-22 8:02 ` Chao Leng
2022-09-22 14:18 ` Christoph Hellwig
2022-09-21 8:25 ` Sagi Grimberg
2022-09-22 5:48 ` Christoph Hellwig
2022-09-22 8:09 ` Chao Leng
2022-09-22 14:19 ` Christoph Hellwig
2022-09-20 17:16 ` [PATCH 02/13] nvme-tcp: remove the unused queue_size member in nvme_tcp_queue Christoph Hellwig
2022-09-20 21:43 ` Chaitanya Kulkarni
2022-09-21 9:24 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 03/13] nvme-tcp: store the generic nvme_ctrl in set->driver_data Christoph Hellwig
2022-09-20 21:43 ` Chaitanya Kulkarni
2022-09-21 9:25 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 04/13] nvme-tcp: use the tagset alloc/free helpers Christoph Hellwig
2022-09-20 21:44 ` Chaitanya Kulkarni
2022-09-21 9:26 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 05/13] nvme-rdma: store the generic nvme_ctrl in set->driver_data Christoph Hellwig
2022-09-20 21:44 ` Chaitanya Kulkarni
2022-09-21 9:26 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 06/13] nvme-rdma: use the tagset alloc/free helpers Christoph Hellwig
2022-09-20 21:45 ` Chaitanya Kulkarni
2022-09-21 9:29 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 07/13] nvme-fc: keep ctrl->sqsize in sync with opts->queue_size Christoph Hellwig
2022-09-21 9:30 ` Sagi Grimberg
2022-09-22 22:48 ` James Smart
2022-09-20 17:16 ` Christoph Hellwig [this message]
2022-09-21 9:32 ` [PATCH 08/13] nvme-fc: store the generic nvme_ctrl in set->driver_data Sagi Grimberg
2022-09-22 22:51 ` James Smart
2022-09-20 17:16 ` [PATCH 09/13] nvme-fc: use the tagset alloc/free helpers Christoph Hellwig
2022-09-21 9:33 ` Sagi Grimberg
2022-09-22 22:56 ` James Smart
2022-09-20 17:16 ` [PATCH 10/13] nvme-loop: initialize sqsize later Christoph Hellwig
2022-09-20 21:45 ` Chaitanya Kulkarni
2022-09-21 9:33 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 11/13] nvme-loop: store the generic nvme_ctrl in set->driver_data Christoph Hellwig
2022-09-20 21:46 ` Chaitanya Kulkarni
2022-09-21 9:34 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 12/13] nvme-loop: use the tagset alloc/free helpers Christoph Hellwig
2022-09-20 21:46 ` Chaitanya Kulkarni
2022-09-21 9:34 ` Sagi Grimberg
2022-09-20 17:16 ` [PATCH 13/13] nvme: remove nvme_ctrl_init_connect_q Christoph Hellwig
2022-09-20 21:46 ` Chaitanya Kulkarni
2022-09-21 9:34 ` Sagi Grimberg
2022-09-27 7:27 ` consolidate tagset / misc request_queue allocation Christoph Hellwig
2022-09-28 6:47 ` Sagi Grimberg
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=20220920171611.1289361-9-hch@lst.de \
--to=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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