Skip to content

Commit 230bc9d

Browse files
shroffniigaw
authored andcommitted
nvme: avoid printing iopolicy in list-subsys output
Since commit d0b4c6c (“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: d0b4c6c ("nvme: extend show-topology command to add support for multipath") Signed-off-by: Nilay Shroff <[email protected]> Reviewed-by: Martin George <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Daniel Wagner <[email protected]>
1 parent 29eb149 commit 230bc9d

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

nvme-print-stdout.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,16 +1135,17 @@ static void stdout_subsystem_ctrls(nvme_subsystem_t s)
11351135
}
11361136
}
11371137

1138-
static void stdout_subsys_config(nvme_subsystem_t s)
1138+
static void stdout_subsys_config(nvme_subsystem_t s, bool show_iopolicy)
11391139
{
11401140
int len = strlen(nvme_subsystem_get_name(s));
11411141

11421142
printf("%s - NQN=%s\n", nvme_subsystem_get_name(s),
11431143
nvme_subsystem_get_nqn(s));
11441144
printf("%*s hostnqn=%s\n", len, " ",
11451145
nvme_host_get_hostnqn(nvme_subsystem_get_host(s)));
1146-
printf("%*s iopolicy=%s\n", len, " ",
1147-
nvme_subsystem_get_iopolicy(s));
1146+
if (show_iopolicy)
1147+
printf("%*s iopolicy=%s\n", len, " ",
1148+
nvme_subsystem_get_iopolicy(s));
11481149

11491150
if (stdout_print_ops.flags & VERBOSE) {
11501151
printf("%*s model=%s\n", len, " ",
@@ -1179,7 +1180,8 @@ static void stdout_subsystem(struct nvme_global_ctx *ctx, bool show_ana)
11791180
printf("\n");
11801181
first = false;
11811182

1182-
stdout_subsys_config(s);
1183+
stdout_subsys_config(s,
1184+
stdout_print_ops.flags & VERBOSE);
11831185
printf("\\\n");
11841186

11851187
if (!show_ana || !stdout_subsystem_multipath(s))
@@ -6081,7 +6083,7 @@ static void stdout_topology_tabular(struct nvme_global_ctx *ctx)
60816083
printf("\n");
60826084
first = false;
60836085

6084-
stdout_subsys_config(s);
6086+
stdout_subsys_config(s, true);
60856087
printf("\n");
60866088

60876089
if (nvme_is_multipath(s))
@@ -6114,7 +6116,7 @@ static void stdout_simple_topology(struct nvme_global_ctx *ctx,
61146116
printf("\n");
61156117
first = false;
61166118

6117-
stdout_subsys_config(s);
6119+
stdout_subsys_config(s, true);
61186120
printf("\\\n");
61196121

61206122
if (nvme_is_multipath(s))

0 commit comments

Comments
 (0)