[PATCH 2/2] nvme: add iopolicy field in JSON output

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


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




More information about the Linux-nvme mailing list