Skip to contentSkip to conversation

namespace-action: Drop more zero namespace checks.

PATCH New Michal Suchanek 1 participant 3 messages Apr 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 namespace-action: Drop more zero namespace checks.

With seed namespaces caught early on with
commit 9bd2994 ("ndctl/namespace: Skip seed namespaces when processing all namespaces.") commit 07011a3 ("ndctl/namespace: Suppress -ENXIO when processing all namespaces.") the function-specific checks are no longer needed and can be dropped.

Reverts commit fb13dfb ("zero_info_block: skip seed devices")
Reverts commit fe626a8 ("ndctl/namespace: Fix disable-namespace accounting relative to seed devices")

Fixes 80e0d88 ("namespace-action: Drop zero namespace checks.")
Fixes fb13dfb ("zero_info_block: skip seed devices")
Fixes fe626a8 ("ndctl/namespace: Fix disable-namespace accounting relative to seed devices")
---
 ndctl/lib/libndctl.c |  7 +------
 ndctl/namespace.c    | 11 ++++-------
 ndctl/region.c       |  2 +-
 3 files changed, 6 insertions(+), 14 deletions(-)
ndctl/lib/libndctl.c +1 -6
index ccca8b5..110d8a5 100644
@@ -4593,7 +4593,6 @@ NDCTL_EXPORT int ndctl_namespace_disable_safe(struct ndctl_namespace *ndns)
 	const char *bdev = NULL;
 	int fd, active = 0;
 	char path[50];
-	unsigned long long size = ndctl_namespace_get_size(ndns);
 
 	if (pfn && ndctl_pfn_is_enabled(pfn))
 		bdev = ndctl_pfn_get_block_device(pfn);
@@ -4630,11 +4629,7 @@ NDCTL_EXPORT int ndctl_namespace_disable_safe(struct ndctl_namespace *ndns)
 				devname);
 		return -EBUSY;
 	} else {
-		if (size == 0)
-			/* No disable necessary due to no capacity allocated */
-			return 1;
-		else
-			ndctl_namespace_disable_invalidate(ndns);
+		ndctl_namespace_disable_invalidate(ndns);
 	}
 
 	return 0;
ndctl/namespace.c +4 -7
index 257b58c..722f13a 100644
@@ -1054,9 +1054,6 @@ static int zero_info_block(struct ndctl_namespace *ndns)
 	void *buf = NULL, *read_buf = NULL;
 	char path[50];
 
-	if (ndctl_namespace_get_size(ndns) == 0)
-		return 1;
-
 	ndctl_namespace_set_raw_mode(ndns, 1);
 	rc = ndctl_namespace_enable(ndns);
 	if (rc < 0) {
@@ -1130,7 +1127,7 @@ static int namespace_prep_reconfig(struct ndctl_region *region,
 	}
 
 	rc = ndctl_namespace_disable_safe(ndns);
-	if (rc < 0)
+	if (rc)
 		return rc;
 
 	ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_RAW);
@@ -1426,7 +1423,7 @@ static int dax_clear_badblocks(struct ndctl_dax *dax)
 		return -ENXIO;
 
 	rc = ndctl_namespace_disable_safe(ndns);
-	if (rc < 0) {
+	if (rc) {
 		error("%s: unable to disable namespace: %s\n", devname,
 			strerror(-rc));
 		return rc;
@@ -1450,7 +1447,7 @@ static int pfn_clear_badblocks(struct ndctl_pfn *pfn)
 		return -ENXIO;
 
 	rc = ndctl_namespace_disable_safe(ndns);
-	if (rc < 0) {
+	if (rc) {
 		error("%s: unable to disable namespace: %s\n", devname,
 			strerror(-rc));
 		return rc;
@@ -1473,7 +1470,7 @@ static int raw_clear_badblocks(struct ndctl_namespace *ndns)
 		return -ENXIO;
 
 	rc = ndctl_namespace_disable_safe(ndns);
-	if (rc < 0) {
+	if (rc) {
 		error("%s: unable to disable namespace: %s\n", devname,
 			strerror(-rc));
 		return rc;
ndctl/region.c +1 -1
index e499546..33828b0 100644
@@ -71,7 +71,7 @@ static int region_action(struct ndctl_region *region, enum device_action mode)
 	case ACTION_DISABLE:
 		ndctl_namespace_foreach(region, ndns) {
 			rc = ndctl_namespace_disable_safe(ndns);
-			if (rc < 0)
+			if (rc)
 				return rc;
 		}
 		rc = ndctl_region_disable_invalidate(region);
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/1 daxctl: Fix kernel option typo in "Soft Reservation" theory of operation

Fixes 8f4e42c ("daxctl: Add "Soft Reservation" theory of operation")
---
 Documentation/daxctl/daxctl-reconfigure-device.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/daxctl/daxctl-reconfigure-device.txt +2 -2
index 385c0c5..09691d2 100644
@@ -91,8 +91,8 @@ details.
 Outside of the NUMA performance details linked above the other method to
 detect the presence of "Soft Reserved" memory is to dump /proc/iomem and
 look for "Soft Reserved" ranges. If the kernel was not built with
-CONFIG_EFI_SOFTRESERVE, predates the introduction of
-CONFIG_EFI_SOFTRESERVE (v5.5), or was booted with the efi=nosoftreserve
+CONFIG_EFI_SOFT_RESERVE, predates the introduction of
+CONFIG_EFI_SOFT_RESERVE (v5.5), or was booted with the efi=nosoftreserve
 command line then device-dax will not attach and the expectation is that
 the memory shows up as a memory-only NUMA node. Otherwise the memory
 shows up as a device-dax instance and DAXCTL(1) can be used to
Signature · 1 line
2.35.1
#2 lore raw

PATCH 1/1 meson: make modprobedatadir an option.

In reply to Michal Suchanek

The modprobe.d directory location is hardcoded.

Fixes 4e5faa1 ("build: Add meson build infrastructure")
---
 contrib/meson.build | 5 ++++-
 meson_options.txt   | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
contrib/meson.build +4 -1
index 4ed3c20..ad63a50 100644
@@ -24,5 +24,8 @@ if bashcompletiondir != 'no'
   install_data('ndctl', rename : 'cxl', install_dir : bashcompletiondir)
 endif
 
-modprobedatadir = get_option('sysconfdir') + '/modprobe.d/'
+modprobedatadir = get_option('modprobedatadir')
+if modprobedatadir == ''
+  modprobedatadir = get_option('modprobedatadir')
+endif
 install_data('nvdimm-security.conf', install_dir : modprobedatadir)
meson_options.txt +2 -0
index aa4a6dc..3a68460 100644
@@ -23,3 +23,5 @@ option('pkgconfiglibdir', type : 'string', value : '',
        description : 'directory for standard pkg-config files')
 option('bashcompletiondir', type : 'string',
        description : '''${datadir}/bash-completion/completions''')
+option('modprobedatadir', type : 'string',
+       description : '''${sysconfdir}/modprobe.d/''')
Signature · 1 line
2.35.1