nvme-cli: limit printing iopolicy in subsystem header
cover nvme-cli: limit printing iopolicy in subsystem header
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(-)
Signature · 1 line
2.52.0
PATCH 1/2 nvme: avoid printing iopolicy in list-subsys output
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.
--- nvme-print-stdout.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
nvme-print-stdout.c +8 -6
@@ -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))
Signature · 1 line
2.52.0
Re: [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output
Quoted 16 lines · Nilay Shroff
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.
Quoted 7 lines
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<[email protected]>---
Looks good.
-ck
Re: [PATCH 1/2] nvme: avoid printing iopolicy in list-subsys output
In reply to Nilay ShroffQuoted 22 lines · Nilay Shroff
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.
Quoted 7 lines
Fixes d0b4c6cf0006 ("nvme: extend show-topology command to addsupport for multipath")
Signed-off-by Nilay Shroff <[email protected]>---
nvme-print-stdout.c | 14 ++++++++------1 file changed, 8 insertions(+), 6 deletions(-)
-Martin
PATCH 2/2 nvme: add iopolicy field in JSON output
In reply to Nilay ShroffCommit 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.
--- nvme-print-json.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
nvme-print-json.c +2 -2
@@ -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)); }
Signature · 1 line
2.52.0
Re: [PATCH 2/2] nvme: add iopolicy field in JSON output
Quoted 6 lines · Nilay Shroff
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.
Quoted 8 lines
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<[email protected]>
Looks good.
-ck
Re: [PATCH 2/2] nvme: add iopolicy field in JSON output
In reply to Nilay ShroffQuoted 12 lines · Nilay Shroff
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.
Quoted 4 lines
Fixes d0b4c6cf0006 ("nvme: extend show-topology command to addsupport for multipath")
Signed-off-by Nilay Shroff <[email protected]>---
-Martin
Daniel Wagner
AppliedQuoted 5 lines · Nilay Shroff
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”).
Quoted 7 lines
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: f5b985fabd6d03871161b3a6c4a585888dace801Best regards,
Signature · 1 line
Daniel Wagner <[email protected]>