fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com, djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 12/12] common/fuzzy: adapt the scrub stress tests to support rtgroups
Date: Fri, 30 Dec 2022 14:20:41 -0800	[thread overview]
Message-ID: <167243884102.739029.3905413777900442709.stgit@magnolia> (raw)
In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Adapt the scrub stress testing framework to support checking realtime
group metadata.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/fuzzy  |   27 ++++++++++++++++++++++-----
 common/xfs    |    9 +++++++++
 tests/xfs/800 |    2 +-
 tests/xfs/840 |    2 +-
 tests/xfs/841 |    2 +-
 5 files changed, 34 insertions(+), 8 deletions(-)


diff --git a/common/fuzzy b/common/fuzzy
index 7f96384402..baba05de0a 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -817,8 +817,10 @@ __stress_one_scrub_loop() {
 	local scrub_tgt="$3"
 	local scrub_startat="$4"
 	local start_agno="$5"
-	shift; shift; shift; shift; shift
+	local start_rgno="$6"
+	shift; shift; shift; shift; shift; shift
 	local agcount="$(_xfs_mount_agcount $SCRATCH_MNT)"
+	local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)"
 
 	local xfs_io_args=()
 	for arg in "$@"; do
@@ -831,6 +833,12 @@ __stress_one_scrub_loop() {
 				local ag_arg="$(echo "$arg" | sed -e "s|%agno%|$agno|g")"
 				xfs_io_args+=('-c' "$ag_arg")
 			done
+		elif echo "$arg" | grep -q -w '%rgno%'; then
+			# Substitute the rtgroup number
+			for ((rgno = start_rgno; rgno < rgcount; rgno++)); do
+				local rg_arg="$(echo "$arg" | sed -e "s|%rgno%|$rgno|g")"
+				xfs_io_args+=('-c' "$rg_arg")
+			done
 		else
 			xfs_io_args+=('-c' "$arg")
 		fi
@@ -1201,7 +1209,9 @@ _scratch_xfs_stress_scrub_cleanup() {
 __stress_scrub_check_commands() {
 	local scrub_tgt="$1"
 	local start_agno="$2"
-	shift; shift
+	local start_rgno="$3"
+	shift; shift; shift
+	local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)"
 
 	local cooked_tgt="$scrub_tgt"
 	case "$scrub_tgt" in
@@ -1231,6 +1241,10 @@ __stress_scrub_check_commands() {
 			cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')"
 		fi
 		cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/$start_agno/g")"
+		if echo "$cooked_arg" | grep -q -w '%rgno%'; then
+			test "$rgcount" -eq 0 && continue
+			cooked_arg="$(echo "$cooked_arg" | sed -e "s/%rgno%/$start_rgno/g")"
+		fi
 		testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1`
 		echo $testio | grep -q "Unknown type" && \
 			_notrun "xfs_io scrub subcommand support is missing"
@@ -1256,6 +1270,7 @@ __stress_scrub_check_commands() {
 #	in a separate loop.  If zero -i options are specified, do not run.
 #	Callers must check each of these commands (via _require_xfs_io_command)
 #	before calling here.
+# -R	For %rgno% substitution, start with this rtgroup instead of rtgroup 0.
 # -r	Run fsstress for this amount of time, then remount the fs ro or rw.
 #	The default is to run fsstress continuously with no remount, unless
 #	XFS_SCRUB_STRESS_REMOUNT_PERIOD is set.
@@ -1301,6 +1316,7 @@ _scratch_xfs_stress_scrub() {
 	local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}"
 	local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}"
 	local start_agno=0
+	local start_rgno=0
 
 	__SCRUB_STRESS_FREEZE_PID=""
 	__SCRUB_STRESS_REMOUNT_LOOP=""
@@ -1308,12 +1324,13 @@ _scratch_xfs_stress_scrub() {
 	touch "$runningfile"
 
 	OPTIND=1
-	while getopts "a:fi:r:s:S:t:w:x:X:" c; do
+	while getopts "a:fi:r:R:s:S:t:w:x:X:" c; do
 		case "$c" in
 			a) start_agno="$OPTARG";;
 			f) freeze=yes;;
 			i) io_args+=("$OPTARG");;
 			r) remount_period="$OPTARG";;
+			R) start_rgno="$OPTARG";;
 			s) one_scrub_args+=("$OPTARG");;
 			S) xfs_scrub_args+=("$OPTARG");;
 			t) scrub_tgt="$OPTARG";;
@@ -1324,7 +1341,7 @@ _scratch_xfs_stress_scrub() {
 		esac
 	done
 
-	__stress_scrub_check_commands "$scrub_tgt" "$start_agno" \
+	__stress_scrub_check_commands "$scrub_tgt" "$start_agno" "$start_rgno" \
 			"${one_scrub_args[@]}"
 
 	if ! command -v "__stress_scrub_${exerciser}_loop" &>/dev/null; then
@@ -1372,7 +1389,7 @@ _scratch_xfs_stress_scrub() {
 
 	if [ "${#one_scrub_args[@]}" -gt 0 ]; then
 		__stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \
-				"$scrub_startat" "$start_agno" \
+				"$scrub_startat" "$start_agno" "$start_rgno" \
 				"${one_scrub_args[@]}" &
 	fi
 
diff --git a/common/xfs b/common/xfs
index a37284068f..f451dfb8ae 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1524,6 +1524,15 @@ _xfs_mount_agcount()
 	$XFS_INFO_PROG "$1" | sed -n "s/^.*agcount=\([[:digit:]]*\).*/\1/p"
 }
 
+# Find rtgroup count of mounted filesystem
+_xfs_mount_rgcount()
+{
+	local rtgroups="$($XFS_INFO_PROG "$1" | grep rgcount= | sed -e 's/^.*rgcount=\([0-9]*\).*$/\1/g')"
+
+	test -z "$rtgroups" && rtgroups=0
+	echo "$rtgroups"
+}
+
 # Wipe the superblock of each XFS AGs
 _try_wipe_scratch_xfs()
 {
diff --git a/tests/xfs/800 b/tests/xfs/800
index cbcfb5f5a6..a2542be5ec 100755
--- a/tests/xfs/800
+++ b/tests/xfs/800
@@ -32,7 +32,7 @@ _require_xfs_stress_scrub
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount
 _require_xfs_has_feature "$SCRATCH_MNT" realtime
-_scratch_xfs_stress_scrub -s "scrub rtbitmap"
+_scratch_xfs_stress_scrub -s "scrub rtbitmap"  -s "scrub rgbitmap %rgno%"
 
 # success, all done
 echo Silence is golden
diff --git a/tests/xfs/840 b/tests/xfs/840
index fff41c5b8a..b9ed0a55b3 100755
--- a/tests/xfs/840
+++ b/tests/xfs/840
@@ -39,7 +39,7 @@ alloc_unit=$(_get_file_block_size $SCRATCH_MNT)
 scratchfile=$SCRATCH_MNT/file
 touch $scratchfile
 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
-__stress_scrub_check_commands "$scratchfile" "" 'repair bmapbtd'
+__stress_scrub_check_commands "$scratchfile" "" "" 'repair bmapbtd'
 
 # Compute the number of extent records needed to guarantee btree format,
 # assuming 16 bytes for each ondisk extent record
diff --git a/tests/xfs/841 b/tests/xfs/841
index f743454971..5831961f5f 100755
--- a/tests/xfs/841
+++ b/tests/xfs/841
@@ -39,7 +39,7 @@ scratchfile=$SCRATCH_MNT/file
 mkdir $scratchdir
 touch $scratchfile
 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
-__stress_scrub_check_commands "$scratchdir" "" 'repair directory'
+__stress_scrub_check_commands "$scratchdir" "" "" 'repair directory'
 
 # Create a 2-dirblock directory
 total_size=$((alloc_unit * 2))


  parent reply	other threads:[~2022-12-31  3:12 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 21:14 [NYE DELUGE 3/4] xfs: modernize the realtime volume Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET 0/1] fstests: test upgrading older features Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/1] xfs: test upgrading old features Darrick J. Wong
2023-03-06 15:56     ` Zorro Lang
2023-03-06 16:41       ` Darrick J. Wong
2023-03-06 16:54         ` Zorro Lang
2023-03-06 23:14           ` Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 0/9] fstests: test XFS metadata directories Darrick J. Wong
2022-12-30 22:20   ` [PATCH 3/9] xfs/{030,033,178}: forcibly disable metadata directory trees Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/9] xfs/122: fix metadirino Darrick J. Wong
2022-12-30 22:20   ` [PATCH 2/9] various: fix finding metadata inode numbers when metadir is enabled Darrick J. Wong
2023-03-06 16:41     ` Zorro Lang
2022-12-30 22:20   ` [PATCH 4/9] common/repair: patch up repair sb inode value complaints Darrick J. Wong
2022-12-30 22:20   ` [PATCH 6/9] xfs/{050,144,153,299,330}: update quota reports to leave out metadir files Darrick J. Wong
2022-12-30 22:20   ` [PATCH 9/9] xfs: create fuzz tests for metadata directories Darrick J. Wong
2022-12-30 22:20   ` [PATCH 7/9] xfs/769: add metadir upgrade to test matrix Darrick J. Wong
2022-12-30 22:20   ` [PATCH 5/9] xfs/206: update for metadata directory support Darrick J. Wong
2022-12-30 22:20   ` [PATCH 8/9] xfs/509: adjust inumbers accounting for metadata directories Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 0/4] fstests: support metadump to external devices Darrick J. Wong
2022-12-30 22:20   ` [PATCH 3/4] common/ext4: reformat external logs during mdrestore operations Darrick J. Wong
2022-12-30 22:20   ` [PATCH 2/4] common/xfs: wipe " Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/4] common/populate: refactor caching of metadumps to a helper Darrick J. Wong
2022-12-30 22:20   ` [PATCH 4/4] common/xfs: capture external logs during metadump/mdrestore Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 00/12] xfsprogs: shard the realtime section Darrick J. Wong
2022-12-30 22:20   ` [PATCH 03/12] xfs/206: update mkfs filtering for rt groups feature Darrick J. Wong
2022-12-30 22:20   ` [PATCH 01/12] xfs/122: update for rtgroups Darrick J. Wong
2022-12-30 22:20   ` [PATCH 02/12] punch-alternating: detect xfs realtime files with large allocation units Darrick J. Wong
2022-12-30 22:20   ` [PATCH 10/12] xfs/27[46],xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands Darrick J. Wong
2022-12-30 22:20   ` [PATCH 07/12] xfs/449: update test to know about xfs_db -R Darrick J. Wong
2022-12-30 22:20   ` [PATCH 11/12] common/xfs: capture realtime devices during metadump/mdrestore Darrick J. Wong
2022-12-30 22:20   ` [PATCH 05/12] common: filter rtgroups when we're disabling metadir Darrick J. Wong
2022-12-30 22:20   ` [PATCH 08/12] xfs/122: update for rtbitmap headers Darrick J. Wong
2022-12-30 22:20   ` [PATCH 06/12] xfs/185: update for rtgroups Darrick J. Wong
2022-12-30 22:20   ` [PATCH 04/12] common: pass the realtime device to xfs_db when possible Darrick J. Wong
2022-12-30 22:20   ` [PATCH 09/12] xfs/122: udpate test to pick up rtword/suminfo ondisk unions Darrick J. Wong
2022-12-30 22:20   ` Darrick J. Wong [this message]
2022-12-30 22:20 ` [PATCHSET v1.0 00/13] fstests: fixes for realtime rmap Darrick J. Wong
2022-12-30 22:20   ` [PATCH 03/13] xfs: race fsstress with realtime rmap btree scrub and repair Darrick J. Wong
2022-12-30 22:20   ` [PATCH 04/13] xfs/769: add rtrmapbt upgrade to test matrix Darrick J. Wong
2022-12-30 22:20   ` [PATCH 05/13] xfs/122: update for rtgroups-based realtime rmap btrees Darrick J. Wong
2022-12-30 22:20   ` [PATCH 07/13] xfs/341: update test for rtgroup-based rmap Darrick J. Wong
2022-12-30 22:20   ` [PATCH 06/13] xfs: fix various problems with fsmap detecting the data device Darrick J. Wong
2022-12-30 22:20   ` [PATCH 01/13] xfs: fix tests that try to access the realtime rmap inode Darrick J. Wong
2022-12-30 22:20   ` [PATCH 02/13] fuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file Darrick J. Wong
2022-12-30 22:20   ` [PATCH 09/13] xfs: skip tests if formatting small filesystem fails Darrick J. Wong
2022-12-30 22:20   ` [PATCH 10/13] xfs/443: use file allocation unit, not dbsize Darrick J. Wong
2022-12-30 22:20   ` [PATCH 12/13] populate: check that we created a realtime rmap btree of the given height Darrick J. Wong
2022-12-30 22:20   ` [PATCH 13/13] fuzzy: create missing fuzz tests for rt rmap btrees Darrick J. Wong
2022-12-30 22:20   ` [PATCH 11/13] populate: adjust rtrmap calculations for rtgroups Darrick J. Wong
2022-12-30 22:20   ` [PATCH 08/13] xfs/3{43,32}: adapt tests for rt extent size greater than 1 Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 00/10] fstests: reflink on the realtime device Darrick J. Wong
2022-12-30 22:20   ` [PATCH 01/10] xfs/122: update fields for realtime reflink Darrick J. Wong
2022-12-30 22:20   ` [PATCH 02/10] common/populate: create realtime refcount btree Darrick J. Wong
2022-12-30 22:20   ` [PATCH 03/10] xfs: create fuzz tests for the " Darrick J. Wong
2022-12-30 22:20   ` [PATCH 06/10] xfs: race fsstress with realtime refcount btree scrub and repair Darrick J. Wong
2022-12-30 22:20   ` [PATCH 09/10] generic/331,xfs/240: support files that skip delayed allocation Darrick J. Wong
2022-12-30 22:20   ` [PATCH 05/10] xfs/243: don't run when realtime storage is the default Darrick J. Wong
2022-12-30 22:20   ` [PATCH 04/10] xfs/27[24]: adapt for checking files on the realtime volume Darrick J. Wong
2022-12-30 22:20   ` [PATCH 08/10] xfs/769: add rtreflink upgrade to test matrix Darrick J. Wong
2022-12-30 22:20   ` [PATCH 10/10] common/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section Darrick J. Wong
2022-12-30 22:20   ` [PATCH 07/10] xfs: remove xfs/131 now that we allow reflink on realtime volumes Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 0/4] fstests: reflink with large realtime extents Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/4] xfs: make sure that CoW will write around when rextsize > 1 Darrick J. Wong
2022-12-30 22:20   ` [PATCH 2/4] xfs: skip cowextsize hint fragmentation tests on realtime volumes Darrick J. Wong
2022-12-30 22:20   ` [PATCH 4/4] generic/303: avoid test failures on weird rt extent sizes Darrick J. Wong
2022-12-30 22:20   ` [PATCH 3/4] misc: add more congruent oplen testing Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v1.0 0/1] fstests: functional tests for rt quota Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/1] xfs: regression testing of quota on the realtime device 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=167243884102.739029.3905413777900442709.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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).