nvme: cache struct nvme_ctrl reference to struct nvme_request
authorSagi Grimberg <sagi@grimberg.me>
Fri, 29 Jun 2018 22:50:00 +0000 (16:50 -0600)
committerChristoph Hellwig <hch@lst.de>
Mon, 23 Jul 2018 07:35:18 +0000 (09:35 +0200)
We will need to reference the controller in the setup and completion
time for tracing and future traffic based keep alive support.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fc.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/target/loop.c

index 41d45a1b5c628c143caac1886bd52f08a360f15e..9cc33752539a677b3e5cd17a4c95bb165f1e0447 100644 (file)
@@ -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;
        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++);
 }
 
index 0c4a33df3b2f3bb9d8a710556dab3f8c55ed2302..f2249387b60d709271f2d5c3edd93ffb9e35d299 100644 (file)
@@ -102,6 +102,7 @@ struct nvme_request {
        u8                      retries;
        u8                      flags;
        u16                     status;
+       struct nvme_ctrl        *ctrl;
 };
 
 /*
index ba943f211687c638cab9708dbb5011b7e3d53b2f..8dcae11bbf3ab5e120099ba296d430172edadaf5 100644 (file)
@@ -418,6 +418,8 @@ static int nvme_init_request(struct blk_mq_tag_set *set, struct request *req,
 
        BUG_ON(!nvmeq);
        iod->nvmeq = nvmeq;
+
+       nvme_req(req)->ctrl = &dev->ctrl;
        return 0;
 }
 
index 363f73fe549c34528b5b3c5c08209ab4b5a54eb8..bb6e26fa833166f1ee99c5c48094a4305672c804 100644 (file)
@@ -288,6 +288,7 @@ static int nvme_rdma_init_request(struct blk_mq_tag_set *set,
        struct ib_device *ibdev = dev->dev;
        int ret;
 
+       nvme_req(rq)->ctrl = &ctrl->ctrl;
        ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command),
                        DMA_TO_DEVICE);
        if (ret)
index d8d91f04bd7eedae3e183c3a89dc3d42bd33a3ff..af7fbf4132b0185f9bcf0c604bc68a4c6b972269 100644 (file)
@@ -227,6 +227,7 @@ static int nvme_loop_init_request(struct blk_mq_tag_set *set,
 {
        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),
                        (set == &ctrl->tag_set) ? hctx_idx + 1 : 0);
 }