daxctl: emit counts of total and online memblocks
Vishal Verma
maintainerPATCH 1/1 daxctl: emit counts of total and online memblocks
Fir daxctl device listings, if in 'system-ram' mode, it is useful to know whether the memory associated with the device is online or not. Since the memory is comprised of a number of 'memblocks', and it is possible (albeit rare) to have a subset of them online, and the rest offline, we can't just use a boolean online-or-offline flag for the state.
Add a couple of counts, one for the total number of memblocks associated with the device, and another for the ones that are online.
Cc Dan Williams <[email protected]>
Cc Dave Hansen <[email protected]>
Reported-by Steve Scargall <[email protected]>
Signed-off-by Vishal Verma <[email protected]>
--- util/json.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
util/json.c +11 -0
@@ -482,6 +482,17 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,json_object_object_add (jdev,"mode" , jobj);if (mem &&daxctl_dev_get_resource (dev) !=0 ) { +int num_sections =daxctl_memory_num_sections (mem); +int num_online =daxctl_memory_is_online (mem); + + jobj =json_object_new_int (num_online); +if (jobj) +json_object_object_add (jdev,"online_memblocks" , jobj); + + jobj =json_object_new_int (num_sections); +if (jobj) +json_object_object_add (jdev,"total_memblocks" , jobj); + movable =daxctl_memory_is_movable (mem);if (movable ==1 ) jobj =json_object_new_boolean (true);
Signature · 4 lines
2.30.2 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]