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
58 _require_xfs_io_command "falloc"
61 _scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
62 . $tmp.mkfs # extract blocksize and data size for scratch device
64 endsize=`expr 550 \* 1048576` # stop after growing this big
65 incsize=`expr 42 \* 1048576` # grow in chunks of this size
66 modsize=`expr 4 \* $incsize` # pause after this many increments
68 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
71 size=`expr 125 \* 1048576` # 120 megabytes initially
72 sizeb=`expr $size / $dbsize` # in data blocks
73 echo "*** creating scratch filesystem"
74 logblks=$(_scratch_find_xfs_min_logblocks -dsize=${size} -dagcount=${nags})
75 _create_scratch -lsize=${logblks}b -dsize=${size} -dagcount=${nags}
77 echo "*** using some initial space on scratch filesystem"
78 for i in `seq 125 -1 90`; do
79 fillsize=`expr $i \* 1048576`
80 out="$(_fill_scratch $fillsize 2>&1)"
81 echo "$out" | grep -q 'No space left on device' && continue
82 test -n "${out}" && echo "$out"
87 # Grow the filesystem while actively stressing it...
88 # Kick off more stress threads on each iteration, grow; repeat.
90 while [ $size -le $endsize ]; do
91 echo "*** stressing filesystem"
92 echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
95 size=`expr $size + $incsize`
96 sizeb=`expr $size / $dbsize` # in data blocks
97 echo "*** growing filesystem"
98 echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
99 xfs_growfs -D ${sizeb} $SCRATCH_MNT \
100 | tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
102 [ `expr $size % $modsize` -eq 0 ] && wait # every 4th iteration
103 echo AGCOUNT=$agcount | tee -a $seqres.full
104 echo && echo >> $seqres.full
106 wait # stop for any remaining stress processes