Commit 59e29ce6 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Christoph Hellwig

nvme: cache struct nvme_ctrl reference to struct nvme_request

We will need to reference the controller in the setup and completion
time for tracing and future traffic based keep alive support.
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 20209384
...@@ -1737,6 +1737,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, ...@@ -1737,6 +1737,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq,
int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0;
struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; struct nvme_fc_queue *queue = &ctrl->queues[queue_idx];
nvme_req(rq)->ctrl = &ctrl->ctrl;
return __nvme_fc_init_request(ctrl, queue, op, rq, queue->rqcnt++); return __nvme_fc_init_request(ctrl, queue, op, rq, queue->rqcnt++);
} }
......
...@@ -102,6 +102,7 @@ struct nvme_request { ...@@ -102,6 +102,7 @@ struct nvme_request {
u8 retries; u8 retries;
u8 flags; u8 flags;
u16 status; u16 status;
struct nvme_ctrl *ctrl;
}; };
/* /*
......
...@@ -418,6 +418,8 @@ static int nvme_init_request(struct blk_mq_tag_set *set, struct request *req, ...@@ -418,6 +418,8 @@ static int nvme_init_request(struct blk_mq_tag_set *set, struct request *req,
BUG_ON(!nvmeq); BUG_ON(!nvmeq);
iod->nvmeq = nvmeq; iod->nvmeq = nvmeq;
nvme_req(req)->ctrl = &dev->ctrl;
return 0; return 0;
} }
......
...@@ -288,6 +288,7 @@ static int nvme_rdma_init_request(struct blk_mq_tag_set *set, ...@@ -288,6 +288,7 @@ static int nvme_rdma_init_request(struct blk_mq_tag_set *set,
struct ib_device *ibdev = dev->dev; struct ib_device *ibdev = dev->dev;
int ret; int ret;
nvme_req(rq)->ctrl = &ctrl->ctrl;
ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command), ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command),
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (ret) if (ret)
......
...@@ -227,6 +227,7 @@ static int nvme_loop_init_request(struct blk_mq_tag_set *set, ...@@ -227,6 +227,7 @@ static int nvme_loop_init_request(struct blk_mq_tag_set *set,
{ {
struct nvme_loop_ctrl *ctrl = set->driver_data; struct nvme_loop_ctrl *ctrl = set->driver_data;
nvme_req(req)->ctrl = &ctrl->ctrl;
return nvme_loop_init_iod(ctrl, blk_mq_rq_to_pdu(req), return nvme_loop_init_iod(ctrl, blk_mq_rq_to_pdu(req),
(set == &ctrl->tag_set) ? hctx_idx + 1 : 0); (set == &ctrl->tag_set) ? hctx_idx + 1 : 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment