Skip to contentSkip to conversation

namespace/create: Don't create multiple namespaces unless greedy

PATCH In review Santosh Sivaraj 3 participants 4 messages Dec 6, 2019 – Feb 18, 2020 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 namespace/create: Don't create multiple namespaces unless greedy

From: Vaibhav Jain <[email protected]>

Currently create-namespace creates two namespaces with the '-f' option even without the greedy flag. This behavior got introduced by c75f7236d. The earlier behaviour was to create one namespace even with the '-f' flag. The earlier behavior:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
[sudo] password for santosh:
{
  "dev":"namespace1.14",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"03f6b921-7684-4736-b2be-87f021996e52",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.14"
}

After greedy option was introduced:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
{
  "dev":"namespace1.8",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"1a9d6610-558b-454e-8b95-76c6201798cb",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.8"
}
{
  "dev":"namespace0.3",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"eed9d28b-69a2-4c7c-9503-24e8aee87b1e",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem0.3"
}

The force flag makes sense only in the case of a reconfiguration or greedy namespace creation.

Fixes c75f7236d (ndctl/namespace: add a --continue option to create namespaces greedily)
---
 ndctl/namespace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
ndctl/namespace.c +2 -4
index 7fb0007..b1f2158 100644
@@ -1388,11 +1388,9 @@ static int do_xaction_namespace(const char *namespace,
 					(*processed)++;
 					if (param.greedy)
 						continue;
-				}
-				if (force) {
-					if (rc)
+				} else if (param.greedy && force) {
 						saved_rc = rc;
-					continue;
+						continue;
 				}
 				return rc;
 			}
Signature · 4 lines
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
#1 lore raw
Quoted 60 lines · Santosh Sivaraj

From: Vaibhav Jain <[email protected]>

Currently create-namespace creates two namespaces with the '-f' option even without the greedy flag. This behavior got introduced by c75f7236d. The earlier behaviour was to create one namespace even with the '-f' flag. The earlier behavior:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
[sudo] password for santosh:
{
  "dev":"namespace1.14",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"03f6b921-7684-4736-b2be-87f021996e52",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.14"
}

After greedy option was introduced:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
{
  "dev":"namespace1.8",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"1a9d6610-558b-454e-8b95-76c6201798cb",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.8"
}
{
  "dev":"namespace0.3",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"eed9d28b-69a2-4c7c-9503-24e8aee87b1e",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem0.3"
}

The force flag makes sense only in the case of a reconfiguration or greedy namespace creation.

Fixes c75f7236d (ndctl/namespace: add a --continue option to create namespaces greedily)
---
 ndctl/namespace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
ndctl/namespace.c +0 -0
index 7fb0007..b1f2158 100644

ndctl/namespace.c static int do_xaction_namespace(const char *namespace, · line 1393

Quoted 10 lines
ndctl/namespace.c +2 -4
@@ -1388,11 +1388,9 @@ static int do_xaction_namespace(const char *namespace,
                                        (*processed)++;
                                        if (param.greedy)
                                                continue;
-                               }
-                               if (force) {
-                                       if (rc)
+                               } else if (param.greedy && force) {
                                                saved_rc = rc;
-                                       continue;
+                                               continue;

Looks good, applied.
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]

#2 lore raw
Quoted 9 lines · Dan Williams
Quoted 9 lines
ndctl/namespace.c +0 -1
index 7fb0007..b1f2158 100644
@@ -1388,11 +1388,9 @@ static int do_xaction_namespace(const char *namespace,
                                        (*processed)++;
                                        if (param.greedy)
                                                continue;
-                               }
Quoted 8 lines

ndctl/namespace.c static int do_xaction_namespace(const char *namespace, · line 1393

Quoted 6 lines
ndctl/namespace.c +2 -3
-                               if (force) {
-                                       if (rc)
+                               } else if (param.greedy && force) {
                                                saved_rc = rc;
-                                       continue;
+                                               continue;

Looks good, applied.

Where?

-Jeff
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]

#3 lore raw
Quoted 21 lines · Jeff Moyer
Quoted 9 lines · Dan Williams
Quoted 9 lines
ndctl/namespace.c +0 -1
index 7fb0007..b1f2158 100644
@@ -1388,11 +1388,9 @@ static int do_xaction_namespace(const char *namespace,
                                        (*processed)++;
                                        if (param.greedy)
                                                continue;
-                               }
Quoted 8 lines

ndctl/namespace.c static int do_xaction_namespace(const char *namespace, · line 1393

Quoted 6 lines
ndctl/namespace.c +2 -3
-                               if (force) {
-                                       if (rc)
+                               } else if (param.greedy && force) {
                                                saved_rc = rc;
-                                       continue;
+                                               continue;

Looks good, applied.

Quoted 1 line

Where?

To the pending queue for v68... that has not been pushed out anywhere. Were a bit past due for a release. I've been focussed on trying to get this align issue squared away in the meantime. This is what I have for the current backlog targeting v68

Auke Kok (3):
ndctl/build: Do not use check-news when NEWS file is absent entirely. ndctl/build: Ensure header and other misc files are listed. ndctl/build: Add header as a prereq to Make rule where it is consumed.

Dan Williams (26):
ndctl/namespace: Clarify that 'reconfigure' == 'destroy+create' ndctl/namespace: Fixup man page indentation
ndctl/list: Add 'target_node' to region and namespace verbose listings ndctl/docs: Fix mailing list sign-up link
ndctl/list: Drop named list objects from verbose listing daxctl/list: Avoid memory operations without resource data ndctl/build: Fix distcheck
ndctl/namespace: Fix destroy-namespace accounting relative to seed devices ndctl/region: Support ndctl_region_{get,set}_align() ndctl/namespace: Improve namespace action failure messages ndctl/namespace: Add read-infoblock command
ndctl/test: Update dax-dev to handle multiple e820 ranges ndctl/namespace: Always zero info-blocks
ndctl/namespace: Disable autorecovery of create-namespace failures ndctl/build: Fix EXTRA_DIST already defined errors ndctl/test: Checkout device-mapper + dax operation ndctl/test: Exercise sub-section sized namespace creation/deletion ndctl/namespace: Kill off the legacy mode names ndctl/namespace: Introduce mode-to-name and name-to-mode helpers ndctl/namespace: Validate namespace size within
validate_namespace_options()
ndctl/namespace: Clarify 16M minimum size requirement ndctl/test: Regression test 'failed to track'
ndctl/dimm: Rework dimm command status reporting
ndctl/dimm: Rework iteration to drop unaligned pointers ndctl/test: Fix typos / loss of tpm.handle in security test ndctl/test: Relax dax_pmem_compat requirement

Ira Weiny (1):
ndctl: Clean up loop logic in query_fw_finish_status

Santosh Sivaraj (1):
ndctl/zero-labels: Display error if regions are active

Vaibhav Jain (1):
namespace/create: Don't create multiple namespaces unless greedy

Vishal Verma (3):
ndctl/namespace: remove open coded is_namespace_active() ndctl/namespace: introduce ndctl_namespace_is_configuration_idle() ndctl/README: Update kernel documentation URL

Yi Zhang (1):
ndctl, test: add bus-id parameter for start-scrub/wait-scrub operation

redhairer (2):
ndctl, test: add UUID_LIBS for blk_namespaces/pmem_namespaces/device_dax
daxctl: Change region input type from INTEGER to STRING.
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]