All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl, list: display the 'map' location in listings
@ 2018-05-25 22:35 Vishal Verma
  2018-05-28 18:04 ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Vishal Verma @ 2018-05-25 22:35 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Yigal Korman

For 'fsdax' and 'devdax' namespaces, a 'map' location may be specified
for page structures storage. This can be 'mem', for system RAM, or 'dev'
for using pmem as the backing storage. Once set, there was no way of
telling using ndctl, which of the two locations a namespace was
configured for. Add this in util_namespace_to_json so that all
namespace listings contain the map location.

Reported-by: "Yigal Korman" <yigal.korman@netapp.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 util/json.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/util/json.c b/util/json.c
index c606e1c..17dd90c 100644
--- a/util/json.c
+++ b/util/json.c
@@ -667,11 +667,17 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 {
 	struct json_object *jndns = json_object_new_object();
 	struct json_object *jobj, *jbbs = NULL;
+	const char *locations[] = {
+		[NDCTL_PFN_LOC_NONE] = "none",
+		[NDCTL_PFN_LOC_RAM] = "mem",
+		[NDCTL_PFN_LOC_PMEM] = "dev",
+	};
 	unsigned long long size = ULLONG_MAX;
 	unsigned int sector_size = UINT_MAX;
 	enum ndctl_namespace_mode mode;
 	const char *bdev = NULL, *name;
 	unsigned int bb_count = 0;
+	enum ndctl_pfn_loc loc;
 	struct ndctl_btt *btt;
 	struct ndctl_pfn *pfn;
 	struct ndctl_dax *dax;
@@ -749,6 +755,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		jobj = util_raw_uuid(ndns);
 		if (jobj)
 			json_object_object_add(jndns, "raw_uuid", jobj);
+		loc = ndctl_pfn_get_location(pfn);
+		jobj = json_object_new_string(locations[loc]);
+		if (!jobj)
+			goto err;
+		if (jobj)
+			json_object_object_add(jndns, "map", jobj);
 		bdev = ndctl_pfn_get_block_device(pfn);
 	} else if (dax) {
 		struct daxctl_region *dax_region;
@@ -763,6 +775,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		jobj = util_raw_uuid(ndns);
 		if (jobj)
 			json_object_object_add(jndns, "raw_uuid", jobj);
+		loc = ndctl_dax_get_location(dax);
+		jobj = json_object_new_string(locations[loc]);
+		if (!jobj)
+			goto err;
+		if (jobj)
+			json_object_object_add(jndns, "map", jobj);
 		if ((flags & UTIL_JSON_DAX) && dax_region) {
 			jobj = util_daxctl_region_to_json(dax_region, NULL,
 					flags);
-- 
2.17.0

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [ndctl PATCH] ndctl, list: display the 'map' location in listings
  2018-05-25 22:35 [ndctl PATCH] ndctl, list: display the 'map' location in listings Vishal Verma
@ 2018-05-28 18:04 ` Dan Williams
  2018-05-29 18:52   ` Verma, Vishal L
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2018-05-28 18:04 UTC (permalink / raw)
  To: Verma, Vishal L; +Cc: Yigal.Korman, linux-nvdimm

On Fri, May 25, 2018 at 3:36 PM Vishal Verma <vishal.l.verma@intel.com>
wrote:

> For 'fsdax' and 'devdax' namespaces, a 'map' location may be specified
> for page structures storage. This can be 'mem', for system RAM, or 'dev'
> for using pmem as the backing storage. Once set, there was no way of
> telling using ndctl, which of the two locations a namespace was
> configured for. Add this in util_namespace_to_json so that all
> namespace listings contain the map location.

> Reported-by: "Yigal Korman" <yigal.korman@netapp.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>   util/json.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)

> diff --git a/util/json.c b/util/json.c
> index c606e1c..17dd90c 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -667,11 +667,17 @@ struct json_object *util_namespace_to_json(struct
ndctl_namespace *ndns,
>   {
>          struct json_object *jndns = json_object_new_object();
>          struct json_object *jobj, *jbbs = NULL;
> +       const char *locations[] = {
> +               [NDCTL_PFN_LOC_NONE] = "none",
> +               [NDCTL_PFN_LOC_RAM] = "mem",
> +               [NDCTL_PFN_LOC_PMEM] = "dev",
> +       };
>          unsigned long long size = ULLONG_MAX;
>          unsigned int sector_size = UINT_MAX;
>          enum ndctl_namespace_mode mode;
>          const char *bdev = NULL, *name;
>          unsigned int bb_count = 0;
> +       enum ndctl_pfn_loc loc;
>          struct ndctl_btt *btt;
>          struct ndctl_pfn *pfn;
>          struct ndctl_dax *dax;
> @@ -749,6 +755,12 @@ struct json_object *util_namespace_to_json(struct
ndctl_namespace *ndns,
>                  jobj = util_raw_uuid(ndns);
>                  if (jobj)
>                          json_object_object_add(jndns, "raw_uuid", jobj);
> +               loc = ndctl_pfn_get_location(pfn);
> +               jobj = json_object_new_string(locations[loc]);
> +               if (!jobj)
> +                       goto err;
> +               if (jobj)
> +                       json_object_object_add(jndns, "map", jobj);
>                  bdev = ndctl_pfn_get_block_device(pfn);
>          } else if (dax) {
>                  struct daxctl_region *dax_region;
> @@ -763,6 +775,12 @@ struct json_object *util_namespace_to_json(struct
ndctl_namespace *ndns,
>                  jobj = util_raw_uuid(ndns);
>                  if (jobj)
>                          json_object_object_add(jndns, "raw_uuid", jobj);
> +               loc = ndctl_dax_get_location(dax);
> +               jobj = json_object_new_string(locations[loc]);
> +               if (!jobj)
> +                       goto err;
> +               if (jobj)
> +                       json_object_object_add(jndns, "map", jobj);
>                  if ((flags & UTIL_JSON_DAX) && dax_region) {
>                          jobj = util_daxctl_region_to_json(dax_region,
NULL,
>                                          flags);

There appears to be one case missing in this:

         case NDCTL_NS_MODE_MEMORY:
                 if (pfn) /* dynamic memory mode */
                         size = ndctl_pfn_get_size(pfn);
                 else /* native/static memory mode */
                         size = ndctl_namespace_get_size(ndns);
                 jobj = json_object_new_string("fsdax");
                 break;

In the "/* native/static memory mode */" configuration we should emit a
'map:"mem"' indication.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ndctl PATCH] ndctl, list: display the 'map' location in listings
  2018-05-28 18:04 ` Dan Williams
@ 2018-05-29 18:52   ` Verma, Vishal L
  2018-05-29 19:39     ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Verma, Vishal L @ 2018-05-29 18:52 UTC (permalink / raw)
  To: Williams, Dan J; +Cc: Yigal.Korman, linux-nvdimm

On Mon, 2018-05-28 at 11:04 -0700, Dan Williams wrote:
> On Fri, May 25, 2018 at 3:36 PM Vishal Verma <vishal.l.verma@intel.com>
> wrote:
> 
> > For 'fsdax' and 'devdax' namespaces, a 'map' location may be specified
> > for page structures storage. This can be 'mem', for system RAM, or
> > 'dev'
> > for using pmem as the backing storage. Once set, there was no way of
> > telling using ndctl, which of the two locations a namespace was
> > configured for. Add this in util_namespace_to_json so that all
> > namespace listings contain the map location.
> > Reported-by: "Yigal Korman" <yigal.korman@netapp.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >   util/json.c | 18 ++++++++++++++++++
> >   1 file changed, 18 insertions(+)
> > diff --git a/util/json.c b/util/json.c
> > index c606e1c..17dd90c 100644
> > --- a/util/json.c
> > +++ b/util/json.c
> > @@ -667,11 +667,17 @@ struct json_object *util_namespace_to_json(struct
> 
> ndctl_namespace *ndns,
> >   {
> >          struct json_object *jndns = json_object_new_object();
> >          struct json_object *jobj, *jbbs = NULL;
> > +       const char *locations[] = {
> > +               [NDCTL_PFN_LOC_NONE] = "none",
> > +               [NDCTL_PFN_LOC_RAM] = "mem",
> > +               [NDCTL_PFN_LOC_PMEM] = "dev",
> > +       };
> >          unsigned long long size = ULLONG_MAX;
> >          unsigned int sector_size = UINT_MAX;
> >          enum ndctl_namespace_mode mode;
> >          const char *bdev = NULL, *name;
> >          unsigned int bb_count = 0;
> > +       enum ndctl_pfn_loc loc;
> >          struct ndctl_btt *btt;
> >          struct ndctl_pfn *pfn;
> >          struct ndctl_dax *dax;
> > @@ -749,6 +755,12 @@ struct json_object *util_namespace_to_json(struct
> 
> ndctl_namespace *ndns,
> >                  jobj = util_raw_uuid(ndns);
> >                  if (jobj)
> >                          json_object_object_add(jndns, "raw_uuid",
> > jobj);
> > +               loc = ndctl_pfn_get_location(pfn);
> > +               jobj = json_object_new_string(locations[loc]);
> > +               if (!jobj)
> > +                       goto err;
> > +               if (jobj)
> > +                       json_object_object_add(jndns, "map", jobj);
> >                  bdev = ndctl_pfn_get_block_device(pfn);
> >          } else if (dax) {
> >                  struct daxctl_region *dax_region;
> > @@ -763,6 +775,12 @@ struct json_object *util_namespace_to_json(struct
> 
> ndctl_namespace *ndns,
> >                  jobj = util_raw_uuid(ndns);
> >                  if (jobj)
> >                          json_object_object_add(jndns, "raw_uuid",
> > jobj);
> > +               loc = ndctl_dax_get_location(dax);
> > +               jobj = json_object_new_string(locations[loc]);
> > +               if (!jobj)
> > +                       goto err;
> > +               if (jobj)
> > +                       json_object_object_add(jndns, "map", jobj);
> >                  if ((flags & UTIL_JSON_DAX) && dax_region) {
> >                          jobj = util_daxctl_region_to_json(dax_region,
> 
> NULL,
> >                                          flags);
> 
> There appears to be one case missing in this:
> 
>          case NDCTL_NS_MODE_MEMORY:
>                  if (pfn) /* dynamic memory mode */
>                          size = ndctl_pfn_get_size(pfn);
>                  else /* native/static memory mode */
>                          size = ndctl_namespace_get_size(ndns);
>                  jobj = json_object_new_string("fsdax");
>                  break;
> 
> In the "/* native/static memory mode */" configuration we should emit a
> 'map:"mem"' indication.

Ah good catch. Is this for legacy/labelless namespaces that have been
configured into fsdax mode?

I'll fixup and send a new version.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ndctl PATCH] ndctl, list: display the 'map' location in listings
  2018-05-29 18:52   ` Verma, Vishal L
@ 2018-05-29 19:39     ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2018-05-29 19:39 UTC (permalink / raw)
  To: Verma, Vishal L; +Cc: Yigal.Korman, linux-nvdimm

On Tue, May 29, 2018 at 11:52 AM, Verma, Vishal L
<vishal.l.verma@intel.com> wrote:
> On Mon, 2018-05-28 at 11:04 -0700, Dan Williams wrote:
>> On Fri, May 25, 2018 at 3:36 PM Vishal Verma <vishal.l.verma@intel.com>
>> wrote:
>>
>> > For 'fsdax' and 'devdax' namespaces, a 'map' location may be specified
>> > for page structures storage. This can be 'mem', for system RAM, or
>> > 'dev'
>> > for using pmem as the backing storage. Once set, there was no way of
>> > telling using ndctl, which of the two locations a namespace was
>> > configured for. Add this in util_namespace_to_json so that all
>> > namespace listings contain the map location.
>> > Reported-by: "Yigal Korman" <yigal.korman@netapp.com>
>> > Cc: Dan Williams <dan.j.williams@intel.com>
>> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
>> > ---
>> >   util/json.c | 18 ++++++++++++++++++
>> >   1 file changed, 18 insertions(+)
>> > diff --git a/util/json.c b/util/json.c
>> > index c606e1c..17dd90c 100644
>> > --- a/util/json.c
>> > +++ b/util/json.c
>> > @@ -667,11 +667,17 @@ struct json_object *util_namespace_to_json(struct
>>
>> ndctl_namespace *ndns,
>> >   {
>> >          struct json_object *jndns = json_object_new_object();
>> >          struct json_object *jobj, *jbbs = NULL;
>> > +       const char *locations[] = {
>> > +               [NDCTL_PFN_LOC_NONE] = "none",
>> > +               [NDCTL_PFN_LOC_RAM] = "mem",
>> > +               [NDCTL_PFN_LOC_PMEM] = "dev",
>> > +       };
>> >          unsigned long long size = ULLONG_MAX;
>> >          unsigned int sector_size = UINT_MAX;
>> >          enum ndctl_namespace_mode mode;
>> >          const char *bdev = NULL, *name;
>> >          unsigned int bb_count = 0;
>> > +       enum ndctl_pfn_loc loc;
>> >          struct ndctl_btt *btt;
>> >          struct ndctl_pfn *pfn;
>> >          struct ndctl_dax *dax;
>> > @@ -749,6 +755,12 @@ struct json_object *util_namespace_to_json(struct
>>
>> ndctl_namespace *ndns,
>> >                  jobj = util_raw_uuid(ndns);
>> >                  if (jobj)
>> >                          json_object_object_add(jndns, "raw_uuid",
>> > jobj);
>> > +               loc = ndctl_pfn_get_location(pfn);
>> > +               jobj = json_object_new_string(locations[loc]);
>> > +               if (!jobj)
>> > +                       goto err;
>> > +               if (jobj)
>> > +                       json_object_object_add(jndns, "map", jobj);
>> >                  bdev = ndctl_pfn_get_block_device(pfn);
>> >          } else if (dax) {
>> >                  struct daxctl_region *dax_region;
>> > @@ -763,6 +775,12 @@ struct json_object *util_namespace_to_json(struct
>>
>> ndctl_namespace *ndns,
>> >                  jobj = util_raw_uuid(ndns);
>> >                  if (jobj)
>> >                          json_object_object_add(jndns, "raw_uuid",
>> > jobj);
>> > +               loc = ndctl_dax_get_location(dax);
>> > +               jobj = json_object_new_string(locations[loc]);
>> > +               if (!jobj)
>> > +                       goto err;
>> > +               if (jobj)
>> > +                       json_object_object_add(jndns, "map", jobj);
>> >                  if ((flags & UTIL_JSON_DAX) && dax_region) {
>> >                          jobj = util_daxctl_region_to_json(dax_region,
>>
>> NULL,
>> >                                          flags);
>>
>> There appears to be one case missing in this:
>>
>>          case NDCTL_NS_MODE_MEMORY:
>>                  if (pfn) /* dynamic memory mode */
>>                          size = ndctl_pfn_get_size(pfn);
>>                  else /* native/static memory mode */
>>                          size = ndctl_namespace_get_size(ndns);
>>                  jobj = json_object_new_string("fsdax");
>>                  break;
>>
>> In the "/* native/static memory mode */" configuration we should emit a
>> 'map:"mem"' indication.
>
> Ah good catch. Is this for legacy/labelless namespaces that have been
> configured into fsdax mode?

This is strictly for memmap=ss!nn and legacy-e820 defined namespaces
where the assumption is that they are small and never need to have the
map allocated anywhere else but System RAM.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-29 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 22:35 [ndctl PATCH] ndctl, list: display the 'map' location in listings Vishal Verma
2018-05-28 18:04 ` Dan Williams
2018-05-29 18:52   ` Verma, Vishal L
2018-05-29 19:39     ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.