diff mbox series

[3/3] namespace-action: Drop zero namespace checks.

Message ID 486878ed6f1d74827afb42543f3186fe386059de.1598608222.git.msuchanek@suse.de (mailing list archive)
State New, archived
Headers show
Series [1/3] ndctl/namespace: Skip seed namespaces when processing all namespaces. | expand

Commit Message

Michal Suchánek Aug. 28, 2020, 9:51 a.m. UTC
From: Santosh Sivaraj <santosh@fossix.org>

With seed namespaces catched early on these checks for sizes in enable
and destroy namespace code path are not needed.

Link: https://patchwork.kernel.org/patch/11739975/
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[rebased on top of the previous patches]
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 ndctl/lib/libndctl.c |  5 -----
 ndctl/namespace.c    | 11 -----------
 2 files changed, 16 deletions(-)

Comments

Michal Suchánek Sept. 1, 2020, 10:05 a.m. UTC | #1
On Fri, Aug 28, 2020 at 11:51:05AM +0200, Michal Suchanek wrote:
> From: Santosh Sivaraj <santosh@fossix.org>
> 
> With seed namespaces catched early on these checks for sizes in enable
> and destroy namespace code path are not needed.

Effectively reverts the two below commits:

Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces")
Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices")
> Link: https://patchwork.kernel.org/patch/11739975/
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
> [rebased on top of the previous patches]
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  ndctl/lib/libndctl.c |  5 -----
>  ndctl/namespace.c    | 11 -----------
>  2 files changed, 16 deletions(-)
> 
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index 952192c4c6b5..ecced5a3ae0b 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -4253,16 +4253,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
>  	const char *devname = ndctl_namespace_get_devname(ndns);
>  	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
>  	struct ndctl_region *region = ndns->region;
> -	unsigned long long size = ndctl_namespace_get_size(ndns);
>  	int rc;
>  
>  	if (ndctl_namespace_is_enabled(ndns))
>  		return 0;
>  
> -	/* Don't try to enable idle namespace (no capacity allocated) */
> -	if (size == 0)
> -		return -ENXIO;
> -
>  	rc = ndctl_bind(ctx, ndns->module, devname);
>  
>  	/*
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 835f4076008a..65bca9191603 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -1094,7 +1094,6 @@ static int namespace_destroy(struct ndctl_region *region,
>  		struct ndctl_namespace *ndns)
>  {
>  	const char *devname = ndctl_namespace_get_devname(ndns);
> -	unsigned long long size;
>  	bool did_zero = false;
>  	int rc;
>  
> @@ -1139,19 +1138,9 @@ static int namespace_destroy(struct ndctl_region *region,
>  		goto out;
>  	}
>  
> -	size = ndctl_namespace_get_size(ndns);
> -
>  	rc = ndctl_namespace_delete(ndns);
>  	if (rc)
>  		debug("%s: failed to reclaim\n", devname);
> -
> -	/*
> -	 * Don't report a destroyed namespace when no capacity was
> -	 * allocated.
> -	 */
> -	if (size == 0 && rc == 0)
> -		rc = 1;
> -
>  out:
>  	return rc;
>  }
> -- 
> 2.28.0
>
diff mbox series

Patch

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 952192c4c6b5..ecced5a3ae0b 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4253,16 +4253,11 @@  NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
 	const char *devname = ndctl_namespace_get_devname(ndns);
 	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
 	struct ndctl_region *region = ndns->region;
-	unsigned long long size = ndctl_namespace_get_size(ndns);
 	int rc;
 
 	if (ndctl_namespace_is_enabled(ndns))
 		return 0;
 
-	/* Don't try to enable idle namespace (no capacity allocated) */
-	if (size == 0)
-		return -ENXIO;
-
 	rc = ndctl_bind(ctx, ndns->module, devname);
 
 	/*
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 835f4076008a..65bca9191603 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1094,7 +1094,6 @@  static int namespace_destroy(struct ndctl_region *region,
 		struct ndctl_namespace *ndns)
 {
 	const char *devname = ndctl_namespace_get_devname(ndns);
-	unsigned long long size;
 	bool did_zero = false;
 	int rc;
 
@@ -1139,19 +1138,9 @@  static int namespace_destroy(struct ndctl_region *region,
 		goto out;
 	}
 
-	size = ndctl_namespace_get_size(ndns);
-
 	rc = ndctl_namespace_delete(ndns);
 	if (rc)
 		debug("%s: failed to reclaim\n", devname);
-
-	/*
-	 * Don't report a destroyed namespace when no capacity was
-	 * allocated.
-	 */
-	if (size == 0 && rc == 0)
-		rc = 1;
-
 out:
 	return rc;
 }