On Thu, Dec 5, 2019 at 9:35 PM Santosh Sivaraj <santosh(a)fossix.org> wrote:
From: Vaibhav Jain <vaibhav(a)linux.ibm.com>
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)
Signed-off-by: Santosh Sivaraj <santosh(a)fossix.org>
Signed-off-by: Vaibhav Jain <vaibhav(a)linux.ibm.com>
---
ndctl/namespace.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..b1f2158 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -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.