diff mbox

ndctl: add numa_node to --list command

Message ID 149627243165.15800.17084928523692021655.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Commit 7fe746ded5e9
Headers show

Commit Message

Dave Jiang May 31, 2017, 11:13 p.m. UTC
Adding numa_node of a namesapce to the --list command. If numa_node is -1,
numa_node will not be display as there's no NUMA node.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 util/json.c |    8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/util/json.c b/util/json.c
index b718d74..a9b733a 100644
--- a/util/json.c
+++ b/util/json.c
@@ -445,6 +445,7 @@  struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 	struct ndctl_dax *dax;
 	char buf[40];
 	uuid_t uuid;
+	int numa;
 
 	if (!jndns)
 		return NULL;
@@ -567,6 +568,13 @@  struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		json_object_object_add(jndns, "state", jobj);
 	}
 
+	numa = ndctl_namespace_get_numa_node(ndns);
+	if (numa >= 0) {
+		jobj = json_object_new_int(numa);
+		if (jobj)
+			json_object_object_add(jndns, "numa_node", jobj);
+	}
+
 	if (pfn)
 		jbbs = util_pfn_badblocks_to_json(pfn, include_media_errors,
 				&bb_count);