From: Vishal Verma <vishal.l.verma@intel.com>
To: <linux-nvdimm@lists.01.org>
Cc: Ben Olson <ben.olson@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: [ndctl PATCH v2 06/10] daxctl: show a 'movable' attribute in device listings
Date: Sat, 19 Oct 2019 21:23:28 -0600 [thread overview]
Message-ID: <20191020032332.16776-7-vishal.l.verma@intel.com> (raw)
In-Reply-To: <20191020032332.16776-1-vishal.l.verma@intel.com>
For dax devices in 'system-ram' mode, display a 'movable' attribute in
device listings. This helps a user easily determine if memory was not
onlined in the expected way for any reason.
Link: https://github.com/pmem/ndctl/issues/110
Reported-by: Ben Olson <ben.olson@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
util/json.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/util/json.c b/util/json.c
index 5e6a32a..497c52b 100644
--- a/util/json.c
+++ b/util/json.c
@@ -278,7 +278,7 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
struct daxctl_memory *mem = daxctl_dev_get_memory(dev);
const char *devname = daxctl_dev_get_devname(dev);
struct json_object *jdev, *jobj;
- int node;
+ int node, movable;
jdev = json_object_new_object();
if (!devname || !jdev)
@@ -306,6 +306,18 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
if (jobj)
json_object_object_add(jdev, "mode", jobj);
+ if (mem) {
+ movable = daxctl_memory_is_movable(mem);
+ if (movable == 1)
+ jobj = json_object_new_boolean(true);
+ else if (movable == 0)
+ jobj = json_object_new_boolean(false);
+ else
+ jobj = NULL;
+ if (jobj)
+ json_object_object_add(jdev, "movable", jobj);
+ }
+
if (!daxctl_dev_is_enabled(dev)) {
jobj = json_object_new_string("disabled");
if (jobj)
--
2.20.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2019-10-20 3:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-20 3:23 [ndctl PATCH v2 00/10] fixes and movability for system-ram mode Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 01/10] libdaxctl: refactor path construction in op_for_one_memblock() Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 02/10] libdaxctl: refactor memblock_is_online() checks Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 03/10] daxctl/device.c: fix json output omission for reconfigure-device Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 04/10] libdaxctl: add an API to determine if memory is movable Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 05/10] libdaxctl: allow memblock_in_dev() to return an error Vishal Verma
2019-10-20 3:23 ` Vishal Verma [this message]
2019-10-20 3:23 ` [ndctl PATCH v2 07/10] daxctl: detect races when onlining memory blocks Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 08/10] Documentation: clarify memory movablity for reconfigure-device Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 09/10] libdaxctl: add an API to online memory in a non-movable state Vishal Verma
2019-10-20 3:23 ` [ndctl PATCH v2 10/10] daxctl: add --no-movable option for onlining memory Vishal Verma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191020032332.16776-7-vishal.l.verma@intel.com \
--to=vishal.l.verma@intel.com \
--cc=ben.olson@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-nvdimm@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).