Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH 2/4] nvme: check admin queue with ctrl->admin_q, not rq_disk
Date: Sun, 28 Jul 2019 03:41:53 +0900	[thread overview]
Message-ID: <20190727184155.18014-3-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20190727184155.18014-1-minwoo.im.dev@gmail.com>

It used to figure out whether the given request is about the admin queue
or not by the req->rq_disk only.  But, in case of lightnvm, the request
may not have rq_disk mapped so that we just can't return the proper qid
for the I/O NVM commands like Vector Chunk Read/Write.

This patch replaces the condition from rq_disk to check
nvme_ctrl->admin_q and the given request_queue from the request itself.

This patch also moved nvme_req_qid() right next to struct nvme_ctrl to
have it inside.

Cc: Keith Busch <kbusch at kernel.org>
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Cc: Matias Bj?rling <mb at lightnvm.io>
Cc: Javier Gonz?lez <javier at javigon.com>
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/nvme.h | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 2e76198f5833..60c1abf8dce1 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -122,13 +122,6 @@ static inline struct nvme_request *nvme_req(struct request *req)
 	return blk_mq_rq_to_pdu(req);
 }
 
-static inline u16 nvme_req_qid(struct request *req)
-{
-	if (!req->rq_disk)
-		return 0;
-	return req->mq_hctx->queue_num + 1;
-}
-
 /* The below value is the specific amount of delay needed before checking
  * readiness in case of the PCI_DEVICE(0x1c58, 0x0003), which needs the
  * NVME_QUIRK_DELAY_BEFORE_CHK_RDY quirk enabled. The value (in ms) was
@@ -260,6 +253,15 @@ struct nvme_ctrl {
 	struct nvme_fault_inject fault_inject;
 };
 
+static inline u16 nvme_req_qid(struct request *req)
+{
+	struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
+
+	if (req->q == ctrl->admin_q)
+		return 0;
+	return req->mq_hctx->queue_num + 1;
+}
+
 enum nvme_iopolicy {
 	NVME_IOPOLICY_NUMA,
 	NVME_IOPOLICY_RR,
-- 
2.17.1

  parent reply	other threads:[~2019-07-27 18:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27 18:41 [PATCH 0/4] nvme: update way to get qid in trace Minwoo Im
2019-07-27 18:41 ` [PATCH 1/4] nvme: simplify nvme_req_qid() Minwoo Im
2019-07-27 18:41 ` Minwoo Im [this message]
2019-07-27 18:41 ` [PATCH 3/4] nvme: lightnvm: trace opcode name Minwoo Im
2019-07-27 19:36   ` Matias Bjørling
2019-07-28  3:12     ` Minwoo Im
2019-07-27 18:41 ` [PATCH 4/4] nvme: lightnvm: trace opcode name of I/O commands for 2.0 Minwoo Im
2019-07-27 19:47   ` Matias Bjørling
2019-07-28  3:15     ` Minwoo Im

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=20190727184155.18014-3-minwoo.im.dev@gmail.com \
    --to=minwoo.im.dev@gmail.com \
    /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