Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header
@ 2026-01-12 11:15 Nilay Shroff
  2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nilay Shroff @ 2026-01-12 11:15 UTC (permalink / raw)
  To: linux-nvme; +Cc: wagi, martinus.gpy

Hi,

The nvme-cli currently prints the iopolicy value in the subsystem header
for both the show-topology and list-subsys commands. This behavior was
introduced by commit d0b4c6cf0006 (“nvme: extend show-topology command
to add support for multipath”).

Printing the iopolicy value in the output of the show-topology command is
intentional and useful. The command also displays additional columns such
as Nodes or queue-depth, depending on the configured I/O policy. Including
the iopolicy in the header makes it easier to correlate the output with the
active policy and understand the resulting I/O path behavior.

However, the iopolicy value is not particularly relevant for the list-subsys
command. It currently appears there for non-verbose output because both
show-topology and list-subsys commands share a common helper function that
prints the subsystem header. As a result, the iopolicy field unintentionally
leaked into the list-subsys output.

In addition, while the iopolicy field is shown in the regular text output
of show-topology, it was missing from the JSON output format when show-topology
is executed in non-verbose mode. This patchset addresses both of these issues
and consists of two patches:
First patch avoids printing the iopolicy field in the list-subsys output
unless the command is invoked with the verbose flag.
Second patch adds the iopolicy field to the JSON output of the show-topology
command.

Thanks!

Nilay Shroff (2):
  nvme: avoid printing iopolicy in list-subsys output
  nvme: add iopolicy field in JSON output

 nvme-print-json.c   |  4 ++--
 nvme-print-stdout.c | 14 ++++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

-- 
2.52.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output
  2026-01-12 11:15 [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Nilay Shroff
@ 2026-01-12 11:16 ` Nilay Shroff
  2026-01-12 23:47   ` Chaitanya Kulkarni
  2026-01-13  7:29   ` Martin George
  2026-01-12 11:16 ` [PATCH 2/2] nvme: add iopolicy field in JSON output Nilay Shroff
  2026-01-14  9:37 ` [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Daniel Wagner
  2 siblings, 2 replies; 8+ messages in thread
From: Nilay Shroff @ 2026-01-12 11:16 UTC (permalink / raw)
  To: linux-nvme; +Cc: wagi, martinus.gpy

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] nvme: add iopolicy field in JSON output
  2026-01-12 11:15 [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Nilay Shroff
  2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
@ 2026-01-12 11:16 ` Nilay Shroff
  2026-01-12 23:47   ` Chaitanya Kulkarni
  2026-01-13  7:31   ` Martin George
  2026-01-14  9:37 ` [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Daniel Wagner
  2 siblings, 2 replies; 8+ messages in thread
From: Nilay Shroff @ 2026-01-12 11:16 UTC (permalink / raw)
  To: linux-nvme; +Cc: wagi, martinus.gpy

Commit d0b4c6cf0006 (“nvme: extend show-topology command to add
support for multipath”) extended the show-topology command output
and added the iopolicy field to the subsystem header in the text
output even when show-topology command is executed in non-verbose
mode.

However, the iopolicy field was not included in the JSON output,
(for non-verbose output) resulting in an inconsistency between the
text and JSON formats. This change fixes that by adding the iopolicy
field to the JSON output when the show-topology command is executed
with the JSON output format.

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

diff --git a/nvme-print-json.c b/nvme-print-json.c
index ca5d77483..72d17ca60 100644
--- a/nvme-print-json.c
+++ b/nvme-print-json.c
@@ -4851,6 +4851,8 @@ static void json_simple_topology(struct nvme_global_ctx *ctx)
 			subsystem_attrs = json_create_object();
 			obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s));
 			obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s));
+			obj_add_str(subsystem_attrs, "IOPolicy",
+					nvme_subsystem_get_iopolicy(s));
 
 			if (verbose_mode()) {
 				obj_add_str(subsystem_attrs, "Model",
@@ -4859,8 +4861,6 @@ static void json_simple_topology(struct nvme_global_ctx *ctx)
 						nvme_subsystem_get_serial(s));
 				obj_add_str(subsystem_attrs, "Firmware",
 						nvme_subsystem_get_fw_rev(s));
-				obj_add_str(subsystem_attrs, "IOPolicy",
-						nvme_subsystem_get_iopolicy(s));
 				obj_add_str(subsystem_attrs, "Type",
 						nvme_subsystem_get_type(s));
 			}
-- 
2.52.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output
  2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
@ 2026-01-12 23:47   ` Chaitanya Kulkarni
  2026-01-13  7:29   ` Martin George
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2026-01-12 23:47 UTC (permalink / raw)
  To: Nilay Shroff, linux-nvme@lists.infradead.org
  Cc: wagi@kernel.org, martinus.gpy@gmail.com

On 1/12/26 03:16, Nilay Shroff wrote:
> 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@linux.ibm.com>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] nvme: add iopolicy field in JSON output
  2026-01-12 11:16 ` [PATCH 2/2] nvme: add iopolicy field in JSON output Nilay Shroff
@ 2026-01-12 23:47   ` Chaitanya Kulkarni
  2026-01-13  7:31   ` Martin George
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2026-01-12 23:47 UTC (permalink / raw)
  To: Nilay Shroff, linux-nvme@lists.infradead.org
  Cc: wagi@kernel.org, martinus.gpy@gmail.com

On 1/12/26 03:16, Nilay Shroff wrote:
> Commit d0b4c6cf0006 (“nvme: extend show-topology command to add
> support for multipath”) extended the show-topology command output
> and added the iopolicy field to the subsystem header in the text
> output even when show-topology command is executed in non-verbose
> mode.
>
> However, the iopolicy field was not included in the JSON output,
> (for non-verbose output) resulting in an inconsistency between the
> text and JSON formats. This change fixes that by adding the iopolicy
> field to the JSON output when the show-topology command is executed
> with the JSON output format.
>
> Fixes: d0b4c6cf0006 ("nvme: extend show-topology command to add support for multipath")
> Signed-off-by: Nilay Shroff<nilay@linux.ibm.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output
  2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
  2026-01-12 23:47   ` Chaitanya Kulkarni
@ 2026-01-13  7:29   ` Martin George
  1 sibling, 0 replies; 8+ messages in thread
From: Martin George @ 2026-01-13  7:29 UTC (permalink / raw)
  To: Nilay Shroff, linux-nvme; +Cc: wagi

On Mon, 2026-01-12 at 16:46 +0530, Nilay Shroff wrote:
> 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@linux.ibm.com>
> ---
>  nvme-print-stdout.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 

Reviewed-by: Martin George <marting@netapp.com>

-Martin


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] nvme: add iopolicy field in JSON output
  2026-01-12 11:16 ` [PATCH 2/2] nvme: add iopolicy field in JSON output Nilay Shroff
  2026-01-12 23:47   ` Chaitanya Kulkarni
@ 2026-01-13  7:31   ` Martin George
  1 sibling, 0 replies; 8+ messages in thread
From: Martin George @ 2026-01-13  7:31 UTC (permalink / raw)
  To: Nilay Shroff, linux-nvme; +Cc: wagi

On Mon, 2026-01-12 at 16:46 +0530, Nilay Shroff wrote:
> Commit d0b4c6cf0006 (“nvme: extend show-topology command to add
> support for multipath”) extended the show-topology command output
> and added the iopolicy field to the subsystem header in the text
> output even when show-topology command is executed in non-verbose
> mode.
> 
> However, the iopolicy field was not included in the JSON output,
> (for non-verbose output) resulting in an inconsistency between the
> text and JSON formats. This change fixes that by adding the iopolicy
> field to the JSON output when the show-topology command is executed
> with the JSON output format.
> 
> Fixes: d0b4c6cf0006 ("nvme: extend show-topology command to add
> support for multipath")
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> ---

Reviewed-by: Martin George <marting@netapp.com>

-Martin


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header
  2026-01-12 11:15 [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Nilay Shroff
  2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
  2026-01-12 11:16 ` [PATCH 2/2] nvme: add iopolicy field in JSON output Nilay Shroff
@ 2026-01-14  9:37 ` Daniel Wagner
  2 siblings, 0 replies; 8+ messages in thread
From: Daniel Wagner @ 2026-01-14  9:37 UTC (permalink / raw)
  To: linux-nvme, Nilay Shroff; +Cc: Daniel Wagner, martinus.gpy


On Mon, 12 Jan 2026 16:45:59 +0530, Nilay Shroff wrote:
> The nvme-cli currently prints the iopolicy value in the subsystem header
> for both the show-topology and list-subsys commands. This behavior was
> introduced by commit d0b4c6cf0006 (“nvme: extend show-topology command
> to add support for multipath”).
> 
> Printing the iopolicy value in the output of the show-topology command is
> intentional and useful. The command also displays additional columns such
> as Nodes or queue-depth, depending on the configured I/O policy. Including
> the iopolicy in the header makes it easier to correlate the output with the
> active policy and understand the resulting I/O path behavior.
> 
> [...]

Applied, thanks!

[1/2] nvme: avoid printing iopolicy in list-subsys output
      commit: 230bc9d4924b99635ae29e2208271c0ee4e39a0e
[2/2] nvme: add iopolicy field in JSON output
      commit: f5b985fabd6d03871161b3a6c4a585888dace801

Best regards,
-- 
Daniel Wagner <wagi@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-14  9:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 11:15 [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Nilay Shroff
2026-01-12 11:16 ` [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output Nilay Shroff
2026-01-12 23:47   ` Chaitanya Kulkarni
2026-01-13  7:29   ` Martin George
2026-01-12 11:16 ` [PATCH 2/2] nvme: add iopolicy field in JSON output Nilay Shroff
2026-01-12 23:47   ` Chaitanya Kulkarni
2026-01-13  7:31   ` Martin George
2026-01-14  9:37 ` [PATCH 0/2] nvme-cli: limit printing iopolicy in subsystem header Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox