Skip to contentSkip to conversation

ndctl/check-namespace: improve error message in absence of a BTT

PATCH In review Vishal Verma 2 participants 3 messages Aug 22, 2019 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/2 ndctl/check-namespace: improve error message in absence of a BTT

When a BTT info block is not found, check-namespace only reported something like:

namespace5.0: namespace_check: Unable to recover any BTT info blocks error checking namespaces: No such device or address checked 0 namespaces

This can be improved by suggesting a BTT might not have been present on the namespace at all, so emit an additional message such as:

namespace5.0: namespace_check: This may not be a sector mode namespace

---
 ndctl/check.c | 2 ++
 1 file changed, 2 insertions(+)
ndctl/check.c +2 -0
index 5969012..365abaf 100644
@@ -1322,6 +1322,8 @@ int namespace_check(struct ndctl_namespace *ndns, bool verbose, bool force,
 			rc = btt_recover_first_sb(bttc);
 			if (rc) {
 				err(bttc, "Unable to recover any BTT info blocks\n");
+				err(bttc,
+					"This may not be a sector mode namespace\n");
 				goto out_close;
 			}
 			/*
Signature · 6 lines
2.20.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
author maintainer
#1 lore raw

PATCH 2/2 libdaxctl: point to migrate-device-model for dax-class errors

When a dax-bus vs. dax-class expectation causes a failure, such as when reconfiguring device modes, print an error message directly pointing the user to the daxctl-migrate-device-model command.

---
 daxctl/lib/libdaxctl.c | 2 ++
 1 file changed, 2 insertions(+)
daxctl/lib/libdaxctl.c +2 -0
index 44842b9..c0a859c 100644
@@ -917,6 +917,7 @@ static int daxctl_dev_enable(struct daxctl_dev *dev, enum daxctl_dev_mode mode)
 
 	if (!device_model_is_dax_bus(dev)) {
 		err(ctx, "%s: error: device model is dax-class\n", devname);
+		err(ctx, "%s: see man daxctl-migrate-device-model\n", devname);
 		return -EOPNOTSUPP;
 	}
 
@@ -962,6 +963,7 @@ DAXCTL_EXPORT int daxctl_dev_disable(struct daxctl_dev *dev)
 
 	if (!device_model_is_dax_bus(dev)) {
 		err(ctx, "%s: error: device model is dax-class\n", devname);
+		err(ctx, "%s: see man daxctl-migrate-device-model\n", devname);
 		return -EOPNOTSUPP;
 	}
 
Signature · 6 lines
2.20.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Reviewed-by on v1 2/2
#2 lore raw

Re: [ndctl PATCH 2/2] libdaxctl: point to migrate-device-model for dax-class errors

Quoted 25 lines · Vishal Verma

When a dax-bus vs. dax-class expectation causes a failure, such as when reconfiguring device modes, print an error message directly pointing the user to the daxctl-migrate-device-model command.

---
 daxctl/lib/libdaxctl.c | 2 ++
 1 file changed, 2 insertions(+)
daxctl/lib/libdaxctl.c +1 -0
index 44842b9..c0a859c 100644
@@ -917,6 +917,7 @@ static int daxctl_dev_enable(struct daxctl_dev *dev, enum daxctl_dev_mode mode)
 
 	if (!device_model_is_dax_bus(dev)) {
 		err(ctx, "%s: error: device model is dax-class\n", devname);
+		err(ctx, "%s: see man daxctl-migrate-device-model\n", devname);
 		return -EOPNOTSUPP;
 	}
 

daxctl/lib/libdaxctl.c DAXCTL_EXPORT int daxctl_dev_disable(struct daxctl_dev *dev) · line 968

Quoted 6 lines
daxctl/lib/libdaxctl.c +1 -0
@@ -962,6 +963,7 @@ DAXCTL_EXPORT int daxctl_dev_disable(struct daxctl_dev *dev)
 
 	if (!device_model_is_dax_bus(dev)) {
 		err(ctx, "%s: error: device model is dax-class\n", devname);
+		err(ctx, "%s: see man daxctl-migrate-device-model\n", devname);
 		return -EOPNOTSUPP;
 	}

Thanks, Vishal!
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm