git: bd2fc1e7d0ff - main - nvme: Rename the per-I/O queue sysctl device nodes

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 02 Nov 2024 13:54:52 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=bd2fc1e7d0fff1becd781645366f8e0ef5ca68df

commit bd2fc1e7d0fff1becd781645366f8e0ef5ca68df
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-11-02 13:53:28 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-02 13:53:28 +0000

    nvme: Rename the per-I/O queue sysctl device nodes
    
    Switch from dev.nvme.X.ioqY to dev.nvme.X.ioq.Y.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D47400
---
 sys/dev/nvme/nvme_sysctl.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
index f3566e75225d..a5a44721f9f9 100644
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -346,8 +346,8 @@ void
 nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr)
 {
 	struct sysctl_ctx_list	*ctrlr_ctx;
-	struct sysctl_oid	*ctrlr_tree, *que_tree;
-	struct sysctl_oid_list	*ctrlr_list;
+	struct sysctl_oid	*ctrlr_tree, *que_tree, *ioq_tree;
+	struct sysctl_oid_list	*ctrlr_list, *ioq_list;
 #define QUEUE_NAME_LENGTH	16
 	char			queue_name[QUEUE_NAME_LENGTH];
 	int			i;
@@ -441,9 +441,13 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr)
 	 * of the sysctls to diagnose things.
 	 */
 	if (ctrlr->ioq != NULL) {
+		ioq_tree = SYSCTL_ADD_NODE(ctrlr_ctx, ctrlr_list, OID_AUTO,
+		    "ioq", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "I/O Queues");
+		ioq_list = SYSCTL_CHILDREN(ioq_tree);
+
 		for (i = 0; i < ctrlr->num_io_queues; i++) {
-			snprintf(queue_name, QUEUE_NAME_LENGTH, "ioq%d", i);
-			que_tree = SYSCTL_ADD_NODE(ctrlr_ctx, ctrlr_list, OID_AUTO,
+			snprintf(queue_name, QUEUE_NAME_LENGTH, "%d", i);
+			que_tree = SYSCTL_ADD_NODE(ctrlr_ctx, ioq_list, OID_AUTO,
 			    queue_name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "IO Queue");
 			nvme_sysctl_initialize_queue(&ctrlr->ioq[i], ctrlr_ctx,
 			    que_tree);