diff mbox series

[ndctl,V2] namespace/create: Don't create multiple namespaces unless greedy

Message ID 20191206053520.235805-1-santosh@fossix.org (mailing list archive)
State Accepted
Commit ca2dc1b5a8a963816ba30ad936876d9adb86b6f6
Headers show
Series [ndctl,V2] namespace/create: Don't create multiple namespaces unless greedy | expand

Commit Message

Santosh Sivaraj Dec. 6, 2019, 5:35 a.m. UTC
From: Vaibhav Jain <vaibhav@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@fossix.org>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
 ndctl/namespace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Dan Williams Dec. 10, 2019, 7:02 p.m. UTC | #1
On Thu, Dec 5, 2019 at 9:35 PM Santosh Sivaraj <santosh@fossix.org> wrote:
>
> From: Vaibhav Jain <vaibhav@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@fossix.org>
> Signed-off-by: Vaibhav Jain <vaibhav@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.
Jeff Moyer Feb. 18, 2020, 10:36 p.m. UTC | #2
Dan Williams <dan.j.williams@intel.com> writes:

>> 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.

Where?

-Jeff
Dan Williams Feb. 18, 2020, 10:42 p.m. UTC | #3
On Tue, Feb 18, 2020 at 2:36 PM Jeff Moyer <jmoyer@redhat.com> wrote:
>
> Dan Williams <dan.j.williams@intel.com> writes:
>
> >> 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.
>
> 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.
diff mbox series

Patch

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;
 				}
 				return rc;
 			}