[PATCH v3 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

Tokunori Ikegami ikegami.t at gmail.com
Sat Apr 25 06:04:13 PDT 2026


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 at 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




More information about the Linux-nvme mailing list