nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 3/5] ndctl, scrub: add ndctl_bus_start_scrub()
Date: Wed, 04 Apr 2018 14:12:11 -0700	[thread overview]
Message-ID: <152287633188.29230.414462016357911772.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <152287631592.29230.11531789298631204393.stgit@dwillia2-desk3.amr.corp.intel.com>

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(+)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index ff0d44ffefe6..21dd7207ea5e 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -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;
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index 06cace96724f..fd8f37d1783e 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -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;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index 36c04d871bd5..e690f9483fbf 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -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;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2018-04-04 21:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 21:11 [ndctl PATCH 0/5] Address Range Scrub (ARS) Utilities Dan Williams
2018-04-04 21:12 ` [ndctl PATCH 1/5] ndctl, scrub: fix ndctl_bus_wait_for_scrub_completion() Dan Williams
2018-04-04 21:12 ` [ndctl PATCH 2/5] ndctl, scrub: report the bus scrub state in 'ndctl list' Dan Williams
2018-04-04 21:12 ` Dan Williams [this message]
2018-04-04 21:12 ` [ndctl PATCH 4/5] ndctl: add new START and WAIT actions Dan Williams
2018-04-04 21:12 ` [ndctl PATCH 5/5] ndctl, scrub: add {wait, start}-scrub helper utilities Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152287633188.29230.414462016357911772.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).