All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org,
	Allison Collins <allison.henderson@oracle.com>
Subject: [PATCH 1/3] xfs_scrub: implement background mode for phase 6
Date: Tue, 22 Oct 2019 11:50:04 -0700	[thread overview]
Message-ID: <157177020437.1460684.1573285913657154325.stgit@magnolia> (raw)
In-Reply-To: <157177019803.1460684.3524666107607426492.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Phase 6 doesn't implement background mode, which means that it doesn't
run in single-threaded mode with one -b and it doesn't sleep between
calls with multiple -b like every other phase does.  It also doesn't
restrict the amount of work per kernel call, which is a key part of
throttling.  Wire up the necessary pieces to make it behave like the man
page says it should.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
---
 scrub/read_verify.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)


diff --git a/scrub/read_verify.c b/scrub/read_verify.c
index a963a3fd..82605c8c 100644
--- a/scrub/read_verify.c
+++ b/scrub/read_verify.c
@@ -32,7 +32,19 @@
  * because that's the biggest SCSI VERIFY(16) we dare to send.
  */
 #define RVP_IO_MAX_SIZE		(33554432)
-#define RVP_IO_MAX_SECTORS	(RVP_IO_MAX_SIZE >> BBSHIFT)
+
+/*
+ * If we're running in the background then we perform IO in 128k chunks
+ * to reduce the load on the IO subsystem.
+ */
+#define RVP_BACKGROUND_IO_MAX_SIZE	(131072)
+
+/* What's the real maximum IO size? */
+static inline unsigned int
+rvp_io_max_size(void)
+{
+	return bg_mode > 0 ? RVP_BACKGROUND_IO_MAX_SIZE : RVP_IO_MAX_SIZE;
+}
 
 /* Tolerate 64k holes in adjacent read verify requests. */
 #define RVP_IO_BATCH_LOCALITY	(65536)
@@ -89,7 +101,7 @@ read_verify_pool_alloc(
 	 */
 	if (miniosz % disk->d_lbasize)
 		return EINVAL;
-	if (RVP_IO_MAX_SIZE % miniosz)
+	if (rvp_io_max_size() % miniosz)
 		return EINVAL;
 
 	rvp = calloc(1, sizeof(struct read_verify_pool));
@@ -97,7 +109,7 @@ read_verify_pool_alloc(
 		return errno;
 
 	ret = posix_memalign((void **)&rvp->readbuf, page_size,
-			RVP_IO_MAX_SIZE);
+			rvp_io_max_size());
 	if (ret)
 		goto out_free;
 	ret = ptcounter_alloc(verifier_threads, &rvp->verified_bytes);
@@ -181,7 +193,7 @@ read_verify(
 	if (rvp->runtime_error)
 		return;
 
-	io_max_size = RVP_IO_MAX_SIZE;
+	io_max_size = rvp_io_max_size();
 
 	while (rv->io_length > 0) {
 		read_error = 0;
@@ -257,6 +269,7 @@ read_verify(
 			verified += sz;
 		rv->io_start += sz;
 		rv->io_length -= sz;
+		background_sleep();
 	}
 
 	free(rv);


  reply	other threads:[~2019-10-22 18:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 18:49 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-10-22 18:50 ` Darrick J. Wong [this message]
2019-10-22 18:50 ` [PATCH 2/3] xfs_scrub: perform media scans of entire devices Darrick J. Wong
2019-11-06 20:15   ` Eric Sandeen
2019-11-06 20:22     ` Darrick J. Wong
2019-10-22 18:50 ` [PATCH 3/3] xfs_scrub: relabel verified data block counts in output Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2019-09-25 21:37 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-09-25 21:37 ` [PATCH 1/3] xfs_scrub: implement background mode for phase 6 Darrick J. Wong
2019-09-06  3:40 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-09-06  3:40 ` [PATCH 1/3] xfs_scrub: implement background mode for phase 6 Darrick J. Wong
2019-09-12 23:42   ` Allison Collins
2019-08-26 21:32 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-08-26 21:32 ` [PATCH 1/3] xfs_scrub: implement background mode for phase 6 Darrick J. Wong

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=157177020437.1460684.1573285913657154325.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.