diff mbox

[3/3] ndctl: print alignment of dax namespaces

Message ID 20170421071219.18744-3-oohall@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Oliver O'Halloran April 21, 2017, 7:12 a.m. UTC
Print the alignment for dax namespaces creation. It's good to be explicit about
it since about the selected region alignment dictates the type of faults
we allow on the namespace.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 util/json.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Dan Williams April 21, 2017, 5:27 p.m. UTC | #1
On Fri, Apr 21, 2017 at 12:12 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
> Print the alignment for dax namespaces creation. It's good to be explicit about
> it since about the selected region alignment dictates the type of faults
> we allow on the namespace.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  util/json.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/util/json.c b/util/json.c
> index d6a8d4c899ed..720d22559df0 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -299,6 +299,11 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>                 if (!jobj)
>                         goto err;
>                 json_object_object_add(jndns, "uuid", jobj);
> +               jobj = json_object_new_int64(ndctl_dax_get_align(dax));
> +               if (!jobj)
> +                       goto err;
> +               json_object_object_add(jndns, "align", jobj);
> +

Yes, we need this, but lets hide this attribute when the 'align' is
zero. That helps with ndctl running on older kernels that do not have
an align attribute available.
diff mbox

Patch

diff --git a/util/json.c b/util/json.c
index d6a8d4c899ed..720d22559df0 100644
--- a/util/json.c
+++ b/util/json.c
@@ -299,6 +299,11 @@  struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		if (!jobj)
 			goto err;
 		json_object_object_add(jndns, "uuid", jobj);
+		jobj = json_object_new_int64(ndctl_dax_get_align(dax));
+		if (!jobj)
+			goto err;
+		json_object_object_add(jndns, "align", jobj);
+
 		if (include_dax) {
 			dax_region = ndctl_dax_get_daxctl_region(dax);
 			jobj = util_daxctl_region_to_json(dax_region,