[PATCH v4 1/3] nvme: define an event bit enum for nvme_ctrl::events
Guixin Liu
kanie at linux.alibaba.com
Tue Nov 24 04:00:30 PST 2026
The only bit used in nvme_ctrl::events is indexed with
NVME_AER_NOTICE_NS_CHANGED, an AER subtype value that doubles as the
bit number. The AER subtypes are numbered per event type and are not
a bit namespace -- the notice and SMART values overlap -- so borrowing
them as indices gets ambiguous as soon as more bits are needed. Give
the events field its own numbering.
Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
---
drivers/nvme/host/core.c | 6 +++---
drivers/nvme/host/nvme.h | 7 +++++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index cd0df9b038063..9da2061a0c0d5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4692,7 +4692,7 @@ static void nvme_scan_work(struct work_struct *work)
return;
}
- if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) {
+ if (test_and_clear_bit(NVME_EVENT_NS_CHANGED, &ctrl->events)) {
dev_info(ctrl->device, "rescanning namespaces.\n");
nvme_clear_changed_ns_log(ctrl);
}
@@ -4713,7 +4713,7 @@ static void nvme_scan_work(struct work_struct *work)
mutex_unlock(&ctrl->scan_lock);
/* Requeue if we have missed AENs */
- if (test_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events))
+ if (test_bit(NVME_EVENT_NS_CHANGED, &ctrl->events))
nvme_queue_scan(ctrl);
#ifdef CONFIG_NVME_MULTIPATH
else if (ctrl->ana_log_buf)
@@ -4947,7 +4947,7 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
switch (aer_notice_type) {
case NVME_AER_NOTICE_NS_CHANGED:
- set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
+ set_bit(NVME_EVENT_NS_CHANGED, &ctrl->events);
nvme_queue_scan(ctrl);
break;
case NVME_AER_NOTICE_FW_ACT_STARTING:
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 2543e52d6358a..8948f4ecc7567 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -356,6 +356,13 @@ enum nvme_ctrl_flags {
NVME_CTRL_FROZEN = 6,
};
+/* Event bits in nvme_ctrl::events. The numbering is independent of the
+ * AER type and subtype values in include/linux/nvme.h.
+ */
+enum nvme_events {
+ NVME_EVENT_NS_CHANGED,
+};
+
struct nvme_ctrl {
bool comp_seen;
bool identified;
--
2.43.7
More information about the Linux-nvme
mailing list