On 20/02/2025 14:20, Donet Tom wrote: > 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 > ------------------ > # ./ndctl list -R -C > [ > { > "dev":"region1", > "size":12884901888, > "align":16777216, > "available_size":11257511936, > "max_available_extent":9630121984, > "type":"pmem", > "iset_id":14748366918514061582, > "persistence_domain":"unknown" > }, > > With this patch > --------------- > # ./ndctl list -R -C > [ > { > "dev":"region1", > "size":12884901888, > "align":16777216, > "available_size":11257511936, > "max_available_extent":9630121984, > "type":"pmem", > "iset_id":14748366918514061582, > "capabilities":[ > { > "mode":"fsdax", > "alignments":[ > 65536, > 2097152, > 1073741824 > ] > }, > { > "mode":"devdax", > "alignments":[ > 65536, > 2097152, > 1073741824 > ] > } > ], > "persistence_domain":"unknown" > }, > > v1 -> v2: > Addressed the review comments from Jeff and Alison. > > v1: > https://lore.kernel.org/all/20250219094049.5156-1-donet...@linux.ibm.com/ > > Fixes: 965fa02e372f ("util: Distribute 'filter' and 'json' helpers to > per-tool objects") > Signed-off-by: Donet Tom <donet...@linux.vnet.ibm.com>
Reviewed-by: Li Zhijian <lizhij...@fujitsu.com> Tested-by: Li Zhijian <lizhij...@fujitsu.com> > --- > ndctl/json.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ndctl/json.c b/ndctl/json.c > index 23bad7f..7646882 100644 > --- a/ndctl/json.c > +++ b/ndctl/json.c > @@ -381,7 +381,7 @@ 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) > + if (!btt && !pfn && !dax) > return NULL; > > jcaps = json_object_new_array();