From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/3] xfs_scrub: implement background mode for phase 6
Date: Thu, 05 Sep 2019 20:40:39 -0700 [thread overview]
Message-ID: <156774123948.2646704.14264815195950334701.stgit@magnolia> (raw)
In-Reply-To: <156774123336.2646704.1827381294403838403.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. 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>
---
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 834571a7..414d25a6 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)
@@ -84,7 +96,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));
@@ -92,7 +104,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);
@@ -177,7 +189,7 @@ read_verify(
if (rvp->errors_seen)
return;
- io_max_size = RVP_IO_MAX_SIZE;
+ io_max_size = rvp_io_max_size();
while (rv->io_length > 0) {
io_error = 0;
@@ -253,6 +265,7 @@ read_verify(
verified += sz;
rv->io_start += sz;
rv->io_length -= sz;
+ background_sleep();
}
free(rv);
next prev parent reply other threads:[~2019-09-06 3:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 3:40 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-09-06 3:40 ` Darrick J. Wong [this message]
2019-09-12 23:42 ` [PATCH 1/3] xfs_scrub: implement background mode for phase 6 Allison Collins
2019-09-06 3:40 ` [PATCH 2/3] xfs_scrub: perform media scans of entire devices Darrick J. Wong
2019-09-12 23:42 ` Allison Collins
2019-09-06 3:40 ` [PATCH 3/3] xfs_scrub: relabel verified data block counts in output Darrick J. Wong
2019-09-12 23:42 ` Allison Collins
-- strict thread matches above, loose matches on Subject: below --
2019-10-22 18:49 [PATCH 0/3] xfs_scrub: media scan entire disks Darrick J. Wong
2019-10-22 18:50 ` [PATCH 1/3] xfs_scrub: implement background mode for phase 6 Darrick J. Wong
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-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=156774123948.2646704.14264815195950334701.stgit@magnolia \
--to=darrick.wong@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 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).