From: Donet Tom <donettom@linux.ibm.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
Ritesh Harjani <ritesh.list@gmail.com>,
Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH] ndctl: json: Region capabilities are not displayed if any of the BTT, PFN, or DAX are not present
Date: Thu, 20 Feb 2025 10:37:04 +0530 [thread overview]
Message-ID: <e2379e35-68cc-4f39-b16b-4c605c753f7d@linux.ibm.com> (raw)
In-Reply-To: <x494j0pj3ar.fsf@segfault.usersys.redhat.com>
On 2/19/25 22:10, Jeff Moyer wrote:
> Donet Tom <donettom@linux.ibm.com> writes:
>
>> If any one of BTT, PFN, or DAX is not present, but the other two
>> are, then the region capabilities are not displayed in the
>> ndctl list -R -C command.
>>
>> This is because util_region_capabilities_to_json() returns NULL
>> if any one of BTT, PFN, or DAX is not present.
>>
>> In this patch, we have changed the logic to display all the region
>> capabilities that are present.
>>
>> Test Results with CONFIG_BTT disabled
>> =====================================
>> Without this patch
>> ------------------
>> # ./build/ndctl/ndctl list -R -C
>> [
>> {
>> "dev":"region1",
>> "size":549755813888,
>> "align":16777216,
>> "available_size":549755813888,
>> "max_available_extent":549755813888,
>> "type":"pmem",
>> "iset_id":11510624209454722969,
>> "persistence_domain":"memory_controller"
>> },
>>
>> With this patch
>> ---------------
>> # ./build/ndctl/ndctl list -R -C
>> [
>> {
>> "dev":"region1",
>> "size":549755813888,
>> "align":16777216,
>> "available_size":549755813888,
>> "max_available_extent":549755813888,
>> "type":"pmem",
>> "iset_id":11510624209454722969,
>> "capabilities":[
>> {
>> "mode":"fsdax",
>> "alignments":[
>> 65536,
>> 16777216
>> ]
>> },
>> {
>> "mode":"devdax",
>> "alignments":[
>> 65536,
>> 16777216
>> ]
>> }
>> ],
>> "persistence_domain":"memory_controller"
>> },
>>
>> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
>> ---
>> ndctl/json.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/ndctl/json.c b/ndctl/json.c
>> index 23bad7f..3df3bc4 100644
>> --- a/ndctl/json.c
>> +++ b/ndctl/json.c
>> @@ -381,9 +381,6 @@ struct json_object *util_region_capabilities_to_json(struct ndctl_region *region
>> struct ndctl_pfn *pfn = ndctl_region_get_pfn_seed(region);
>> struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
>>
>> - if (!btt || !pfn || !dax)
>> - return NULL;
>> -
> I think this was meant to be:
>
> if (!btt && !pfn && !dax)
> return NULL;
>
> I think that would be the more appropriate fix.
Yes. I will add it and send V2.
>
> Cheers,
> Jeff
>
>> jcaps = json_object_new_array();
>> if (!jcaps)
>> return NULL;
>> @@ -436,7 +433,8 @@ struct json_object *util_region_capabilities_to_json(struct ndctl_region *region
>> json_object_object_add(jcap, "alignments", jobj);
>> }
>>
>> - return jcaps;
>> + if (btt || pfn || dax)
>> + return jcaps;
>> err:
>> json_object_put(jcaps);
>> return NULL;
next prev parent reply other threads:[~2025-02-20 5:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 9:40 [PATCH] ndctl: json: Region capabilities are not displayed if any of the BTT, PFN, or DAX are not present Donet Tom
2025-02-19 16:40 ` Jeff Moyer
2025-02-20 5:07 ` Donet Tom [this message]
2025-02-19 17:10 ` Alison Schofield
2025-02-20 5:05 ` Donet Tom
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=e2379e35-68cc-4f39-b16b-4c605c753f7d@linux.ibm.com \
--to=donettom@linux.ibm.com \
--cc=alison.schofield@intel.com \
--cc=jmoyer@redhat.com \
--cc=linux-cxl@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=nvdimm@lists.linux.dev \
--cc=ritesh.list@gmail.com \
/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