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
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
__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
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"
# 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.
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=""
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";;
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
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