fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] fstests: log-writes: Add new discard check point
Date: Tue, 22 Oct 2019 15:58:05 +0800	[thread overview]
Message-ID: <20191022075806.16616-2-wqu@suse.com> (raw)
In-Reply-To: <20191022075806.16616-1-wqu@suse.com>

Despite the existing <number>|fua|flush checkpoint, add a new discard
check point to make sure discard is not screwing up things.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 src/log-writes/replay-log.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/log-writes/replay-log.c b/src/log-writes/replay-log.c
index 829b18e2..968c82ab 100644
--- a/src/log-writes/replay-log.c
+++ b/src/log-writes/replay-log.c
@@ -64,8 +64,8 @@ static void usage(void)
 	fprintf(stderr, "\t--no-discard - don't process discard entries\n");
 	fprintf(stderr, "\t--fsck - the fsck command to run, must specify "
 		"--check\n");
-	fprintf(stderr, "\t--check [<number>|flush|fua] when to check the "
-		"file system, mush specify --fsck\n");
+	fprintf(stderr, "\t--check [<number>|flush|fua|discard] when to check "
+		"the file system, mush specify --fsck\n");
 	fprintf(stderr, "\t--start-sector <sector> - replay ops on region "
 		"from <sector> onto <device>\n");
 	fprintf(stderr, "\t--end-sector <sector> - replay ops on region "
@@ -115,6 +115,7 @@ enum log_replay_check_mode {
 	CHECK_NUMBER = 1,
 	CHECK_FUA = 2,
 	CHECK_FLUSH = 3,
+	CHECK_DISCARD = 4,
 };
 
 static int seek_to_mark(struct log *log, struct log_write_entry *entry,
@@ -253,6 +254,8 @@ int main(int argc, char **argv)
 				check_mode = CHECK_FLUSH;
 			} else if (!strcmp(optarg, "fua")) {
 				check_mode = CHECK_FUA;
+			} else if (!strcmp(optarg, "discard")) {
+				check_mode = CHECK_DISCARD;
 			} else {
 				check_mode = CHECK_NUMBER;
 				check_number = strtoull(optarg, &tmp, 0);
@@ -369,6 +372,9 @@ int main(int argc, char **argv)
 			else if ((check_mode == CHECK_FLUSH) &&
 				 should_stop(entry, LOG_FLUSH_FLAG, NULL))
 				ret = run_fsck(log, fsck_command);
+			else if ((check_mode == CHECK_DISCARD) &&
+				 should_stop(entry, LOG_DISCARD_FLAG, NULL))
+				ret = run_fsck(log, fsck_command);
 			else
 				ret = 0;
 			if (ret) {
-- 
2.23.0


  reply	other threads:[~2019-10-22  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  7:58 [PATCH 0/2] btrfs: dm-log-writes test for fstrim with fsstress Qu Wenruo
2019-10-22  7:58 ` Qu Wenruo [this message]
2019-10-22  7:58 ` [PATCH 2/2] fstests: btrfs: dm-logwrites test for fstrim and fsstress workload Qu Wenruo
2019-10-22  9:09   ` Amir Goldstein
2019-10-22  9:16     ` Qu Wenruo

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=20191022075806.16616-2-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.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).