From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [RFC PATCH V6 1/3] nvmet: introduce nvmet_req_to_ctrl to get ctrl instance
Date: Thu, 6 Jun 2019 15:32:27 +0900 [thread overview]
Message-ID: <20190606063229.17258-2-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20190606063229.17258-1-minwoo.im.dev@gmail.com>
nvme host driver can get the controller instance from
nvme_req(req)->ctrl. In case of target driver, it needs to get
controller instance from the struct nvmet_req with sq where the request
has been submitted.
Cc: Keith Busch <kbusch at kernel.org>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
drivers/nvme/target/nvmet.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index c25d88fc9dec..2d569a1dc3f4 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -318,6 +318,15 @@ struct nvmet_req {
u64 error_slba;
};
+static inline struct nvmet_ctrl *nvmet_req_to_ctrl(struct nvmet_req *req)
+{
+ struct nvmet_sq *sq = req->sq;
+
+ if (sq)
+ return sq->ctrl;
+ return NULL;
+}
+
extern struct workqueue_struct *buffered_io_wq;
static inline void nvmet_set_result(struct nvmet_req *req, u32 result)
--
2.21.0
next prev parent reply other threads:[~2019-06-06 6:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 6:32 [RFC PATCH V6 0/3] nvme-trace: Add support for fabrics command Minwoo Im
2019-06-06 6:32 ` Minwoo Im [this message]
2019-06-06 6:48 ` [RFC PATCH V6 1/3] nvmet: introduce nvmet_req_to_ctrl to get ctrl instance Christoph Hellwig
2019-06-06 8:43 ` Minwoo Im
2019-06-06 6:32 ` [RFC PATCH V6 2/3] nvme: trace: do not EXPORT_SYMBOL for a trace function Minwoo Im
2019-06-06 6:48 ` Christoph Hellwig
2019-06-06 15:37 ` Chaitanya Kulkarni
2019-06-06 6:32 ` [RFC PATCH V6 3/3] nvmet: introduce target-side trace Minwoo Im
2019-06-06 6:51 ` Christoph Hellwig
2019-06-06 8:45 ` 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=20190606063229.17258-2-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