ndctl: complete move to "fsdax" and "devdax"
Subsystems (2)
PATCH v2 1/1 ndctl: complete move to "fsdax" and "devdax"
Add on to the work started by:
commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")
and change some more user visible places to use "fsdax" and "devdax" modes instead of "memory" and "dax", respectively. Having multiple terms for the same mode is confusing for users.
We will continue to accept "memory" and "dax" as parameters, but all output and man pages will now use the updated terms.
Note that after the above referenced commit we still printed the old names in the default 'ndctl list' output for backward compatibility with scripts. This patch intentionally breaks that backward compatibility in favor of avoiding confusion and using the new mode names everywhere.
--- Documentation/ndctl/ndctl-inject-error.txt | 2 +- Documentation/ndctl/ndctl-list.txt | 6 +++--- ndctl/namespace.c | 16 ++++++++-------- util/json.c | 10 ++-------- 4 files changed, 14 insertions(+), 20 deletions(-)
Documentation/ndctl/ndctl-inject-error.txt +1 -1
@@ -45,7 +45,7 @@ OPTIONS NOTE: The offset is interpreted in different ways based on the "mode" of the namespace. For "raw" mode, the offset is the base namespace - offset. For "memory" mode (i.e. a "pfn" namespace), the offset is + offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is relative to the user-visible part of the namespace, and the offset introduced by the kernel's metadata will be accounted for. For a "sector" mode namespace (i.e. a "BTT" namespace), the offset is
Documentation/ndctl/ndctl-list.txt +3 -3
@@ -49,7 +49,7 @@ EXAMPLE "namespaces":[ { "dev":"namespace0.0", - "mode":"memory", + "mode":"fsdax", "size":8589934592, "blockdev":"pmem0" }
@@ -132,11 +132,11 @@ include::xable-region-options.txt[] -X:: --device-dax:: Include device-dax ("daxregion") details when a namespace is in - "dax" mode. + "devdax" mode. [verse] { "dev":"namespace0.0", - "mode":"dax", + "mode":"devdax", "size":4225761280, "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc", "daxregion":{
ndctl/namespace.c +8 -8
@@ -103,7 +103,7 @@ OPT_STRING('n', "name", ¶m.name, "name", \OPT_STRING ('s' ,"size" , ¶m.size,"size" , \"specify the namespace size in bytes (default: available capacity)" ), \OPT_STRING ('m' ,"mode" , ¶m.mode,"operation-mode" , \ -"specify a mode for the namespace, 'sector', 'memory', or 'raw'" ), \ +"specify a mode for the namespace, 'sector', 'fsdax', 'devdax' or 'raw'" ), \OPT_STRING ('M' ,"map" , ¶m.map,"memmap-location" , \"specify 'mem' or 'dev' for the location of the memmap" ), \ OPT_STRING('l', "sector-size", ¶m.sector_size, "lba-size", \
@@ -533,7 +533,7 @@ static int validate_namespace_options(struct ndctl_region *region,* supported a 2M default alignment when * ndctl_pfn_has_align() returns false. */ -debug ("%s not support 'align' for memory mode\n" , +debug ("%s not support 'align' for fsdax mode\n" , region_name);return -EAGAIN ; } else if (p->mode == NDCTL_NS_MODE_DAX
@@ -542,7 +542,7 @@ static int validate_namespace_options(struct ndctl_region *region,* Unlike the pfn case, we require the kernel to * have 'align' support for device-dax. */ -debug ("%s not support 'align' for dax mode\n" , +debug ("%s not support 'align' for devdax mode\n" , region_name);return -EAGAIN ; } else if (!param.align_default
@@ -696,7 +696,7 @@ static int validate_namespace_options(struct ndctl_region *region,if (ndns && p->mode !=NDCTL_NS_MODE_MEMORY && p->mode !=NDCTL_NS_MODE_DAX ) { -debug ("%s: --map= only valid for memory mode namespace\n" , +debug ("%s: --map= only valid for fsdax mode namespace\n" ,ndctl_namespace_get_devname (ndns));return -EINVAL ; }
@@ -709,10 +709,10 @@ static int validate_namespace_options(struct ndctl_region *region,struct ndctl_pfn *pfn =ndctl_region_get_pfn_seed (region);if (!pfn && param.mode_default) { -debug ("%s memory mode not available\n" , region_name); +debug ("%s fsdax mode not available\n" , region_name); p->mode =NDCTL_NS_MODE_RAW ; }else if (!pfn) { -error ("operation failed, %s memory mode not available\n" , +error ("operation failed, %s fsdax mode not available\n" , region_name);return -EINVAL ; }
@@ -723,7 +723,7 @@ static int validate_namespace_options(struct ndctl_region *region,struct ndctl_dax *dax =ndctl_region_get_dax_seed (region);if (!dax) { -error ("operation failed, %s dax mode not available\n" , +error ("operation failed, %s devdax mode not available\n" , region_name);return -EINVAL ; }
@@ -759,7 +759,7 @@ static int namespace_create(struct ndctl_region *region)return rc;if (ndctl_region_get_ro (region)) { -debug ("%s: read-only, inelligible for namespace creation\n" , +debug ("%s: read-only, ineligible for namespace creation\n" , devname);return -EAGAIN ; }
util/json.c +2 -8
@@ -685,19 +685,13 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns, size =ndctl_pfn_get_size (pfn); else /* native/static memory mode */ size =ndctl_namespace_get_size (ndns); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("fsdax" ); -else - jobj =json_object_new_string ("memory" ); + jobj =json_object_new_string ("fsdax" );break ;case NDCTL_NS_MODE_DAX :if (!dax) goto err; size =ndctl_dax_get_size (dax); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("devdax" ); -else - jobj =json_object_new_string ("dax" ); + jobj =json_object_new_string ("devdax" );break ;case NDCTL_NS_MODE_SAFE :if (!btt)
Signature · 6 lines
2.14.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Verma, Vishal L
maintainerQuoted 22 lines · Ross Zwisler
Add on to the work started by:
commit
ebb4fb605e68("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")and change some more user visible places to use "fsdax" and "devdax" modes
instead of "memory" and "dax", respectively. Having multiple terms for the
same mode is confusing for users.We will continue to accept "memory" and "dax" as parameters, but all output
and man pages will now use the updated terms.Note that after the above referenced commit we still printed the old names
in the default 'ndctl list' output for backward compatibility with scripts.
This patch intentionally breaks that backward compatibility in favor of avoiding confusion and using the new mode names everywhere.
Quoted 7 lines
Signed-off-by Ross Zwisler <[email protected]>--- Documentation/ndctl/ndctl-inject-error.txt | 2 +- Documentation/ndctl/ndctl-list.txt | 6 +++--- ndctl/namespace.c | 16 ++++++++-------- util/json.c | 10 ++-------- 4 files changed, 14 insertions(+), 20 deletions(-)
This also needs unit test updates to create.sh and clear.sh as they look for 'memory'
Quoted 167 lines
Documentation/ndctl/ndctl-inject-error.txt +0
-0@@ -45,7 +45,7 @@ OPTIONS NOTE: The offset is interpreted in different ways based on the"mode"
of the namespace. For "raw" mode, the offset is the base
namespaceDocumentation/ndctl/ndctl-inject-error.txt +0
-1- offset. For "memory" mode (i.e. a "pfn" namespace), the offsetis
Documentation/ndctl/ndctl-inject-error.txt +1
-0+ offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is relative to the user-visible part of the namespace, and theoffset
Documentation/ndctl/ndctl-inject-error.txt +0
-0introduced by the kernel's metadata will be accounted for. For a "sector" mode namespace (i.e. a "BTT" namespace), the offset isDocumentation/ndctl/ndctl-list.txt +3
-3@@ -49,7 +49,7 @@ EXAMPLE "namespaces":[ { "dev":"namespace0.0", - "mode":"memory", + "mode":"fsdax", "size":8589934592, "blockdev":"pmem0" }@@ -132,11 +132,11 @@ include::xable-region-options.txt[] -X:: --device-dax:: Include device-dax ("daxregion") details when a namespace is in - "dax" mode. + "devdax" mode. [verse] { "dev":"namespace0.0", - "mode":"dax", + "mode":"devdax", "size":4225761280, "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc", "daxregion":{ndctl/namespace.c +1
-1@@ -103,7 +103,7 @@ OPT_STRING('n', "name", ¶m.name, "name", \OPT_STRING ('s' ,"size" , ¶m.size,"size" , \ "specify the namespace size in bytes (default: available capacity)"), \OPT_STRING('m', " mode", ¶m.mode, " operation-mode", \ - "specify a mode for the namespace, 'sector', 'memory', or 'raw'"), \ + "specify a mode for the namespace, 'sector', 'fsdax', 'devdax' or 'raw'"), \OPT_STRING('M', "map", ¶m.map, "memmap-location", \
ndctl/namespace.c +1
-1"specify 'mem' or 'dev' for the location of the memmap"), \ OPT_STRING('l', "sector-size", ¶m.sector_size, "lba-size", \@@ -533,7 +533,7 @@ static int validate_namespace_options(structndctl_region *region, * supported a 2M default alignment when * ndctl_pfn_has_align() returns false. */ -debug ("%s not support 'align' for memory mode\n", + debug("%s not support 'align' for fsdax mode\n", region_name);ndctl/namespace.c +1
-1return -EAGAIN ; } else if (p->mode == NDCTL_NS_MODE_DAX@@ -542,7 +542,7 @@ static int validate_namespace_options(structndctl_region *region, * Unlike the pfn case, we require the kernel to * have 'align' support for device-dax. */ -debug ("%s not support 'align' for dax mode\n" , +debug ("%s not support 'align' for devdax mode\n", region_name);ndctl/namespace.c +1
-1return -EAGAIN ; } else if (!param.align_default@@ -696,7 +696,7 @@ static int validate_namespace_options(struct ndctl_region *region, if (ndns && p->mode != NDCTL_NS_MODE_MEMORY && p->mode != NDCTL_NS_MODE_DAX) { - debug("%s: --map= only valid for memory mode namespace\n", + debug("%s: --map= only valid for fsdax mode namespace\n",ndctl/namespace.c +1
-2ndctl_namespace_get_devname(ndns));return -EINVAL ; }@@ -709,10 +709,10 @@ static int validate_namespace_options(structndctl_region *region, struct ndctl_pfn *pfn =ndctl_region_get_pfn_seed (region);if (!pfn && param.mode_default) { -debug ("%s memory mode not available\n" , region_name); +debug ("%s fsdax mode not available\n" , region_name); p->mode =NDCTL_NS_MODE_RAW ; }else if (!pfn) { - error("operation failed, %s memory mode notavailable\n",
ndctl/namespace.c +1
-0+ error("operation failed, %s fsdax mode notavailable\n",
ndctl/namespace.c +1
-1region_name);return -EINVAL ; }@@ -723,7 +723,7 @@ static int validate_namespace_options(structndctl_region *region, struct ndctl_dax *dax =ndctl_region_get_dax_seed (region);if (!dax) { - error("operation failed, %s dax mode not available\n", + error("operation failed, %s devdax mode notavailable\n",
ndctl/namespace.c +1
-1region_name);return -EINVAL ; }@@ -759,7 +759,7 @@ static int namespace_create(struct ndctl_region *region)return rc;if (ndctl_region_get_ro (region)) { - debug("%s: read-only, inelligible for namespace creation\n", + debug("%s: read-only, ineligible for namespace creation\n",ndctl/namespace.c +0
-0devname);return -EAGAIN ; }util/json.c +2
-8@@ -685,19 +685,13 @@ struct json_object *util_namespace_to_json(structndctl_namespace *ndns, size =ndctl_pfn_get_size (pfn); else /* native/static memory mode */ size =ndctl_namespace_get_size (ndns); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("fsdax" ); -else - jobj =json_object_new_string ("memory" ); + jobj =json_object_new_string ("fsdax" );break ;case NDCTL_NS_MODE_DAX :if (!dax) goto err; size =ndctl_dax_get_size (dax); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("devdax" ); -else - jobj =json_object_new_string ("dax" ); + jobj =json_object_new_string ("devdax" );break ;case NDCTL_NS_MODE_SAFE :
Quoted 1 line
if (!btt)
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 1/1 ndctl: complete move to "fsdax" and "devdax"
Add on to the work started by:
commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")
and change some more user visible places to use "fsdax" and "devdax" modes instead of "memory" and "dax", respectively. Having multiple terms for the same mode is confusing for users.
We will continue to accept "memory" and "dax" as parameters, but all output and man pages will now use the updated terms.
Note that after the above referenced commit we still printed the old names in the default 'ndctl list' output for backward compatibility with scripts. This patch intentionally breaks that backward compatibility in favor of avoiding confusion and using the new mode names everywhere.
---
Changes since v2:
- Update files in the 'test' directory as well. (Vishal)
I've executed all the ndctl unit tests in an nfit_test setup and made sure everything still passes.
--- Documentation/ndctl/ndctl-inject-error.txt | 2 +- Documentation/ndctl/ndctl-list.txt | 6 +++--- ndctl/namespace.c | 16 ++++++++-------- test/btt-pad-compat.sh | 2 +- test/clear.sh | 6 +++--- test/create.sh | 6 +++--- test/dax.sh | 12 ++++++------ test/daxdev-errors.sh | 8 ++++---- test/device-dax-fio.sh | 6 +++--- test/device-dax.c | 10 +++++----- test/inject-error.sh | 2 +- test/libndctl.c | 2 +- test/multi-dax.sh | 8 ++++---- test/rescan-partitions.sh | 2 +- util/json.c | 10 ++-------- 15 files changed, 46 insertions(+), 52 deletions(-)
Documentation/ndctl/ndctl-inject-error.txt +1 -1
@@ -45,7 +45,7 @@ OPTIONS NOTE: The offset is interpreted in different ways based on the "mode" of the namespace. For "raw" mode, the offset is the base namespace - offset. For "memory" mode (i.e. a "pfn" namespace), the offset is + offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is relative to the user-visible part of the namespace, and the offset introduced by the kernel's metadata will be accounted for. For a "sector" mode namespace (i.e. a "BTT" namespace), the offset is
Documentation/ndctl/ndctl-list.txt +3 -3
@@ -49,7 +49,7 @@ EXAMPLE "namespaces":[ { "dev":"namespace0.0", - "mode":"memory", + "mode":"fsdax", "size":8589934592, "blockdev":"pmem0" }
@@ -132,11 +132,11 @@ include::xable-region-options.txt[] -X:: --device-dax:: Include device-dax ("daxregion") details when a namespace is in - "dax" mode. + "devdax" mode. [verse] { "dev":"namespace0.0", - "mode":"dax", + "mode":"devdax", "size":4225761280, "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc", "daxregion":{
ndctl/namespace.c +8 -8
@@ -103,7 +103,7 @@ OPT_STRING('n', "name", ¶m.name, "name", \OPT_STRING ('s' ,"size" , ¶m.size,"size" , \"specify the namespace size in bytes (default: available capacity)" ), \OPT_STRING ('m' ,"mode" , ¶m.mode,"operation-mode" , \ -"specify a mode for the namespace, 'sector', 'memory', or 'raw'" ), \ +"specify a mode for the namespace, 'sector', 'fsdax', 'devdax' or 'raw'" ), \OPT_STRING ('M' ,"map" , ¶m.map,"memmap-location" , \"specify 'mem' or 'dev' for the location of the memmap" ), \ OPT_STRING('l', "sector-size", ¶m.sector_size, "lba-size", \
@@ -533,7 +533,7 @@ static int validate_namespace_options(struct ndctl_region *region,* supported a 2M default alignment when * ndctl_pfn_has_align() returns false. */ -debug ("%s not support 'align' for memory mode\n" , +debug ("%s not support 'align' for fsdax mode\n" , region_name);return -EAGAIN ; } else if (p->mode == NDCTL_NS_MODE_DAX
@@ -542,7 +542,7 @@ static int validate_namespace_options(struct ndctl_region *region,* Unlike the pfn case, we require the kernel to * have 'align' support for device-dax. */ -debug ("%s not support 'align' for dax mode\n" , +debug ("%s not support 'align' for devdax mode\n" , region_name);return -EAGAIN ; } else if (!param.align_default
@@ -696,7 +696,7 @@ static int validate_namespace_options(struct ndctl_region *region,if (ndns && p->mode !=NDCTL_NS_MODE_MEMORY && p->mode !=NDCTL_NS_MODE_DAX ) { -debug ("%s: --map= only valid for memory mode namespace\n" , +debug ("%s: --map= only valid for fsdax mode namespace\n" ,ndctl_namespace_get_devname (ndns));return -EINVAL ; }
@@ -709,10 +709,10 @@ static int validate_namespace_options(struct ndctl_region *region,struct ndctl_pfn *pfn =ndctl_region_get_pfn_seed (region);if (!pfn && param.mode_default) { -debug ("%s memory mode not available\n" , region_name); +debug ("%s fsdax mode not available\n" , region_name); p->mode =NDCTL_NS_MODE_RAW ; }else if (!pfn) { -error ("operation failed, %s memory mode not available\n" , +error ("operation failed, %s fsdax mode not available\n" , region_name);return -EINVAL ; }
@@ -723,7 +723,7 @@ static int validate_namespace_options(struct ndctl_region *region,struct ndctl_dax *dax =ndctl_region_get_dax_seed (region);if (!dax) { -error ("operation failed, %s dax mode not available\n" , +error ("operation failed, %s devdax mode not available\n" , region_name);return -EINVAL ; }
@@ -759,7 +759,7 @@ static int namespace_create(struct ndctl_region *region)return rc;if (ndctl_region_get_ro (region)) { -debug ("%s: read-only, inelligible for namespace creation\n" , +debug ("%s: read-only, ineligible for namespace creation\n" , devname);return -EAGAIN ; }
test/btt-pad-compat.sh +1 -1
@@ -26,7 +26,7 @@ trap 'err $LINENO' ERR # sample json: #{ # "dev":"namespace7.0", -# "mode":"memory", +# "mode":"fsdax", # "size":"60.00 MiB (62.92 MB)", # "uuid":"f1baa71a-d165-4da4-bb6a-083a2b0e6469", # "blockdev":"pmem7",
test/clear.sh +3 -3
@@ -69,10 +69,10 @@ fi size_raw=$size sector_raw=$sector -# convert pmem to memory mode -json=$($NDCTL create-namespace -m memory -f -e $dev) +# convert pmem to fsdax mode +json=$($NDCTL create-namespace -m fsdax -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 # check for errors relative to the offset injected by the pfn device read sector len < /sys/block/$blockdev/badblocks
test/create.sh +3 -3
@@ -54,10 +54,10 @@ eval $(echo $json | sed -e "$json2var") [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 -# convert pmem to memory mode -json=$($NDCTL create-namespace -m memory -f -e $dev) +# convert pmem to fsdax mode +json=$($NDCTL create-namespace -m fsdax -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 # convert pmem to sector mode json=$($NDCTL create-namespace -m sector -l $SECTOR_SIZE -f -e $dev)
test/dax.sh +6 -6
@@ -44,9 +44,9 @@ fallocate -l 1GiB $MNT/$FILE umount $MNT # convert pmem to put the memmap on the device -json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 #note the blockdev returned from ndctl create-namespace lacks the /dev prefix mkfs.ext4 /dev/$blockdev
@@ -57,7 +57,7 @@ umount $MNT json=$($NDCTL create-namespace -m raw -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 mkfs.xfs -f /dev/$blockdev mount /dev/$blockdev $MNT -o dax
@@ -66,9 +66,9 @@ fallocate -l 1GiB $MNT/$FILE umount $MNT # convert pmem to put the memmap on the device -json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 mkfs.xfs -f /dev/$blockdev mount /dev/$blockdev $MNT -o dax
@@ -79,6 +79,6 @@ umount $MNT # revert namespace to raw mode json=$($NDCTL create-namespace -m raw -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 exit 0
test/daxdev-errors.sh +4 -4
@@ -49,12 +49,12 @@ rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096) -chardev=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096) +chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") #{ # "dev":"namespace6.0", -# "mode":"dax", +# "mode":"devdax", # "size":64004096, # "uuid":"83a925dd-42b5-4ac6-8588-6a50bfc0c001", # "daxregion":{
@@ -70,7 +70,7 @@ chardev=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0]. # } #} -json1=$($NDCTL list $BUS --mode=dax --namespaces) +json1=$($NDCTL list $BUS --mode=devdax --namespaces) eval $(echo $json1 | sed -e "$json2var") nsdev=$dev
test/device-dax-fio.sh +3 -3
@@ -43,8 +43,8 @@ fi dev=$(./dax-dev) for align in 4k 2m 1g do - json=$($NDCTL create-namespace -m dax -a $align -f -e $dev) - chardev=$(echo $json | jq -r ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") + json=$($NDCTL create-namespace -m devdax -a $align -f -e $dev) + chardev=$(echo $json | jq -r ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") if [ align = "1g" ]; then bs="1g" else
@@ -80,7 +80,7 @@ do # revert namespace to raw mode json=$($NDCTL create-namespace -m raw -f -e $dev) mode=$(echo $json | jq -r ".mode") - [ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 done exit 0
test/device-dax.c +5 -5
@@ -58,7 +58,7 @@ static int setup_device_dax(struct ndctl_namespace *ndns, unsigned long __align)struct ndctl_ctx *ctx =ndctl_namespace_get_ctx (ndns);char align[32 ];const char *argv[] = { -"__func__" ,"-v" ,"-m" ,"dax" ,"-M" ,"dev" ,"-f" ,"-a" , align, +"__func__" ,"-v" ,"-m" ,"devdax" ,"-M" ,"dev" ,"-f" ,"-a" , align,"-e" ,"" , };int argc =ARRAY_SIZE (argv);
@@ -68,13 +68,13 @@ static int setup_device_dax(struct ndctl_namespace *ndns, unsigned long __align)return create_namespace (argc, argv, ctx); } -static int setup_pmem_memory_mode (struct ndctl_namespace *ndns, +static int setup_pmem_fsdax_mode (struct ndctl_namespace *ndns,unsigned long __align) {struct ndctl_ctx *ctx =ndctl_namespace_get_ctx (ndns);char align[32 ];const char *argv[] = { -"__func__" ,"-v" ,"-m" ,"memory" ,"-M" ,"dev" ,"-f" ,"-a" , +"__func__" ,"-v" ,"-m" ,"fsdax" ,"-M" ,"dev" ,"-f" ,"-a" , align,"-e" ,"" , };int argc =ARRAY_SIZE (argv);
@@ -175,8 +175,8 @@ static int __test_device_dax(unsigned long align, int loglevel,if (!ndctl_test_attempt (test,KERNEL_VERSION (4 ,7 ,0 )))return 77 ; -/* setup up memory mode pmem device and seed with verification data */ - rc =setup_pmem_memory_mode (ndns, align); +/* setup up fsdax mode pmem device and seed with verification data */ + rc =setup_pmem_fsdax_mode (ndns, align);if (rc <0 || !(pfn =ndctl_namespace_get_pfn (ndns))) {fprintf (stderr,"%s: failed device-dax setup\n" ,ndctl_namespace_get_devname (ndns));
test/inject-error.sh +1 -1
@@ -28,7 +28,7 @@ trap 'err $LINENO' ERR # sample json: #{ # "dev":"namespace7.0", -# "mode":"memory", +# "mode":"fsdax", # "size":"60.00 MiB (62.92 MB)", # "uuid":"f1baa71a-d165-4da4-bb6a-083a2b0e6469", # "blockdev":"pmem7",
test/libndctl.c +1 -1
@@ -878,7 +878,7 @@ static int __check_pfn_create(struct ndctl_region *region, mode =ndctl_namespace_get_mode (ndns);if (mode >=0 && mode !=NDCTL_NS_MODE_MEMORY ) -fprintf (stderr,"%s: expected memory mode got: %d\n" , +fprintf (stderr,"%s: expected fsdax mode got: %d\n" , devname, mode);if (namespace->ro == (rc ==0 )) {
test/multi-dax.sh +4 -4
@@ -48,10 +48,10 @@ rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) -chardev1=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) -chardev2=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096 -s 16M) +chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096 -s 16M) +chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") # cleanup $NDCTL disable-region $BUS all
test/rescan-partitions.sh +1 -1
@@ -100,7 +100,7 @@ test_mode() rc=1 reset test_mode "raw" -test_mode "memory" +test_mode "fsdax" test_mode "sector" exit 0
util/json.c +2 -8
@@ -685,19 +685,13 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns, size =ndctl_pfn_get_size (pfn); else /* native/static memory mode */ size =ndctl_namespace_get_size (ndns); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("fsdax" ); -else - jobj =json_object_new_string ("memory" ); + jobj =json_object_new_string ("fsdax" );break ;case NDCTL_NS_MODE_DAX :if (!dax) goto err; size =ndctl_dax_get_size (dax); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("devdax" ); -else - jobj =json_object_new_string ("dax" ); + jobj =json_object_new_string ("devdax" );break ;case NDCTL_NS_MODE_SAFE :if (!btt)
Signature · 6 lines
2.14.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 11 lines · Ross Zwisler
Add on to the work started by:
commit
ebb4fb605e68("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")and change some more user visible places to use "fsdax" and "devdax" modes instead of "memory" and "dax", respectively. Having multiple terms for the same mode is confusing for users.
We will continue to accept "memory" and "dax" as parameters, but all output and man pages will now use the updated terms.
Quoted 6 lines
Note that after the above referenced commit we still printed the old names in the default 'ndctl list' output for backward compatibility with scripts. This patch intentionally breaks that backward compatibility in favor of avoiding confusion and using the new mode names everywhere.
Signed-off-by Ross Zwisler <[email protected]>
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Verma, Vishal L
maintainerQuoted 22 lines · Ross Zwisler
Add on to the work started by:
commit
ebb4fb605e68("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")and change some more user visible places to use "fsdax" and "devdax" modes
instead of "memory" and "dax", respectively. Having multiple terms for the
same mode is confusing for users.We will continue to accept "memory" and "dax" as parameters, but all output
and man pages will now use the updated terms.Note that after the above referenced commit we still printed the old names
in the default 'ndctl list' output for backward compatibility with scripts.
This patch intentionally breaks that backward compatibility in favor of avoiding confusion and using the new mode names everywhere.
Quoted 9 lines
Signed-off-by Ross Zwisler <[email protected]>---
Changes since v2:
- Update files in the 'test' directory as well. (Vishal)I've executed all the ndctl unit tests in an
nfit_testsetup and made sure everything still passes.
Thanks for the update; Applied.
Quoted 454 lines
--- Documentation/ndctl/ndctl-inject-error.txt | 2 +- Documentation/ndctl/ndctl-list.txt | 6 +++--- ndctl/namespace.c | 16 ++++++++-------- test/btt-pad-compat.sh | 2 +- test/clear.sh | 6 +++--- test/create.sh | 6 +++--- test/dax.sh | 12 ++++++------ test/daxdev-errors.sh | 8 ++++---- test/device-dax-fio.sh | 6 +++--- test/device-dax.c | 10 +++++----- test/inject-error.sh | 2 +- test/libndctl.c | 2 +- test/multi-dax.sh | 8 ++++---- test/rescan-partitions.sh | 2 +- util/json.c | 10 ++-------- 15 files changed, 46 insertions(+), 52 deletions(-)Documentation/ndctl/ndctl-inject-error.txt +0
-0@@ -45,7 +45,7 @@ OPTIONS NOTE: The offset is interpreted in different ways based on the"mode"
of the namespace. For "raw" mode, the offset is the base
namespaceDocumentation/ndctl/ndctl-inject-error.txt +0
-1- offset. For "memory" mode (i.e. a "pfn" namespace), the offsetis
Documentation/ndctl/ndctl-inject-error.txt +1
-0+ offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is relative to the user-visible part of the namespace, and theoffset
Documentation/ndctl/ndctl-inject-error.txt +0
-0introduced by the kernel's metadata will be accounted for. For a "sector" mode namespace (i.e. a "BTT" namespace), the offset isDocumentation/ndctl/ndctl-list.txt +3
-3@@ -49,7 +49,7 @@ EXAMPLE "namespaces":[ { "dev":"namespace0.0", - "mode":"memory", + "mode":"fsdax", "size":8589934592, "blockdev":"pmem0" }@@ -132,11 +132,11 @@ include::xable-region-options.txt[] -X:: --device-dax:: Include device-dax ("daxregion") details when a namespace is in - "dax" mode. + "devdax" mode. [verse] { "dev":"namespace0.0", - "mode":"dax", + "mode":"devdax", "size":4225761280, "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc", "daxregion":{ndctl/namespace.c +1
-1@@ -103,7 +103,7 @@ OPT_STRING('n', "name", ¶m.name, "name", \OPT_STRING ('s' ,"size" , ¶m.size,"size" , \ "specify the namespace size in bytes (default: available capacity)"), \OPT_STRING('m', " mode", ¶m.mode, " operation-mode", \ - "specify a mode for the namespace, 'sector', 'memory', or 'raw'"), \ + "specify a mode for the namespace, 'sector', 'fsdax', 'devdax' or 'raw'"), \OPT_STRING('M', "map", ¶m.map, "memmap-location", \
ndctl/namespace.c +1
-1"specify 'mem' or 'dev' for the location of the memmap"), \ OPT_STRING('l', "sector-size", ¶m.sector_size, "lba-size", \@@ -533,7 +533,7 @@ static int validate_namespace_options(structndctl_region *region, * supported a 2M default alignment when * ndctl_pfn_has_align() returns false. */ -debug ("%s not support 'align' for memory mode\n", + debug("%s not support 'align' for fsdax mode\n", region_name);ndctl/namespace.c +1
-1return -EAGAIN ; } else if (p->mode == NDCTL_NS_MODE_DAX@@ -542,7 +542,7 @@ static int validate_namespace_options(structndctl_region *region, * Unlike the pfn case, we require the kernel to * have 'align' support for device-dax. */ -debug ("%s not support 'align' for dax mode\n" , +debug ("%s not support 'align' for devdax mode\n", region_name);ndctl/namespace.c +1
-1return -EAGAIN ; } else if (!param.align_default@@ -696,7 +696,7 @@ static int validate_namespace_options(struct ndctl_region *region, if (ndns && p->mode != NDCTL_NS_MODE_MEMORY && p->mode != NDCTL_NS_MODE_DAX) { - debug("%s: --map= only valid for memory mode namespace\n", + debug("%s: --map= only valid for fsdax mode namespace\n",ndctl/namespace.c +1
-2ndctl_namespace_get_devname(ndns));return -EINVAL ; }@@ -709,10 +709,10 @@ static int validate_namespace_options(structndctl_region *region, struct ndctl_pfn *pfn =ndctl_region_get_pfn_seed (region);if (!pfn && param.mode_default) { -debug ("%s memory mode not available\n" , region_name); +debug ("%s fsdax mode not available\n" , region_name); p->mode =NDCTL_NS_MODE_RAW ; }else if (!pfn) { - error("operation failed, %s memory mode notavailable\n",
ndctl/namespace.c +1
-0+ error("operation failed, %s fsdax mode notavailable\n",
ndctl/namespace.c +1
-1region_name);return -EINVAL ; }@@ -723,7 +723,7 @@ static int validate_namespace_options(structndctl_region *region, struct ndctl_dax *dax =ndctl_region_get_dax_seed (region);if (!dax) { - error("operation failed, %s dax mode not available\n", + error("operation failed, %s devdax mode notavailable\n",
ndctl/namespace.c +1
-1region_name);return -EINVAL ; }@@ -759,7 +759,7 @@ static int namespace_create(struct ndctl_region *region)return rc;if (ndctl_region_get_ro (region)) { - debug("%s: read-only, inelligible for namespace creation\n", + debug("%s: read-only, ineligible for namespace creation\n",ndctl/namespace.c +0
-0devname);return -EAGAIN ; }test/btt-pad-compat.sh +1
-1@@ -26,7 +26,7 @@ trap 'err $LINENO' ERR # sample json: #{ # "dev":"namespace7.0", -# "mode":"memory", +# "mode":"fsdax", # "size":"60.00 MiB (62.92 MB)", # "uuid":"f1baa71a-d165-4da4-bb6a-083a2b0e6469", # "blockdev":"pmem7",test/clear.sh +3
-3@@ -69,10 +69,10 @@ fi size_raw=$size sector_raw=$sector -# convert pmem to memory mode -json=$($NDCTL create-namespace -m memory -f -e $dev) +# convert pmem to fsdax mode +json=$($NDCTL create-namespace -m fsdax -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 # check for errors relative to the offset injected by the pfn device read sector len < /sys/block/$blockdev/badblockstest/create.sh +3
-3@@ -54,10 +54,10 @@ eval $(echo $json | sed -e "$json2var") [ $dev = "x" ] && echo "fail: $LINENO" && exit 1 [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 -# convert pmem to memory mode -json=$($NDCTL create-namespace -m memory -f -e $dev) +# convert pmem to fsdax mode +json=$($NDCTL create-namespace -m fsdax -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 # convert pmem to sector mode json=$($NDCTL create-namespace -m sector -l $SECTOR_SIZE -f -e $dev)test/dax.sh +2
-2@@ -44,9 +44,9 @@ fallocate -l 1GiB $MNT/$FILE umount $MNT # convert pmem to put the memmap on the device -json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 #note the blockdev returned from ndctl create-namespace lacks the /devprefix
mkfs.ext4/dev/$blockdevtest/dax.sh +4
-4@@ -57,7 +57,7 @@ umount $MNT json=$($NDCTL create-namespace -m raw -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 mkfs.xfs -f /dev/$blockdev mount /dev/$blockdev $MNT -o dax@@ -66,9 +66,9 @@ fallocate -l 1GiB $MNT/$FILE umount $MNT # convert pmem to put the memmap on the device -json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 mkfs.xfs -f /dev/$blockdev mount /dev/$blockdev $MNT -o dax@@ -79,6 +79,6 @@ umount $MNT # revert namespace to raw mode json=$($NDCTL create-namespace -m raw -f -e $dev) eval $(echo $json | sed -e "$json2var") -[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 exit 0test/daxdev-errors.sh +3
-3@@ -49,12 +49,12 @@ rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096) -chardev=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096) +chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") #{ # "dev":"namespace6.0", -# "mode":"dax", +# "mode":"devdax",# "size":64004096, # "uuid":"83a925dd-42b5-4ac6-8588-6a50bfc0c001", # "daxregion":{test/daxdev-errors.sh +0
-0@@ -70,7 +70,7 @@ chardev=$(echo $json | jq ". | select(.mode == \"dax\")| .daxregion.devices[0].
# }
#}test/daxdev-errors.sh +1
-1-json1=$($NDCTL list $BUS --mode=dax --namespaces) +json1=$($NDCTL list $BUS --mode=devdax --namespaces) eval $(echo $json1 | sed -e "$json2var") nsdev=$devtest/device-dax-fio.sh +2
-2@@ -43,8 +43,8 @@ fi dev=$(./dax-dev) for align in 4k 2m 1g do - json=$($NDCTL create-namespace -m dax -a $align -f -e $dev) - chardev=$(echo $json | jq -r ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") + json=$($NDCTL create-namespace -m devdax -a $align -f -e $dev) + chardev=$(echo $json | jq -r ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") if [ align = "1g" ]; thentest/device-dax-fio.sh +1
-1bs="1g" else@@ -80,7 +80,7 @@ do # revert namespace to raw mode json=$($NDCTL create-namespace -m raw -f -e $dev) mode=$(echo $json | jq -r ".mode") - [ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 done exit 0test/device-dax.c +1
-1@@ -58,7 +58,7 @@ static int setup_device_dax(struct ndctl_namespace *ndns, unsigned long __align)struct ndctl_ctx *ctx =ndctl_namespace_get_ctx (ndns);char align[32 ];const char *argv[] = { -"__func__" ,"-v" ,"-m" ,"dax" ,"-M" ,"dev" ,"-f" ,"-a" , align, +"__func__" ,"-v" ,"-m" ,"devdax" ,"-M" ,"dev" ,"-f" ,"- a", align,test/device-dax.c +2
-2"-e", "", };int argc =ARRAY_SIZE (argv);@@ -68,13 +68,13 @@ static int setup_device_dax(struct ndctl_namespace *ndns, unsigned long __align)return create_namespace (argc, argv, ctx); } -static int setup_pmem_memory_mode(struct ndctl_namespace *ndns, +static int setup_pmem_fsdax_mode(struct ndctl_namespace *ndns, unsigned long __align) { struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns); char align[32]; const char *argv[] = { - "__func__", "-v", "-m", "memory", "-M", "dev", "-f", "- a", + "__func__", "-v", "-m", "fsdax", "-M", "dev", "-f", "- a",test/device-dax.c +0
-1align, "-e", "", };int argc =ARRAY_SIZE (argv);@@ -175,8 +175,8 @@ static int __test_device_dax(unsigned long align, int loglevel, if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 7, 0)))return 77 ; -/* setup up memory mode pmem device and seed with verification data */
test/device-dax.c +1
-1- rc =setup_pmem_memory_mode (ndns, align); +/* setup up fsdax mode pmem device and seed with verification data */
test/device-dax.c +1
-0+ rc =setup_pmem_fsdax_mode (ndns, align);if (rc <0 || !(pfn =ndctl_namespace_get_pfn (ndns))) {fprintf (stderr,"%s: failed device-dax setup\n" ,ndctl_namespace_get_devname (ndns));test/inject-error.sh +1
-1@@ -28,7 +28,7 @@ trap 'err $LINENO' ERR # sample json: #{ # "dev":"namespace7.0", -# "mode":"memory", +# "mode":"fsdax", # "size":"60.00 MiB (62.92 MB)", # "uuid":"f1baa71a-d165-4da4-bb6a-083a2b0e6469", # "blockdev":"pmem7",test/libndctl.c +1
-1@@ -878,7 +878,7 @@ static int __check_pfn_create(struct ndctl_region *region, mode =ndctl_namespace_get_mode (ndns);if (mode >=0 && mode !=NDCTL_NS_MODE_MEMORY ) -fprintf (stderr,"%s: expected memory mode got: %d\n" , +fprintf (stderr,"%s: expected fsdax mode got: %d\n" , devname, mode);test/libndctl.c +0
-0if (namespace->ro == (rc ==0 )) {test/multi-dax.sh +0
-4@@ -48,10 +48,10 @@ rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) -chardev1=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") -json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) -chardev2=$(echo $json | jq ". | select(.mode == \"dax\") |.daxregion.devices[0].chardev")
test/multi-dax.sh +2
-1+json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096 -s 16M) +chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") |.daxregion.devices[0].chardev")
test/multi-dax.sh +2
-1+json=$($NDCTL create-namespace $BUS -r $region -t pmem -m devdax -a 4096 -s 16M) +chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") |.daxregion.devices[0].chardev")
# cleanup $NDCTL disable-region $BUS alltest/rescan-partitions.sh +1
-1@@ -100,7 +100,7 @@ test_mode() rc=1 reset test_mode "raw" -test_mode "memory" +test_mode "fsdax" test_mode "sector" exit 0util/json.c +2
-8@@ -685,19 +685,13 @@ struct json_object *util_namespace_to_json(structndctl_namespace *ndns, size =ndctl_pfn_get_size (pfn); else /* native/static memory mode */ size =ndctl_namespace_get_size (ndns); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("fsdax" ); -else - jobj =json_object_new_string ("memory" ); + jobj =json_object_new_string ("fsdax" );break ;case NDCTL_NS_MODE_DAX :if (!dax) goto err; size =ndctl_dax_get_size (dax); -if (flags &UTIL_JSON_HUMAN ) - jobj =json_object_new_string ("devdax" ); -else - jobj =json_object_new_string ("dax" ); + jobj =json_object_new_string ("devdax" );break ;case NDCTL_NS_MODE_SAFE :
Quoted 1 line
if (!btt)
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm