Skip to contentSkip to conversation

namespace-action: Don't act on any seed namespaces

PATCH New Santosh Sivaraj 1 participant 1 message Aug 27, 2020 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 namespace-action: Don't act on any seed namespaces

Catch seed namespaces early on. This will prevent checking for sizes in enable, disable and destroy namespace code path, which in turn prevents the inconsistent reporting in count of enabled/disabled namespaces.

---
 ndctl/lib/libndctl.c |  5 ----
 ndctl/namespace.c    | 57 +++++++++++++++++++++-----------------------
 2 files changed, 27 insertions(+), 35 deletions(-)

Changes from v2: Updated patch to return the proper error code. In V1, we return the default -ENXIO even if we had skipped all the namespaces (when there are only idle namespaces). In cases like that, we need to return zero, except when creating namespaces, which may fail due to insufficient space.

ndctl/lib/libndctl.c +0 -5
index ee737cb..d0599f7 100644
@@ -4130,16 +4130,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);
 
 	/*
ndctl/namespace.c +27 -30

92 lines not on this page · raw message

Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]