* [ndctl PATCH] ndctl, list: always show 'name' if it is available
@ 2017-07-21 18:39 Dan Williams
2017-07-21 19:15 ` Linda Knippers
0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2017-07-21 18:39 UTC (permalink / raw)
To: linux-nvdimm
The user-friendly name of a namespace should always be emitted.
Reported-by: Linda Knippers <linda.knippers@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
util/json.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/util/json.c b/util/json.c
index 559a022ae405..2b2b5af16504 100644
--- a/util/json.c
+++ b/util/json.c
@@ -558,7 +558,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
struct json_object *jobj, *jbbs = NULL;
unsigned long long size = ULLONG_MAX;
enum ndctl_namespace_mode mode;
- const char *bdev = NULL;
+ const char *bdev = NULL, *name;
unsigned int bb_count;
struct ndctl_btt *btt;
struct ndctl_pfn *pfn;
@@ -654,7 +654,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "daxregion", jobj);
} else if (dax_region) {
struct daxctl_dev *dev;
- const char *name;
dev = daxctl_dev_get_first(dax_region);
name = daxctl_dev_get_devname(dev);
@@ -664,22 +663,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "chardev", jobj);
}
} else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
- const char *name;
-
ndctl_namespace_get_uuid(ndns, uuid);
uuid_unparse(uuid, buf);
jobj = json_object_new_string(buf);
if (!jobj)
goto err;
json_object_object_add(jndns, "uuid", jobj);
-
- name = ndctl_namespace_get_alt_name(ndns);
- if (name[0]) {
- jobj = json_object_new_string(name);
- if (!jobj)
- goto err;
- json_object_object_add(jndns, "name", jobj);
- }
bdev = ndctl_namespace_get_block_device(ndns);
} else
bdev = ndctl_namespace_get_block_device(ndns);
@@ -698,6 +687,14 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "state", jobj);
}
+ name = ndctl_namespace_get_alt_name(ndns);
+ if (name && name[0]) {
+ jobj = json_object_new_string(name);
+ if (!jobj)
+ goto err;
+ json_object_object_add(jndns, "name", jobj);
+ }
+
numa = ndctl_namespace_get_numa_node(ndns);
if (numa >= 0) {
jobj = json_object_new_int(numa);
_______________________________________________
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: always show 'name' if it is available
2017-07-21 18:39 [ndctl PATCH] ndctl, list: always show 'name' if it is available Dan Williams
@ 2017-07-21 19:15 ` Linda Knippers
2017-07-21 19:26 ` Dave Jiang
0 siblings, 1 reply; 4+ messages in thread
From: Linda Knippers @ 2017-07-21 19:15 UTC (permalink / raw)
To: Dan Williams, linux-nvdimm
On 07/21/2017 02:39 PM, Dan Williams wrote:
> The user-friendly name of a namespace should always be emitted.
Thanks!
When running your master branch I was getting this:
{
"dev":"namespace1.12",
"mode":"memory",
"size":10567548928,
"uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
"blockdev":"pmem1.12"
},
and now after applying this patch, along with your previous
dax chardev patch set, to your pending branch, I get this:
{
"dev":"namespace1.12",
"mode":"memory",
"size":10567548928,
"uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
"blockdev":"pmem1.12",
"name":"number9",
"numa_node":0,
"badblock_count":24815632
},
The name is there but I'm also seeing a badblock_count. I don't
see the badblock_count if I build your master branch, but I don't
see anything here that would cause it to appear. Still looking
if I missed something...
-- ljk
>
> Reported-by: Linda Knippers <linda.knippers@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> util/json.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/util/json.c b/util/json.c
> index 559a022ae405..2b2b5af16504 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -558,7 +558,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
> struct json_object *jobj, *jbbs = NULL;
> unsigned long long size = ULLONG_MAX;
> enum ndctl_namespace_mode mode;
> - const char *bdev = NULL;
> + const char *bdev = NULL, *name;
> unsigned int bb_count;
> struct ndctl_btt *btt;
> struct ndctl_pfn *pfn;
> @@ -654,7 +654,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
> json_object_object_add(jndns, "daxregion", jobj);
> } else if (dax_region) {
> struct daxctl_dev *dev;
> - const char *name;
>
> dev = daxctl_dev_get_first(dax_region);
> name = daxctl_dev_get_devname(dev);
> @@ -664,22 +663,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
> json_object_object_add(jndns, "chardev", jobj);
> }
> } else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
> - const char *name;
> -
> ndctl_namespace_get_uuid(ndns, uuid);
> uuid_unparse(uuid, buf);
> jobj = json_object_new_string(buf);
> if (!jobj)
> goto err;
> json_object_object_add(jndns, "uuid", jobj);
> -
> - name = ndctl_namespace_get_alt_name(ndns);
> - if (name[0]) {
> - jobj = json_object_new_string(name);
> - if (!jobj)
> - goto err;
> - json_object_object_add(jndns, "name", jobj);
> - }
> bdev = ndctl_namespace_get_block_device(ndns);
> } else
> bdev = ndctl_namespace_get_block_device(ndns);
> @@ -698,6 +687,14 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
> json_object_object_add(jndns, "state", jobj);
> }
>
> + name = ndctl_namespace_get_alt_name(ndns);
> + if (name && name[0]) {
> + jobj = json_object_new_string(name);
> + if (!jobj)
> + goto err;
> + json_object_object_add(jndns, "name", jobj);
> + }
> +
> numa = ndctl_namespace_get_numa_node(ndns);
> if (numa >= 0) {
> jobj = json_object_new_int(numa);
>
_______________________________________________
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: always show 'name' if it is available
2017-07-21 19:15 ` Linda Knippers
@ 2017-07-21 19:26 ` Dave Jiang
2017-07-21 19:30 ` Linda Knippers
0 siblings, 1 reply; 4+ messages in thread
From: Dave Jiang @ 2017-07-21 19:26 UTC (permalink / raw)
To: Linda Knippers, Dan Williams, linux-nvdimm
On 07/21/2017 12:15 PM, Linda Knippers wrote:
>
>
> On 07/21/2017 02:39 PM, Dan Williams wrote:
>> The user-friendly name of a namespace should always be emitted.
>
> Thanks!
>
> When running your master branch I was getting this:
>
> {
> "dev":"namespace1.12",
> "mode":"memory",
> "size":10567548928,
> "uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
> "blockdev":"pmem1.12"
> },
>
> and now after applying this patch, along with your previous
> dax chardev patch set, to your pending branch, I get this:
>
> {
> "dev":"namespace1.12",
> "mode":"memory",
> "size":10567548928,
> "uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
> "blockdev":"pmem1.12",
> "name":"number9",
> "numa_node":0,
> "badblock_count":24815632
> },
>
> The name is there but I'm also seeing a badblock_count. I don't
> see the badblock_count if I build your master branch, but I don't
> see anything here that would cause it to appear. Still looking
> if I missed something...
You have this commit right?
076e4f77db5fbabb2bc1d179919f6792f350d49e ndctl: fix uninitialized
bb_count in list command
>
> -- ljk
>>
>> Reported-by: Linda Knippers <linda.knippers@hpe.com>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>> util/json.c | 21 +++++++++------------
>> 1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/util/json.c b/util/json.c
>> index 559a022ae405..2b2b5af16504 100644
>> --- a/util/json.c
>> +++ b/util/json.c
>> @@ -558,7 +558,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>> struct json_object *jobj, *jbbs = NULL;
>> unsigned long long size = ULLONG_MAX;
>> enum ndctl_namespace_mode mode;
>> - const char *bdev = NULL;
>> + const char *bdev = NULL, *name;
>> unsigned int bb_count;
>> struct ndctl_btt *btt;
>> struct ndctl_pfn *pfn;
>> @@ -654,7 +654,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>> json_object_object_add(jndns, "daxregion", jobj);
>> } else if (dax_region) {
>> struct daxctl_dev *dev;
>> - const char *name;
>>
>> dev = daxctl_dev_get_first(dax_region);
>> name = daxctl_dev_get_devname(dev);
>> @@ -664,22 +663,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>> json_object_object_add(jndns, "chardev", jobj);
>> }
>> } else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
>> - const char *name;
>> -
>> ndctl_namespace_get_uuid(ndns, uuid);
>> uuid_unparse(uuid, buf);
>> jobj = json_object_new_string(buf);
>> if (!jobj)
>> goto err;
>> json_object_object_add(jndns, "uuid", jobj);
>> -
>> - name = ndctl_namespace_get_alt_name(ndns);
>> - if (name[0]) {
>> - jobj = json_object_new_string(name);
>> - if (!jobj)
>> - goto err;
>> - json_object_object_add(jndns, "name", jobj);
>> - }
>> bdev = ndctl_namespace_get_block_device(ndns);
>> } else
>> bdev = ndctl_namespace_get_block_device(ndns);
>> @@ -698,6 +687,14 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>> json_object_object_add(jndns, "state", jobj);
>> }
>>
>> + name = ndctl_namespace_get_alt_name(ndns);
>> + if (name && name[0]) {
>> + jobj = json_object_new_string(name);
>> + if (!jobj)
>> + goto err;
>> + json_object_object_add(jndns, "name", jobj);
>> + }
>> +
>> numa = ndctl_namespace_get_numa_node(ndns);
>> if (numa >= 0) {
>> jobj = json_object_new_int(numa);
>>
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
>
_______________________________________________
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: always show 'name' if it is available
2017-07-21 19:26 ` Dave Jiang
@ 2017-07-21 19:30 ` Linda Knippers
0 siblings, 0 replies; 4+ messages in thread
From: Linda Knippers @ 2017-07-21 19:30 UTC (permalink / raw)
To: Dave Jiang, Dan Williams, linux-nvdimm
On 07/21/2017 03:26 PM, Dave Jiang wrote:
> On 07/21/2017 12:15 PM, Linda Knippers wrote:
>>
>>
>> On 07/21/2017 02:39 PM, Dan Williams wrote:
>>> The user-friendly name of a namespace should always be emitted.
>>
>> Thanks!
>>
>> When running your master branch I was getting this:
>>
>> {
>> "dev":"namespace1.12",
>> "mode":"memory",
>> "size":10567548928,
>> "uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
>> "blockdev":"pmem1.12"
>> },
>>
>> and now after applying this patch, along with your previous
>> dax chardev patch set, to your pending branch, I get this:
>>
>> {
>> "dev":"namespace1.12",
>> "mode":"memory",
>> "size":10567548928,
>> "uuid":"aee879c1-4da9-4ea4-98d9-d2afa0ef294a",
>> "blockdev":"pmem1.12",
>> "name":"number9",
>> "numa_node":0,
>> "badblock_count":24815632
>> },
>>
>> The name is there but I'm also seeing a badblock_count. I don't
>> see the badblock_count if I build your master branch, but I don't
>> see anything here that would cause it to appear. Still looking
>> if I missed something...
>
> You have this commit right?
> 076e4f77db5fbabb2bc1d179919f6792f350d49e ndctl: fix uninitialized
> bb_count in list command
That looked promising but I do have it in both cases.
-- ljk
>
>>
>> -- ljk
>>>
>>> Reported-by: Linda Knippers <linda.knippers@hpe.com>
>>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>>> ---
>>> util/json.c | 21 +++++++++------------
>>> 1 file changed, 9 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/util/json.c b/util/json.c
>>> index 559a022ae405..2b2b5af16504 100644
>>> --- a/util/json.c
>>> +++ b/util/json.c
>>> @@ -558,7 +558,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>>> struct json_object *jobj, *jbbs = NULL;
>>> unsigned long long size = ULLONG_MAX;
>>> enum ndctl_namespace_mode mode;
>>> - const char *bdev = NULL;
>>> + const char *bdev = NULL, *name;
>>> unsigned int bb_count;
>>> struct ndctl_btt *btt;
>>> struct ndctl_pfn *pfn;
>>> @@ -654,7 +654,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>>> json_object_object_add(jndns, "daxregion", jobj);
>>> } else if (dax_region) {
>>> struct daxctl_dev *dev;
>>> - const char *name;
>>>
>>> dev = daxctl_dev_get_first(dax_region);
>>> name = daxctl_dev_get_devname(dev);
>>> @@ -664,22 +663,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>>> json_object_object_add(jndns, "chardev", jobj);
>>> }
>>> } else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
>>> - const char *name;
>>> -
>>> ndctl_namespace_get_uuid(ndns, uuid);
>>> uuid_unparse(uuid, buf);
>>> jobj = json_object_new_string(buf);
>>> if (!jobj)
>>> goto err;
>>> json_object_object_add(jndns, "uuid", jobj);
>>> -
>>> - name = ndctl_namespace_get_alt_name(ndns);
>>> - if (name[0]) {
>>> - jobj = json_object_new_string(name);
>>> - if (!jobj)
>>> - goto err;
>>> - json_object_object_add(jndns, "name", jobj);
>>> - }
>>> bdev = ndctl_namespace_get_block_device(ndns);
>>> } else
>>> bdev = ndctl_namespace_get_block_device(ndns);
>>> @@ -698,6 +687,14 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
>>> json_object_object_add(jndns, "state", jobj);
>>> }
>>>
>>> + name = ndctl_namespace_get_alt_name(ndns);
>>> + if (name && name[0]) {
>>> + jobj = json_object_new_string(name);
>>> + if (!jobj)
>>> + goto err;
>>> + json_object_object_add(jndns, "name", jobj);
>>> + }
>>> +
>>> numa = ndctl_namespace_get_numa_node(ndns);
>>> if (numa >= 0) {
>>> jobj = json_object_new_int(numa);
>>>
>> _______________________________________________
>> Linux-nvdimm mailing list
>> Linux-nvdimm@lists.01.org
>> https://lists.01.org/mailman/listinfo/linux-nvdimm
>>
_______________________________________________
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:[~2017-07-21 19:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-21 18:39 [ndctl PATCH] ndctl, list: always show 'name' if it is available Dan Williams
2017-07-21 19:15 ` Linda Knippers
2017-07-21 19:26 ` Dave Jiang
2017-07-21 19:30 ` Linda Knippers
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.