From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH v2 19/26] ndctl/namespace: Kill off the legacy mode names
Date: Sat, 27 Jul 2019 14:41:03 -0700 [thread overview]
Message-ID: <156426366309.531577.11554918086632763562.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <156426356088.531577.14828880045306313118.stgit@dwillia2-desk3.amr.corp.intel.com>
The command line interface switched to "fsdax", "devdax", and "sector"
for the mode names. Kill off the remaining instances of "memory", "dax",
and "safe".
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
ndctl/lib/libndctl.c | 4 ++-
ndctl/libndctl.h | 1 +
ndctl/namespace.c | 66 +++++++++++++++++++++++++-------------------------
test/libndctl.c | 6 ++---
util/filter.c | 4 ++-
util/json.c | 4 ++-
6 files changed, 43 insertions(+), 42 deletions(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index c1ecdd8c9c61..e81d64dc8aa8 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -3405,7 +3405,7 @@ static const char *enforce_id_to_name(enum ndctl_namespace_mode mode)
{
static const char *id_to_name[] = {
[NDCTL_NS_MODE_MEMORY] = "pfn",
- [NDCTL_NS_MODE_SAFE] = "btt", /* TODO: convert to btt2 */
+ [NDCTL_NS_MODE_SECTOR] = "btt", /* TODO: convert to btt2 */
[NDCTL_NS_MODE_RAW] = "",
[NDCTL_NS_MODE_DAX] = "dax",
[NDCTL_NS_MODE_UNKNOWN] = "<unknown>",
@@ -3728,7 +3728,7 @@ NDCTL_EXPORT enum ndctl_namespace_mode ndctl_namespace_get_mode(
if (strcmp("raw", buf) == 0)
return NDCTL_NS_MODE_RAW;
if (strcmp("safe", buf) == 0)
- return NDCTL_NS_MODE_SAFE;
+ return NDCTL_NS_MODE_SECTOR;
return -ENXIO;
}
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index c9d0dc120d3b..f3f2ef66c5a8 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -472,6 +472,7 @@ enum ndctl_namespace_mode {
NDCTL_NS_MODE_MEMORY,
NDCTL_NS_MODE_FSDAX = NDCTL_NS_MODE_MEMORY,
NDCTL_NS_MODE_SAFE,
+ NDCTL_NS_MODE_SECTOR = NDCTL_NS_MODE_SAFE,
NDCTL_NS_MODE_RAW,
NDCTL_NS_MODE_DAX,
NDCTL_NS_MODE_DEVDAX = NDCTL_NS_MODE_DAX,
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index e5a2b1341cdb..f958726a994d 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -225,9 +225,9 @@ static int set_defaults(enum device_action mode)
}
} else if (!param.reconfig && param.type) {
if (strcmp(param.type, "pmem") == 0)
- param.mode = "memory";
+ param.mode = "fsdax";
else
- param.mode = "safe";
+ param.mode = "sector";
param.mode_default = true;
}
@@ -242,9 +242,9 @@ static int set_defaults(enum device_action mode)
}
if (!param.reconfig && param.mode
- && strcmp(param.mode, "memory") != 0
- && strcmp(param.mode, "dax") != 0) {
- error("--map only valid for an dax mode pmem namespace\n");
+ && strcmp(param.mode, "fsdax") != 0
+ && strcmp(param.mode, "devdax") != 0) {
+ error("--map only valid for an devdax mode pmem namespace\n");
rc = -EINVAL;
}
} else if (!param.reconfig)
@@ -252,8 +252,8 @@ static int set_defaults(enum device_action mode)
/* check for incompatible mode and type combinations */
if (param.type && param.mode && strcmp(param.type, "blk") == 0
- && (strcmp(param.mode, "memory") == 0
- || strcmp(param.mode, "dax") == 0)) {
+ && (strcmp(param.mode, "fsdax") == 0
+ || strcmp(param.mode, "devdax") == 0)) {
error("only 'pmem' namespaces support dax operation\n");
rc = -ENXIO;
}
@@ -377,7 +377,7 @@ do { \
static bool do_setup_pfn(struct ndctl_namespace *ndns,
struct parsed_parameters *p)
{
- if (p->mode != NDCTL_NS_MODE_MEMORY)
+ if (p->mode != NDCTL_NS_MODE_FSDAX)
return false;
/*
@@ -385,7 +385,7 @@ static bool do_setup_pfn(struct ndctl_namespace *ndns,
* instance, and a pfn device is required to place the memmap
* array in device memory.
*/
- if (!ndns || ndctl_namespace_get_mode(ndns) != NDCTL_NS_MODE_MEMORY
+ if (!ndns || ndctl_namespace_get_mode(ndns) != NDCTL_NS_MODE_FSDAX
|| p->loc == NDCTL_PFN_LOC_PMEM)
return true;
@@ -419,7 +419,7 @@ static int setup_namespace(struct ndctl_region *region,
if (i < num)
try(ndctl_namespace, set_sector_size, ndns,
p->sector_size);
- else if (p->mode == NDCTL_NS_MODE_SAFE)
+ else if (p->mode == NDCTL_NS_MODE_SECTOR)
/* pass, the btt sector_size will override */;
else if (p->sector_size != 512) {
error("%s: sector_size: %ld not supported\n",
@@ -450,7 +450,7 @@ static int setup_namespace(struct ndctl_region *region,
rc = ndctl_pfn_enable(pfn);
if (rc && p->autorecover)
ndctl_pfn_set_namespace(pfn, NULL);
- } else if (p->mode == NDCTL_NS_MODE_DAX) {
+ } else if (p->mode == NDCTL_NS_MODE_DEVDAX) {
struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
try(ndctl_dax, set_uuid, dax, uuid);
@@ -461,7 +461,7 @@ static int setup_namespace(struct ndctl_region *region,
rc = ndctl_dax_enable(dax);
if (rc && p->autorecover)
ndctl_dax_set_namespace(dax, NULL);
- } else if (p->mode == NDCTL_NS_MODE_SAFE) {
+ } else if (p->mode == NDCTL_NS_MODE_SECTOR) {
struct ndctl_btt *btt = ndctl_region_get_btt_seed(region);
/*
@@ -560,28 +560,28 @@ static int validate_namespace_options(struct ndctl_region *region,
if (param.mode) {
if (strcmp(param.mode, "memory") == 0)
- p->mode = NDCTL_NS_MODE_MEMORY;
+ p->mode = NDCTL_NS_MODE_FSDAX;
else if (strcmp(param.mode, "sector") == 0)
- p->mode = NDCTL_NS_MODE_SAFE;
+ p->mode = NDCTL_NS_MODE_SECTOR;
else if (strcmp(param.mode, "safe") == 0)
- p->mode = NDCTL_NS_MODE_SAFE;
+ p->mode = NDCTL_NS_MODE_SECTOR;
else if (strcmp(param.mode, "dax") == 0)
- p->mode = NDCTL_NS_MODE_DAX;
+ p->mode = NDCTL_NS_MODE_DEVDAX;
else
p->mode = NDCTL_NS_MODE_RAW;
if (ndctl_region_get_type(region) != ND_DEVICE_REGION_PMEM
- && (p->mode == NDCTL_NS_MODE_MEMORY
- || p->mode == NDCTL_NS_MODE_DAX)) {
+ && (p->mode == NDCTL_NS_MODE_FSDAX
+ || p->mode == NDCTL_NS_MODE_DEVDAX)) {
debug("blk %s does not support %s mode\n", region_name,
- p->mode == NDCTL_NS_MODE_MEMORY
+ p->mode == NDCTL_NS_MODE_FSDAX
? "fsdax" : "devdax");
return -EAGAIN;
}
} else if (ndns)
p->mode = ndctl_namespace_get_mode(ndns);
- if (p->mode == NDCTL_NS_MODE_MEMORY) {
+ if (p->mode == NDCTL_NS_MODE_FSDAX) {
pfn = ndctl_region_get_pfn_seed(region);
if (!pfn && param.mode_default) {
debug("%s fsdax mode not available\n", region_name);
@@ -590,7 +590,7 @@ static int validate_namespace_options(struct ndctl_region *region,
/*
* NB: We only fail validation if a pfn-specific option is used
*/
- } else if (p->mode == NDCTL_NS_MODE_DAX) {
+ } else if (p->mode == NDCTL_NS_MODE_DEVDAX) {
dax = ndctl_region_get_dax_seed(region);
if (!dax) {
error("Kernel does not support devdax mode\n");
@@ -602,7 +602,7 @@ static int validate_namespace_options(struct ndctl_region *region,
int i, alignments;
switch (p->mode) {
- case NDCTL_NS_MODE_MEMORY:
+ case NDCTL_NS_MODE_FSDAX:
if (!pfn) {
error("Kernel does not support setting an alignment in fsdax mode\n");
return -EINVAL;
@@ -611,13 +611,13 @@ static int validate_namespace_options(struct ndctl_region *region,
alignments = ndctl_pfn_get_num_alignments(pfn);
break;
- case NDCTL_NS_MODE_DAX:
+ case NDCTL_NS_MODE_DEVDAX:
alignments = ndctl_dax_get_num_alignments(dax);
break;
default:
error("%s mode does not support setting an alignment\n",
- p->mode == NDCTL_NS_MODE_SAFE
+ p->mode == NDCTL_NS_MODE_SECTOR
? "sector" : "raw");
return -ENXIO;
}
@@ -626,7 +626,7 @@ static int validate_namespace_options(struct ndctl_region *region,
for (i = 0; i < alignments; i++) {
uint64_t a;
- if (p->mode == NDCTL_NS_MODE_MEMORY)
+ if (p->mode == NDCTL_NS_MODE_FSDAX)
a = ndctl_pfn_get_supported_alignment(pfn, i);
else
a = ndctl_dax_get_supported_alignment(dax, i);
@@ -645,7 +645,7 @@ static int validate_namespace_options(struct ndctl_region *region,
* one. If we don't then use PAGE_SIZE so the size_align
* checking works.
*/
- if (p->mode == NDCTL_NS_MODE_MEMORY) {
+ if (p->mode == NDCTL_NS_MODE_FSDAX) {
/*
* The initial pfn device support in the kernel didn't
* have the 'align' sysfs attribute and assumed a 2MB
@@ -656,7 +656,7 @@ static int validate_namespace_options(struct ndctl_region *region,
p->align = ndctl_pfn_get_align(pfn);
else
p->align = SZ_2M;
- } else if (p->mode == NDCTL_NS_MODE_DAX) {
+ } else if (p->mode == NDCTL_NS_MODE_DEVDAX) {
/*
* device dax mode was added after the align attribute
* so checking for it is unnecessary.
@@ -717,7 +717,7 @@ static int validate_namespace_options(struct ndctl_region *region,
p->sector_size = parse_size64(param.sector_size);
btt = ndctl_region_get_btt_seed(region);
- if (p->mode == NDCTL_NS_MODE_SAFE) {
+ if (p->mode == NDCTL_NS_MODE_SECTOR) {
if (!btt) {
debug("%s: does not support 'sector' mode\n",
region_name);
@@ -757,7 +757,7 @@ static int validate_namespace_options(struct ndctl_region *region,
* sector size, otherwise fall back to what the
* namespace supports.
*/
- if (btt && p->mode == NDCTL_NS_MODE_SAFE)
+ if (btt && p->mode == NDCTL_NS_MODE_SECTOR)
p->sector_size = ndctl_btt_get_sector_size(btt);
else
p->sector_size = ndctl_namespace_get_sector_size(ndns);
@@ -784,14 +784,14 @@ static int validate_namespace_options(struct ndctl_region *region,
else
p->loc = NDCTL_PFN_LOC_PMEM;
- if (ndns && p->mode != NDCTL_NS_MODE_MEMORY
- && p->mode != NDCTL_NS_MODE_DAX) {
+ if (ndns && p->mode != NDCTL_NS_MODE_FSDAX
+ && p->mode != NDCTL_NS_MODE_DEVDAX) {
debug("%s: --map= only valid for fsdax mode namespace\n",
ndctl_namespace_get_devname(ndns));
return -EINVAL;
}
- } else if (p->mode == NDCTL_NS_MODE_MEMORY
- || p->mode == NDCTL_NS_MODE_DAX)
+ } else if (p->mode == NDCTL_NS_MODE_FSDAX
+ || p->mode == NDCTL_NS_MODE_DEVDAX)
p->loc = NDCTL_PFN_LOC_PMEM;
if (!pfn && do_setup_pfn(ndns, p)) {
diff --git a/test/libndctl.c b/test/libndctl.c
index 02bb9ccaa465..daddbf919b79 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -1080,7 +1080,7 @@ static int check_btt_create(struct ndctl_region *region, struct ndctl_namespace
devname = ndctl_btt_get_devname(btt);
ndctl_btt_set_uuid(btt, btt_s->uuid);
ndctl_btt_set_sector_size(btt, btt_s->sector_sizes[i]);
- rc = ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_SAFE);
+ rc = ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_SECTOR);
if (ndctl_test_attempt(test, KERNEL_VERSION(4, 13, 0)) && rc < 0) {
fprintf(stderr, "%s: failed to enforce btt mode\n", devname);
goto err;
@@ -1100,7 +1100,7 @@ static int check_btt_create(struct ndctl_region *region, struct ndctl_namespace
/* prior to v4.5 the mode attribute did not exist */
if (ndctl_test_attempt(test, KERNEL_VERSION(4, 5, 0))) {
mode = ndctl_namespace_get_mode(ndns);
- if (mode >= 0 && mode != NDCTL_NS_MODE_SAFE)
+ if (mode >= 0 && mode != NDCTL_NS_MODE_SECTOR)
fprintf(stderr, "%s: expected safe mode got: %d\n",
devname, mode);
}
@@ -1474,7 +1474,7 @@ static int check_btt_autodetect(struct ndctl_bus *bus,
mode = ndctl_namespace_get_enforce_mode(ndns);
if (ndctl_test_attempt(test, KERNEL_VERSION(4, 13, 0))
- && mode != NDCTL_NS_MODE_SAFE) {
+ && mode != NDCTL_NS_MODE_SECTOR) {
fprintf(stderr, "%s expected enforce_mode btt\n", devname);
return -ENXIO;
}
diff --git a/util/filter.c b/util/filter.c
index 1734bce537f1..ce6239fbac3b 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -345,9 +345,9 @@ static enum ndctl_namespace_mode mode_to_type(const char *mode)
else if (strcasecmp(mode, "fsdax") == 0)
return NDCTL_NS_MODE_MEMORY;
else if (strcasecmp(mode, "sector") == 0)
- return NDCTL_NS_MODE_SAFE;
+ return NDCTL_NS_MODE_SECTOR;
else if (strcasecmp(mode, "safe") == 0)
- return NDCTL_NS_MODE_SAFE;
+ return NDCTL_NS_MODE_SECTOR;
else if (strcasecmp(mode, "dax") == 0)
return NDCTL_NS_MODE_DAX;
else if (strcasecmp(mode, "devdax") == 0)
diff --git a/util/json.c b/util/json.c
index babdc8c47565..3e171e7672ae 100644
--- a/util/json.c
+++ b/util/json.c
@@ -904,7 +904,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
jobj = json_object_new_string("devdax");
loc = ndctl_dax_get_location(dax);
break;
- case NDCTL_NS_MODE_SAFE:
+ case NDCTL_NS_MODE_SECTOR:
if (!btt)
goto err;
jobj = json_object_new_string("sector");
@@ -920,7 +920,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
if (jobj)
json_object_object_add(jndns, "mode", jobj);
- if ((mode != NDCTL_NS_MODE_SAFE) && (mode != NDCTL_NS_MODE_RAW)) {
+ if ((mode != NDCTL_NS_MODE_SECTOR) && (mode != NDCTL_NS_MODE_RAW)) {
jobj = json_object_new_string(locations[loc]);
if (jobj)
json_object_object_add(jndns, "map", jobj);
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2019-07-27 21:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-27 21:39 [ndctl PATCH v2 00/26] Improvements for namespace creation/interrogation Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 01/26] ndctl/dimm: Add 'flags' field to read-labels output Dan Williams
2019-08-02 18:01 ` Verma, Vishal L
2019-08-02 18:19 ` Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 02/26] ndctl/dimm: Add --human support to read-labels Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 03/26] ndctl/build: Drop -Wpointer-arith Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 04/26] ndctl/namespace: Add read-infoblock command Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 05/26] ndctl/test: Update dax-dev to handle multiple e820 ranges Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 06/26] ndctl/test: Make dax.sh more robust vs small namespaces Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 07/26] ndctl/namespace: Always zero info-blocks Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 08/26] ndctl/dimm: Support small label reads/writes Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 09/26] ndctl/dimm: Minimize data-transfer for init-labels Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 10/26] ndctl/dimm: Add offset and size options to {read, write, zero}-labels Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 11/26] ndctl/dimm: Limit read-labels with --index option Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 12/26] ndctl/namespace: Minimize label data transfer for autolabel Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 13/26] ndctl/namespace: Disable autorecovery of create-namespace failures Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 14/26] ndctl/namespace: Handle 'create-namespace' in label-less mode Dan Williams
2019-08-21 12:56 ` Michal Suchánek
2019-08-21 18:03 ` Verma, Vishal L
2019-08-21 18:19 ` Michal Suchánek
2019-07-27 21:40 ` [ndctl PATCH v2 15/26] ndctl/dimm: Fix init-labels success reporting Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 16/26] ndctl/test: Fix device-dax bus-model detection Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 17/26] ndctl/test: Checkout device-mapper + dax operation Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 18/26] ndctl/test: Exercise sub-section sized namespace creation/deletion Dan Williams
2019-07-27 21:41 ` Dan Williams [this message]
2019-07-27 21:41 ` [ndctl PATCH v2 20/26] ndctl/namespace: Introduce mode-to-name and name-to-mode helpers Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 21/26] ndctl/namespace: Validate namespace size within validate_namespace_options() Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 22/26] ndctl/namespace: Clarify 16M minimum size requirement Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 23/26] ndctl/namespace: Report ENOSPC when regions are full Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 24/26] ndctl/test: Regression test 'failed to track' Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 25/26] ndctl/namespace: Continue region search on 'missing seed' event Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 26/26] ndctl/monitor: Allow monitor to be manually moved to the background Dan Williams
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=156426366309.531577.11554918086632763562.stgit@dwillia2-desk3.amr.corp.intel.com \
--to=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
/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;
as well as URLs for NNTP newsgroup(s).