anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone
Jeff Moyer 2c91dc
From 80e0d88c3098bd419e26146a8cb3b693fdd06417 Mon Sep 17 00:00:00 2001
Jeff Moyer 2c91dc
From: Santosh Sivaraj <santosh@fossix.org>
Jeff Moyer 2c91dc
Date: Wed, 6 Jan 2021 14:17:42 +0100
Jeff Moyer 2c91dc
Subject: [PATCH 030/217] namespace-action: Drop zero namespace checks.
Bryan Gurney bc084d
Jeff Moyer 2c91dc
With seed namespaces catched early on these checks for sizes in enable
Jeff Moyer 2c91dc
and destroy namespace code path are not needed.
Bryan Gurney bc084d
Jeff Moyer 2c91dc
Reverts commit b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace
Jeff Moyer 2c91dc
error for seed namespaces")
Bryan Gurney bc084d
Jeff Moyer 2c91dc
Reverts commit e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace
Jeff Moyer 2c91dc
accounting relative to seed devices")
Jeff Moyer 2c91dc
Jeff Moyer 2c91dc
Link: https://patchwork.kernel.org/patch/11739975/
Jeff Moyer 2c91dc
Link: https://lore.kernel.org/r/eb4bc7885708fa13e3d37286bc4a4219b1e4e5b6.1609938610.git.msuchanek@suse.de
Jeff Moyer 2c91dc
Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces")
Jeff Moyer 2c91dc
Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices")
Jeff Moyer 2c91dc
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Jeff Moyer 2c91dc
[rebased on top of the previous patches]
Jeff Moyer 2c91dc
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Jeff Moyer 2c91dc
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Jeff Moyer 2c91dc
---
Jeff Moyer 2c91dc
 ndctl/lib/libndctl.c |  5 -----
Jeff Moyer 2c91dc
 ndctl/namespace.c    | 10 ----------
Jeff Moyer 2c91dc
 2 files changed, 15 deletions(-)
Bryan Gurney bc084d
Bryan Gurney bc084d
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
Bryan Gurney bc084d
index 536e142..87f60b9 100644
Bryan Gurney bc084d
--- a/ndctl/lib/libndctl.c
Bryan Gurney bc084d
+++ b/ndctl/lib/libndctl.c
Bryan Gurney bc084d
@@ -4531,16 +4531,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
Bryan Gurney bc084d
 	const char *devname = ndctl_namespace_get_devname(ndns);
Bryan Gurney bc084d
 	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
Bryan Gurney bc084d
 	struct ndctl_region *region = ndns->region;
Bryan Gurney bc084d
-	unsigned long long size = ndctl_namespace_get_size(ndns);
Bryan Gurney bc084d
 	int rc;
Bryan Gurney bc084d
 
Bryan Gurney bc084d
 	if (ndctl_namespace_is_enabled(ndns))
Bryan Gurney bc084d
 		return 0;
Bryan Gurney bc084d
 
Bryan Gurney bc084d
-	/* Don't try to enable idle namespace (no capacity allocated) */
Bryan Gurney bc084d
-	if (size == 0)
Bryan Gurney bc084d
-		return -ENXIO;
Bryan Gurney bc084d
-
Bryan Gurney bc084d
 	rc = ndctl_bind(ctx, ndns->module, devname);
Bryan Gurney bc084d
 
Bryan Gurney bc084d
 	/*
Bryan Gurney bc084d
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
Bryan Gurney bc084d
index cd822b3..c67c086 100644
Bryan Gurney bc084d
--- a/ndctl/namespace.c
Bryan Gurney bc084d
+++ b/ndctl/namespace.c
Bryan Gurney bc084d
@@ -1164,15 +1164,12 @@ static int namespace_destroy(struct ndctl_region *region,
Bryan Gurney bc084d
 		struct ndctl_namespace *ndns)
Bryan Gurney bc084d
 {
Bryan Gurney bc084d
 	const char *devname = ndctl_namespace_get_devname(ndns);
Bryan Gurney bc084d
-	unsigned long long size;
Bryan Gurney bc084d
 	int rc;
Bryan Gurney bc084d
 
Bryan Gurney bc084d
 	rc = namespace_prep_reconfig(region, ndns);
Bryan Gurney bc084d
 	if (rc < 0)
Bryan Gurney bc084d
 		return rc;
Bryan Gurney bc084d
 
Bryan Gurney bc084d
-	size = ndctl_namespace_get_size(ndns);
Bryan Gurney bc084d
-
Bryan Gurney bc084d
 	/* Labeled namespace, destroy label / allocation */
Bryan Gurney bc084d
 	if (rc == 2) {
Bryan Gurney bc084d
 		rc = ndctl_namespace_delete(ndns);
Bryan Gurney bc084d
@@ -1180,13 +1177,6 @@ static int namespace_destroy(struct ndctl_region *region,
Bryan Gurney bc084d
 			debug("%s: failed to reclaim\n", devname);
Bryan Gurney bc084d
 	}
Bryan Gurney bc084d
 
Bryan Gurney bc084d
-	/*
Bryan Gurney bc084d
-	 * Don't report a destroyed namespace when no capacity was
Bryan Gurney bc084d
-	 * allocated.
Bryan Gurney bc084d
-	 */
Bryan Gurney bc084d
-	if (size == 0 && rc == 0)
Bryan Gurney bc084d
-		rc = 1;
Bryan Gurney bc084d
-
Bryan Gurney bc084d
 	return rc;
Bryan Gurney bc084d
 }
Bryan Gurney bc084d
 
Jeff Moyer 2c91dc
-- 
Jeff Moyer 2c91dc
2.27.0
Jeff Moyer 2c91dc