2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 # XFS online growfs-while-allocating tests (data subvol variant)
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
25 _scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
29 if ! _try_scratch_mount 2>/dev/null
31 echo "failed to mount $SCRATCH_DEV"
35 # fix the reserve block pool to a known size so that the enospc
36 # calculations work out correctly.
37 _scratch_resvblks 1024 > /dev/null 2>&1
42 $XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
49 # -w ensures that the only ops are ones which cause write I/O
50 FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
51 -n $nops $FSSTRESS_AVOID`
52 $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
55 # real QA test starts here
60 _scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
61 . $tmp.mkfs # extract blocksize and data size for scratch device
63 endsize=`expr 550 \* 1048576` # stop after growing this big
64 incsize=`expr 42 \* 1048576` # grow in chunks of this size
65 modsize=`expr 4 \* $incsize` # pause after this many increments
67 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
70 size=`expr 125 \* 1048576` # 120 megabytes initially
71 sizeb=`expr $size / $dbsize` # in data blocks
72 echo "*** creating scratch filesystem"
73 _create_scratch -lsize=10m -dsize=${size} -dagcount=${nags}
75 echo "*** using some initial space on scratch filesystem"
76 for i in `seq 125 -1 90`; do
77 fillsize=`expr $i \* 1048576`
78 out="$(_fill_scratch $fillsize 2>&1)"
79 echo "$out" | grep -q 'No space left on device' && continue
80 test -n "${out}" && echo "$out"
85 # Grow the filesystem while actively stressing it...
86 # Kick off more stress threads on each iteration, grow; repeat.
88 while [ $size -le $endsize ]; do
89 echo "*** stressing filesystem"
90 echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
93 size=`expr $size + $incsize`
94 sizeb=`expr $size / $dbsize` # in data blocks
95 echo "*** growing filesystem"
96 echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
97 xfs_growfs -D ${sizeb} $SCRATCH_MNT \
98 | tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
100 [ `expr $size % $modsize` -eq 0 ] && wait # every 4th iteration
101 echo AGCOUNT=$agcount | tee -a $seqres.full
102 echo && echo >> $seqres.full
104 wait # stop for any remaining stress processes