]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs: fix fuzz tests of rtgroups bitmap and summary files
authorDarrick J. Wong <djwong@kernel.org>
Tue, 13 Aug 2024 17:22:27 +0000 (10:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 1 Nov 2024 20:41:58 +0000 (13:41 -0700)
With rtgroups, the rt bitmap and summary files are now per-group, so
adjust the fuzz and fsck tests to find the new locations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
12 files changed:
common/xfs
tests/xfs/581
tests/xfs/582
tests/xfs/739
tests/xfs/740
tests/xfs/741
tests/xfs/742
tests/xfs/743
tests/xfs/744
tests/xfs/745
tests/xfs/746
tests/xfs/793

index 3bb0ba43cf9221ee86dae2341f20dfb25c4d29d2..a3356ad775a2dd357cae2a765cd99302bd7193d9 100644 (file)
@@ -1937,6 +1937,25 @@ _scratch_xfs_find_metafile()
        local metafile="$1"
        local sb_field
 
+       # With metadir=1, the realtime volume is sharded into allocation
+       # groups.  Each rtgroup has its own bitmap and summary file.  Tests
+       # should pick a particular file, but this compatibility shim still
+       # exists to keep old tests working.
+       case "$metafile" in
+       "rbmino")
+               if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+                       echo "path -m /rtgroups/0.bitmap"
+                       return 0
+               fi
+               ;;
+       "rsumino")
+               if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+                       echo "path -m /rtgroups/0.summary"
+                       return 0
+               fi
+               ;;
+       esac
+
        sb_field="$(_scratch_xfs_get_sb_field "$metafile")"
        if echo "$sb_field" | grep -q -w 'not found'; then
                return 1
index 3af9ef8a19c0bb21fd4daf2987a134a2efb69943..1bac2d5b6739a044e0df9b74565eca822fef2aad 100755 (executable)
@@ -30,7 +30,14 @@ _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"  -s "scrub rgbitmap %rgno%"
+
+if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then
+       _scratch_xfs_stress_scrub -s "scrub rtbitmap %rgno%"
+elif xfs_io -c 'help scrub' | grep -q rgsuper; then
+       _scratch_xfs_stress_scrub -s "scrub rtbitmap 0"
+else
+       _scratch_xfs_stress_scrub -s "scrub rtbitmap"
+fi
 
 # success, all done
 echo Silence is golden
index f390b77f3439ee1e94edb19592055dd5156ff5f1..c949e14899788a81330d751416367fc4abc6ed92 100755 (executable)
@@ -31,13 +31,13 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount
 _require_xfs_has_feature "$SCRATCH_MNT" realtime
 
-# XXX the realtime summary scrubber isn't currently implemented upstream.
-# Don't bother trying to test it on those kernels
-$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \
-       grep -q 'Scan was not complete' && \
-       _notrun "rtsummary scrub is incomplete"
-
-_scratch_xfs_stress_scrub -s "scrub rtsummary"
+if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then
+       _scratch_xfs_stress_scrub -s "scrub rtsummary %rgno%"
+elif xfs_io -c 'help scrub' | grep -q rgsuper; then
+       _scratch_xfs_stress_scrub -s "scrub rtsummary 0"
+else
+       _scratch_xfs_stress_scrub -s "scrub rtsummary"
+fi
 
 # success, all done
 echo Silence is golden
index a143325e3facb67a8b004eb8fe87cdb10ee48be3..1fcae151f007d1efd397ea2d156af17941cba347 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtbitmap"
-path="$(_scratch_xfs_find_metafile rbmino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.bitmap"
+else
+       path="$(_scratch_xfs_find_metafile rbmino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtbitmap"
 
index e867d591fd99cb561cb749ee036324cfd364f18f..74c37312b088f1ce17d01110ba4dfca4dc244037 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtsummary"
-path="$(_scratch_xfs_find_metafile rsumino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.summary"
+else
+       path="$(_scratch_xfs_find_metafile rsumino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtsummary"
 
index ea4aa75b24741be25caf376b4f36a07061360c61..95b7c5f01646b523d35f24dc3bbe3ea629ff7336 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtbitmap"
-path="$(_scratch_xfs_find_metafile rbmino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.bitmap"
+else
+       path="$(_scratch_xfs_find_metafile rbmino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtbitmap"
 
index 967e384f659f7246262756a031a1727073b69a17..50dd387fae3456f7bca34325c74c60529d19d7e5 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtsummary"
-path="$(_scratch_xfs_find_metafile rsumino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.summary"
+else
+       path="$(_scratch_xfs_find_metafile rsumino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtsummary"
 
index 82b87b33792cdd4effbda109e894c97f5efdb343..c8129b76a87e33034ab6e0b97b87cf9b13eeb649 100755 (executable)
@@ -26,7 +26,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtbitmap"
-path="$(_scratch_xfs_find_metafile rbmino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.bitmap"
+else
+       path="$(_scratch_xfs_find_metafile rbmino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtbitmap"
 
index 4840e78c4427ab8794c7a24bfb620ce36fc9332a..9382676fbb270720ae3960dba8366c33836c05ed 100755 (executable)
@@ -26,7 +26,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtsummary"
-path="$(_scratch_xfs_find_metafile rsumino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.summary"
+else
+       path="$(_scratch_xfs_find_metafile rsumino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtsummary"
 
index 6cc3805d4c9df831182d673b77a6b4e01e14c1b7..be61f4bc463a183fb5a0885dd02c1633ba1debb9 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtbitmap"
-path="$(_scratch_xfs_find_metafile rbmino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.bitmap"
+else
+       path="$(_scratch_xfs_find_metafile rbmino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtbitmap"
 
index b6ec74524b0eaa84eca502ef74e06c4a8d891655..84600ab755a5aaa04da94b74c83d91d0f84fd80d 100755 (executable)
@@ -25,7 +25,11 @@ echo "Format and populate"
 _scratch_populate_cached nofill > $seqres.full 2>&1
 
 echo "Fuzz rtsummary"
-path="$(_scratch_xfs_find_metafile rsumino)"
+if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then
+       path="path -m /rtgroups/0.summary"
+else
+       path="$(_scratch_xfs_find_metafile rsumino)"
+fi
 _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full
 echo "Done fuzzing rtsummary"
 
index d942d9807967b5a9a85c1155354ebc9412ebd805..59080467e9060692eef1ad1f97ec80b9554ec9a6 100755 (executable)
@@ -32,13 +32,13 @@ _scratch_mount
 _require_xfs_has_feature "$SCRATCH_MNT" realtime
 _xfs_force_bdev realtime $SCRATCH_MNT
 
-# XXX the realtime summary scrubber isn't currently implemented upstream.
-# Don't bother trying to fix it on those kernels
-$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \
-       grep -q 'Scan was not complete' && \
-       _notrun "rtsummary scrub is incomplete"
-
-_scratch_xfs_stress_online_repair -s "repair rtsummary"
+if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then
+       _scratch_xfs_stress_online_repair -s "repair rtsummary %rgno%"
+elif xfs_io -c 'help scrub' | grep -q rgsuper; then
+       _scratch_xfs_stress_online_repair -s "repair rtsummary 0"
+else
+       _scratch_xfs_stress_online_repair -s "repair rtsummary"
+fi
 
 # success, all done
 echo Silence is golden