[PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output

Nilay Shroff nilay at linux.ibm.com
Mon Jan 12 03:16:00 PST 2026


Since commit d0b4c6cf0006 (“nvme: extend show-topology command to add
support for multipath”), the subsystem header printed by both show-
topology and list-subsys includes the iopolicy field regardless of
whether the verbose flag is specified.

For show-topology, this behavior is intentional and useful. The command
now prints additional columns such as Nodes or queue-depth depending on
the configured I/O policy, and displaying the iopolicy value makes it
easier to correlate the output with the active policy configured for
the subsystem.

However, the same iopolicy field is also printed in the list-subsys
output, where it is not always relevant. This happens because both
commands share the common helper stdout_subsys_config() to print the
subsystem header.

This change fixes the inconsistency by always printing the iopolicy
field for show-topology, while suppressing it for list-subsys unless
the command is invoked with the verbose flag.

Fixes: d0b4c6cf0006 ("nvme: extend show-topology command to add support for multipath")
Signed-off-by: Nilay Shroff <nilay at linux.ibm.com>
---
 nvme-print-stdout.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c
index 7995052a3..9a4fe80d9 100644
--- a/nvme-print-stdout.c
+++ b/nvme-print-stdout.c
@@ -1135,7 +1135,7 @@ static void stdout_subsystem_ctrls(nvme_subsystem_t s)
 	}
 }
 
-static void stdout_subsys_config(nvme_subsystem_t s)
+static void stdout_subsys_config(nvme_subsystem_t s, bool show_iopolicy)
 {
 	int len = strlen(nvme_subsystem_get_name(s));
 
@@ -1143,8 +1143,9 @@ static void stdout_subsys_config(nvme_subsystem_t s)
 	       nvme_subsystem_get_nqn(s));
 	printf("%*s   hostnqn=%s\n", len, " ",
 	       nvme_host_get_hostnqn(nvme_subsystem_get_host(s)));
-	printf("%*s   iopolicy=%s\n", len, " ",
-		nvme_subsystem_get_iopolicy(s));
+	if (show_iopolicy)
+		printf("%*s   iopolicy=%s\n", len, " ",
+				nvme_subsystem_get_iopolicy(s));
 
 	if (stdout_print_ops.flags & VERBOSE) {
 		printf("%*s   model=%s\n", len, " ",
@@ -1179,7 +1180,8 @@ static void stdout_subsystem(struct nvme_global_ctx *ctx, bool show_ana)
 				printf("\n");
 			first = false;
 
-			stdout_subsys_config(s);
+			stdout_subsys_config(s,
+					stdout_print_ops.flags & VERBOSE);
 			printf("\\\n");
 
 			if (!show_ana || !stdout_subsystem_multipath(s))
@@ -6057,7 +6059,7 @@ static void stdout_topology_tabular(struct nvme_global_ctx *ctx)
 				printf("\n");
 			first = false;
 
-			stdout_subsys_config(s);
+			stdout_subsys_config(s, true);
 			printf("\n");
 
 			if (nvme_is_multipath(s))
@@ -6090,7 +6092,7 @@ static void stdout_simple_topology(struct nvme_global_ctx *ctx,
 				printf("\n");
 			first = false;
 
-			stdout_subsys_config(s);
+			stdout_subsys_config(s, true);
 			printf("\\\n");
 
 			if (nvme_is_multipath(s))
-- 
2.52.0




More information about the Linux-nvme mailing list