Skip to content

Commit 1864ea4

Browse files
author
Christoph Hellwig
committed
nvme-fc: store the generic nvme_ctrl in set->driver_data
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 <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: James Smart <[email protected]>
1 parent 18ecd97 commit 1864ea4

File tree

1 file changed

+12
-20
lines changed
  • drivers/nvme/host

1 file changed

+12
-20
lines changed

drivers/nvme/host/fc.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ nvme_fc_exit_request(struct blk_mq_tag_set *set, struct request *rq,
18291829
{
18301830
struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq);
18311831

1832-
return __nvme_fc_exit_request(set->driver_data, op);
1832+
return __nvme_fc_exit_request(to_fc_ctrl(set->driver_data), op);
18331833
}
18341834

18351835
static int
@@ -2135,7 +2135,7 @@ static int
21352135
nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq,
21362136
unsigned int hctx_idx, unsigned int numa_node)
21372137
{
2138-
struct nvme_fc_ctrl *ctrl = set->driver_data;
2138+
struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data);
21392139
struct nvme_fcp_op_w_sgl *op = blk_mq_rq_to_pdu(rq);
21402140
int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0;
21412141
struct nvme_fc_queue *queue = &ctrl->queues[queue_idx];
@@ -2206,36 +2206,28 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
22062206
}
22072207
}
22082208

2209-
static inline void
2210-
__nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, struct nvme_fc_ctrl *ctrl,
2211-
unsigned int qidx)
2209+
static inline int
2210+
__nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int qidx)
22122211
{
2212+
struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data);
22132213
struct nvme_fc_queue *queue = &ctrl->queues[qidx];
22142214

22152215
hctx->driver_data = queue;
22162216
queue->hctx = hctx;
2217+
return 0;
22172218
}
22182219

22192220
static int
2220-
nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
2221-
unsigned int hctx_idx)
2221+
nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int hctx_idx)
22222222
{
2223-
struct nvme_fc_ctrl *ctrl = data;
2224-
2225-
__nvme_fc_init_hctx(hctx, ctrl, hctx_idx + 1);
2226-
2227-
return 0;
2223+
return __nvme_fc_init_hctx(hctx, data, hctx_idx + 1);
22282224
}
22292225

22302226
static int
22312227
nvme_fc_init_admin_hctx(struct blk_mq_hw_ctx *hctx, void *data,
22322228
unsigned int hctx_idx)
22332229
{
2234-
struct nvme_fc_ctrl *ctrl = data;
2235-
2236-
__nvme_fc_init_hctx(hctx, ctrl, hctx_idx);
2237-
2238-
return 0;
2230+
return __nvme_fc_init_hctx(hctx, data, hctx_idx);
22392231
}
22402232

22412233
static void
@@ -2862,7 +2854,7 @@ nvme_fc_complete_rq(struct request *rq)
28622854

28632855
static void nvme_fc_map_queues(struct blk_mq_tag_set *set)
28642856
{
2865-
struct nvme_fc_ctrl *ctrl = set->driver_data;
2857+
struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data);
28662858
int i;
28672859

28682860
for (i = 0; i < set->nr_maps; i++) {
@@ -2923,7 +2915,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
29232915
ctrl->tag_set.cmd_size =
29242916
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
29252917
ctrl->lport->ops->fcprqst_priv_sz);
2926-
ctrl->tag_set.driver_data = ctrl;
2918+
ctrl->tag_set.driver_data = &ctrl->ctrl;
29272919
ctrl->tag_set.nr_hw_queues = ctrl->ctrl.queue_count - 1;
29282920
ctrl->tag_set.timeout = NVME_IO_TIMEOUT;
29292921

@@ -3546,7 +3538,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
35463538
ctrl->admin_tag_set.cmd_size =
35473539
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
35483540
ctrl->lport->ops->fcprqst_priv_sz);
3549-
ctrl->admin_tag_set.driver_data = ctrl;
3541+
ctrl->admin_tag_set.driver_data = &ctrl->ctrl;
35503542
ctrl->admin_tag_set.nr_hw_queues = 1;
35513543
ctrl->admin_tag_set.timeout = NVME_ADMIN_TIMEOUT;
35523544
ctrl->admin_tag_set.flags = BLK_MQ_F_NO_SCHED;

0 commit comments

Comments
 (0)