Skip to contentSkip to conversation

ndctl: add a 'clear-errors' command

PATCH New Vishal Verma 1 participant 1 message Apr 12, 2019

Subsystems (2)
lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/1 ndctl: add a 'clear-errors' command

Add a nre command, ndctl-clear-errors, to clear any errors (badblocks) on a namespace. This is in preparation for a 'system-ram' mode for devdax devices using the kernel's 'kmem' facility. Since the device is being used as volatile RAM, we can take the opportunity to clear any badblocks on the device before reconfiguration, so that the user doesn't come across one unexpectedly.

Make this error clearing facility generic to all namespace types (i.e. devdax, fsdax, and raw; sector mode namespaces are not supported). To clear errors, use the "Clear Uncorrectable Errors" ACPI DSM command via the helpers provided by libndctl.

---
 Documentation/ndctl/Makefile.am            |   1 +
 Documentation/ndctl/ndctl-clear-errors.txt | 106 ++++++++
 contrib/ndctl                              |   3 +
 ndctl/action.h                             |   1 +
 ndctl/builtin.h                            |   1 +
 ndctl/namespace.c                          | 279 +++++++++++++++++++++
 ndctl/ndctl.c                              |   1 +
 7 files changed, 392 insertions(+)
 create mode 100644 Documentation/ndctl/ndctl-clear-errors.txt
Documentation/ndctl/Makefile.am +1 -0
index 2593dbd..fb46d7c 100644
@@ -43,6 +43,7 @@ man1_MANS = \
 	ndctl-create-namespace.1 \
 	ndctl-destroy-namespace.1 \
 	ndctl-check-namespace.1 \
+	ndctl-clear-errors.1 \
 	ndctl-inject-error.1 \
 	ndctl-inject-smart.1 \
 	ndctl-update-firmware.1 \
Documentation/ndctl/ndctl-clear-errors.txt new file +106 -0

106 lines not on this page · raw message

contrib/ndctl +3 -0
index e17fb0b..396a344 100755
@@ -328,6 +328,9 @@ __ndctl_comp_non_option_args()
 	check-namespace)
 		opts="$(__ndctl_get_ns -i) all"
 		;;
+	clear-errors)
+		opts="$(__ndctl_get_ns) all"
+		;;
 	enable-region)
 		opts="$(__ndctl_get_regions -i) all"
 		;;
ndctl/action.h +1 -0
index 1ecad49..50da010 100644
@@ -13,5 +13,6 @@ enum device_action {
 	ACTION_CHECK,
 	ACTION_WAIT,
 	ACTION_START,
+	ACTION_CLEAR,
 };
 #endif /* __NDCTL_ACTION_H__ */
ndctl/builtin.h +1 -0
index 681a69f..94ab317 100644
@@ -10,6 +10,7 @@ int cmd_create_namespace(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_destroy_namespace(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_disable_namespace(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_check_namespace(int argc, const char **argv, struct ndctl_ctx *ctx);
+int cmd_clear_errors(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_enable_region(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_disable_region(int argc, const char **argv, struct ndctl_ctx *ctx);
 int cmd_enable_dimm(int argc, const char **argv, struct ndctl_ctx *ctx);
ndctl/namespace.c +279 -0

318 lines not on this page · raw message

ndctl/ndctl.c +1 -0
index bd333b2..6c4975c 100644
@@ -74,6 +74,7 @@ static struct cmd_struct commands[] = {
 	{ "create-namespace", { cmd_create_namespace } },
 	{ "destroy-namespace", { cmd_destroy_namespace } },
 	{ "check-namespace", { cmd_check_namespace } },
+	{ "clear-errors", { cmd_clear_errors } },
 	{ "enable-region", { cmd_enable_region } },
 	{ "disable-region", { cmd_disable_region } },
 	{ "enable-dimm", { cmd_enable_dimm } },
Signature · 6 lines
2.20.1

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