@@ -1146,6 +1146,19 @@ static int __ndctl_bus_get_scrub_state(struct ndctl_bus *bus,
}
}
+NDCTL_EXPORT int ndctl_bus_start_scrub(struct ndctl_bus *bus)
+{
+ struct ndctl_ctx *ctx = ndctl_bus_get_ctx(bus);
+ int rc;
+
+ rc = sysfs_write_attr(ctx, bus->scrub_path, "1\n");
+ if (rc == -EBUSY)
+ return rc;
+ else if (rc < 0)
+ return -EOPNOTSUPP;
+ return 0;
+}
+
NDCTL_EXPORT int ndctl_bus_get_scrub_state(struct ndctl_bus *bus)
{
unsigned int scrub_count = 0;
@@ -353,4 +353,5 @@ global:
ndctl_region_get_persistence_domain;
ndctl_bus_get_persistence_domain;
ndctl_bus_get_scrub_state;
+ ndctl_bus_start_scrub;
} LIBNDCTL_14;
@@ -122,6 +122,7 @@ int ndctl_bus_wait_probe(struct ndctl_bus *bus);
int ndctl_bus_wait_for_scrub_completion(struct ndctl_bus *bus);
unsigned int ndctl_bus_get_scrub_count(struct ndctl_bus *bus);
int ndctl_bus_get_scrub_state(struct ndctl_bus *bus);
+int ndctl_bus_start_scrub(struct ndctl_bus *bus);
int ndctl_bus_has_error_injection(struct ndctl_bus *bus);
struct ndctl_dimm;
Provide a helper routine to kick off a new ARS scrub if one is not already running, or otherwise detect if ARS functionality is available. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/lib/libndctl.c | 13 +++++++++++++ ndctl/lib/libndctl.sym | 1 + ndctl/libndctl.h | 1 + 3 files changed, 15 insertions(+)