Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Nilay Shroff <nilay@linux.ibm.com>,
	Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH v5 1/3] nvme: define an event bit enum for nvme_ctrl::events
Date: Wed, 25 Nov 2026 14:15:20 +0800	[thread overview]
Message-ID: <20261125061522.231591-2-kanie@linux.alibaba.com> (raw)
In-Reply-To: <20261125061522.231591-1-kanie@linux.alibaba.com>

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.

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/host/core.c | 6 +++---
 drivers/nvme/host/nvme.h | 5 +++++
 2 files changed, 8 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..4eafdcf59c821 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -356,6 +356,11 @@ enum nvme_ctrl_flags {
 	NVME_CTRL_FROZEN		= 6,
 };
 
+/* event bits in nvme_ctrl::events */
+enum nvme_events {
+	NVME_EVENT_NS_CHANGED,
+};
+
 struct nvme_ctrl {
 	bool comp_seen;
 	bool identified;
-- 
2.43.7



  reply	other threads:[~2026-11-25  6:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:15 [PATCH v5 0/3] nvme: make SMART / Health Status AENs reach hwmon alarms Guixin Liu
2026-11-25  6:15 ` Guixin Liu [this message]
2026-11-25  7:05   ` [PATCH v5 1/3] nvme: define an event bit enum for nvme_ctrl::events Christoph Hellwig
2026-11-25  6:15 ` [PATCH v5 2/3] nvme: define the SMART / Health Status async event subtypes Guixin Liu
2026-11-25  7:05   ` Christoph Hellwig
2026-11-25  6:15 ` [PATCH v5 3/3] nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN Guixin Liu

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=20261125061522.231591-2-kanie@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nilay@linux.ibm.com \
    --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