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.ji...@intel.com>
---
 util/json.c |    8 ++++++++
 1 file changed, 8 insertions(+)

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);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to