Skip to contentSkip to conversation

nvme: set passthrough command gendisk

PATCH In review Keith Busch 2 participants 4 messages Oct 14, 2020 – Oct 15, 2020 NVMe

lore
Share & tools
lore

Keith Busch

author maintainer
#0 lore raw

PATCH 1/1 nvme: set passthrough command gendisk

The nvme event traces for IO commands are reporting the wrong QID because we never set the request's gendisk. Set this parameter if the passthrough command is being sent through an IO queue.

---
 drivers/nvme/host/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +7 -2
index 95ef4943d8bd..ab5921e824d5 100644
@@ -894,9 +894,14 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 		unsigned timeout, int qid, int at_head,
 		blk_mq_req_flags_t flags, bool poll)
 {
+	struct nvme_ns *ns = q->queuedata;
+	struct gendisk *disk = NULL;
 	struct request *req;
 	int ret;
 
+	if (ns)
+		disk = ns->disk;
+
 	req = nvme_alloc_request(q, cmd, flags, qid);
 	if (IS_ERR(req))
 		return PTR_ERR(req);
@@ -910,9 +915,9 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 	}
 
 	if (poll)
-		nvme_execute_rq_polled(req->q, NULL, req, at_head);
+		nvme_execute_rq_polled(req->q, disk, req, at_head);
 	else
-		blk_execute_rq(req->q, NULL, req, at_head);
+		blk_execute_rq(req->q, disk, req, at_head);
 	if (result)
 		*result = nvme_req(req)->result;
 	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
Signature · 7 lines
2.24.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw
Quoted 3 lines · Keith Busch

The nvme event traces for IO commands are reporting the wrong QID because we never set the request's gendisk. Set this parameter if the passthrough command is being sent through an IO queue.

Why do we event need the check for a non-NULL disk in nvme_req_qid?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#2 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Keith Busch

The nvme event traces for IO commands are reporting the wrong QID because we never set the request's gendisk. Set this parameter if the passthrough command is being sent through an IO queue.

Why do we event need the check for a non-NULL disk in nvme_req_qid?

It's the criteria we use to know if we're tracing an Admin vs IO command. I suppose we could change the criteria we check rather than set the disk parameter. Maybe rq->queue->queuedata instead of rq->bd_disk. Would you prefer that?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw
Quoted 6 lines · Keith Busch
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Keith Busch

The nvme event traces for IO commands are reporting the wrong QID because we never set the request's gendisk. Set this parameter if the passthrough command is being sent through an IO queue.

Quoted 6 lines
Quoted 1 line

Why do we event need the check for a non-NULL disk in nvme_req_qid?

It's the criteria we use to know if we're tracing an Admin vs IO command. I suppose we could change the criteria we check rather than set the disk parameter. Maybe rq->queue->queuedata instead of rq->bd_disk. Would you prefer that?

Yes, I think that makes much more sense.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme