From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: <kbusch@kernel.org>, <hch@lst.de>, <sagi@grimberg.me>
Cc: <linux-nvme@lists.infradead.org>, Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 2/3] nvme-core: move gencounter check into nvme_cid()
Date: Fri, 10 Dec 2021 03:21:15 -0800 [thread overview]
Message-ID: <20211210112116.9299-3-chaitanyak@nvidia.com> (raw)
In-Reply-To: <20211210112116.9299-1-chaitanyak@nvidia.com>
From: Chaitanya Kulkarni <kch@nvidia.com>
Move gencounter related code to nvme_cid to keep the code under its own
interface, this also avoids any open coding and if condition when
gencounter feature is turned off.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/host/core.c | 3 ---
drivers/nvme/host/nvme.h | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3c9f221379bd..7008cea69400 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -990,7 +990,6 @@ EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req)
{
struct nvme_command *cmd = nvme_req(req)->cmd;
- struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
blk_status_t ret = BLK_STS_OK;
if (!(req->rq_flags & RQF_DONTPREP))
@@ -1037,8 +1036,6 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req)
return BLK_STS_IOERR;
}
- if (!(ctrl->quirks & NVME_QUIRK_SKIP_CID_GEN))
- nvme_req(req)->genctr++;
cmd->common.command_id = nvme_cid(req);
trace_nvme_setup_cmd(req, cmd);
return ret;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 98d7627cfdce..2be0191e1a1f 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -511,6 +511,8 @@ struct nvme_ctrl_ops {
static inline u16 nvme_cid(struct request *rq)
{
+ if (!(nvme_req(rq)->ctrl->quirks & NVME_QUIRK_SKIP_CID_GEN))
+ nvme_req(rq)->genctr++;
return nvme_cid_install_genctr(nvme_req(rq)->genctr) | rq->tag;
}
--
2.29.0
next prev parent reply other threads:[~2021-12-10 11:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 11:21 [PATCH 0/3] nvme-core: make gencounter feature tunable Chaitanya Kulkarni
2021-12-10 11:21 ` [PATCH 1/3] nvme-core: make cid gencounter configurable Chaitanya Kulkarni
2021-12-10 11:21 ` Chaitanya Kulkarni [this message]
2021-12-10 15:43 ` [PATCH 2/3] nvme-core: move gencounter check into nvme_cid() Keith Busch
2021-12-10 17:46 ` Chaitanya Kulkarni
2021-12-12 9:19 ` Sagi Grimberg
2021-12-13 7:07 ` Chaitanya Kulkarni
2021-12-10 11:21 ` [PATCH 3/3] nvme: add KConfig options for debug features Chaitanya Kulkarni
2021-12-12 9:22 ` Sagi Grimberg
2021-12-13 7:39 ` Chaitanya Kulkarni
2021-12-13 9:27 ` Sagi Grimberg
2021-12-14 7:54 ` Chaitanya Kulkarni
2021-12-14 11:03 ` Sagi Grimberg
2021-12-17 6:52 ` Chaitanya Kulkarni
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=20211210112116.9299-3-chaitanyak@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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