]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fuzzy: stress data and rt sections of xfs filesystems equally
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 23 Jan 2025 21:19:55 +0000 (13:19 -0800)
If we're stress-testing scrub on a realtime filesystem, make sure that
we run fsstress on separate directory trees for data and realtime
workouts.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
common/fuzzy

index 81a50fe338792a65a0b08879bda285359225c6e9..82abcdd3bbc7e4606530e1c17309fe979ce9b891 100644 (file)
@@ -1018,15 +1018,28 @@ __stress_scrub_fsx_loop() {
        rm -f "$runningfile"
 }
 
+# Run fsstress and record outcome
+__run_fsstress() {
+       _run_fsstress $*
+       local res=$?
+       echo "fsstress $* exits with $res at $(date)" >> $seqres.full
+       test "$res" -ne 0 && touch "$tmp.killstress"
+}
+
 # Run fsstress while we're testing online fsck.
 __stress_scrub_fsstress_loop() {
        local end="$1"
        local runningfile="$2"
        local remount_period="$3"
        local stress_tgt="$4"
-       local focus=()
-       local res
+       local focus=(-p 4 -n 2000000)
+       local res res2
        local duration
+       local has_rt
+       local d_args r_args
+
+       test $FSTYP = "xfs" && _xfs_has_feature "$SCRATCH_MNT" realtime && \
+               has_rt=1
 
        case "$stress_tgt" in
        "parent")
@@ -1118,9 +1131,21 @@ __stress_scrub_fsstress_loop() {
 
        # As of March 2022, 2 million fsstress ops should be enough to keep
        # any filesystem busy for a couple of hours.
-       local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}")
-       echo "Running $FSSTRESS_PROG $args" >> $seqres.full
+       if [ -n "$has_rt" ]; then
+               mkdir -p $SCRATCH_MNT/rt $SCRATCH_MNT/data
+               $XFS_IO_PROG -c 'chattr +rt' $SCRATCH_MNT/rt
+               $XFS_IO_PROG -c 'chattr -rt' $SCRATCH_MNT/data
+
+               r_args=$(_scale_fsstress_args -d $SCRATCH_MNT/rt "${focus[@]}")
+               d_args=$(_scale_fsstress_args -d $SCRATCH_MNT/data "${focus[@]}")
+               echo "Running $FSSTRESS_PROG $d_args" >> $seqres.full
+               echo "Running $FSSTRESS_PROG $r_args" >> $seqres.full
+       else
+               d_args=$(_scale_fsstress_args -d $SCRATCH_MNT "${focus[@]}")
+               echo "Running $FSSTRESS_PROG $d_args" >> $seqres.full
+       fi
 
+       rm -f "$tmp.killstress"
        if [ -n "$remount_period" ]; then
                local mode="rw"
                local rw_arg=""
@@ -1130,12 +1155,10 @@ __stress_scrub_fsstress_loop() {
                        test "$mode" = "rw" && __stress_scrub_clean_scratch && continue
 
                        duration=$(___stress_scrub_duration "$end" "$remount_period")
-                       _run_fsstress_bg $duration $args $rw_arg >> $seqres.full
-                       sleep $remount_period
-                       _kill_fsstress
-                       res=$?
-                       echo "$mode fsstress exits with $res at $(date)" >> $seqres.full
-                       [ "$res" -ne 0 ] && break;
+                       __run_fsstress $duration $d_args $rw_arg &
+                       test -n "$has_rt" && __run_fsstress $duration $r_args $rw_arg &
+                       wait
+                       test -e "$tmp.killstress" && break
 
                        if [ "$mode" = "rw" ]; then
                                mode="ro"
@@ -1151,7 +1174,7 @@ __stress_scrub_fsstress_loop() {
                                sleep 0.2
                        done
                done
-               rm -f "$runningfile"
+               rm -f "$runningfile" "$tmp.killstress"
                return 0
        fi
 
@@ -1159,12 +1182,12 @@ __stress_scrub_fsstress_loop() {
                # Need to recheck running conditions if we cleared anything
                __stress_scrub_clean_scratch && continue
                duration=$(___stress_scrub_duration "$end" "$remount_period")
-               _run_fsstress $duration $args >> $seqres.full
-               res=$?
-               echo "$mode fsstress exits with $res at $(date)" >> $seqres.full
-               [ "$res" -ne 0 ] && break;
+               __run_fsstress $duration $d_args &
+               test -n "$has_rt" && __run_fsstress $duration $r_args &
+               wait
+               test -e "$tmp.killstress" && break
        done
-       rm -f "$runningfile"
+       rm -f "$runningfile" "$tmp.killstress"
 }
 
 # Make sure we have everything we need to run stress and scrub