Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tokunori Ikegami <ikegami.t@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-nvme@lists.infradead.org, Tokunori Ikegami <ikegami.t@gmail.com>
Subject: [PATCH v3 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC
Date: Sat, 25 Apr 2026 22:04:13 +0900	[thread overview]
Message-ID: <20260425130426.10061-3-ikegami.t@gmail.com> (raw)
In-Reply-To: <20260425130426.10061-1-ikegami.t@gmail.com>

This is to make sure scan_work done for the commands.
Since nvme_passthru_end called when effects set.
Also scan_work is flushed when NIC or NCC effects set.

The change is to improvement the scan_work to make sure.
Always do scan for the ns_mgmt and ns_attach commands.
All drives supporting ns_mgmt and ns_attach should have the entries.
But no need to be depended on it as always do scan.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
Changes since v2:
- Document the change explanation in both the commit message and code comments.

 drivers/nvme/host/core.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1f973d88c830..d88813dfaf9c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3448,7 +3448,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
 
 static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
 {
-	struct nvme_effects_log	*log = ctrl->effects;
+	struct nvme_effects_log *log = ctrl->effects;
 
 	log->acs[nvme_admin_format_nvm] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC |
 						NVME_CMD_EFFECTS_NCC |
@@ -3473,6 +3473,19 @@ static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
 	 */
 	log->acs[nvme_admin_security_recv] &= cpu_to_le32(~NVME_CMD_EFFECTS_CSE_MASK);
 
+	/*
+	 * This is to make sure scan_work done for the commands.
+	 * Since nvme_passthru_end called when effects set.
+	 * Also scan_work is flushed when NIC or NCC effects set.
+	 *
+	 * The change is to improvement the scan_work to make sure.
+	 * Always do scan for the ns_mgmt and ns_attach commands.
+	 * All drives supporting ns_mgmt and ns_attach should have the entries.
+	 * But no need to be depended on it as always do scan.
+	 */
+	log->acs[nvme_admin_ns_mgmt] |= cpu_to_le32(NVME_CMD_EFFECTS_NCC);
+	log->acs[nvme_admin_ns_attach] |= cpu_to_le32(NVME_CMD_EFFECTS_NIC);
+
 	log->iocs[nvme_cmd_write] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
 	log->iocs[nvme_cmd_write_zeroes] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
 	log->iocs[nvme_cmd_write_uncor] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
-- 
2.51.0



  parent reply	other threads:[~2026-04-25 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-25 13:04 [PATCH v3 0/2] scan_work improvement Tokunori Ikegami
2026-04-25 13:04 ` [PATCH v3 1/2] nvme: delete unnecessary empty lines Tokunori Ikegami
2026-04-25 13:04 ` Tokunori Ikegami [this message]
2026-04-28  6:51   ` [PATCH v3 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC Keith Busch
2026-04-29  6:08     ` Tokunori Ikegami
2026-04-29  8:48       ` Keith Busch
2026-04-29 12:49         ` Tokunori Ikegami

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=20260425130426.10061-3-ikegami.t@gmail.com \
    --to=ikegami.t@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-nvme@lists.infradead.org \
    /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