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 _begin_fstest growfs ioctl prealloc auto stress
12 # Import common functions.
18 _scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
22 if ! _try_scratch_mount 2>/dev/null
24 echo "failed to mount $SCRATCH_DEV"
28 # fix the reserve block pool to a known size so that the enospc
29 # calculations work out correctly.
30 _scratch_resvblks 1024 > /dev/null 2>&1
35 $XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
42 # -w ensures that the only ops are ones which cause write I/O
43 FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
44 -n $nops $FSSTRESS_AVOID`
45 $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
48 # real QA test starts here
51 _require_xfs_io_command "falloc"
53 _scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
54 . $tmp.mkfs # extract blocksize and data size for scratch device
56 endsize=`expr 550 \* 1048576` # stop after growing this big
57 incsize=`expr 42 \* 1048576` # grow in chunks of this size
58 modsize=`expr 4 \* $incsize` # pause after this many increments
60 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
63 size=`expr 125 \* 1048576` # 120 megabytes initially
64 sizeb=`expr $size / $dbsize` # in data blocks
65 echo "*** creating scratch filesystem"
66 logblks=$(_scratch_find_xfs_min_logblocks -dsize=${size} -dagcount=${nags})
67 _create_scratch -lsize=${logblks}b -dsize=${size} -dagcount=${nags}
69 echo "*** using some initial space on scratch filesystem"
70 for i in `seq 125 -1 90`; do
71 fillsize=`expr $i \* 1048576`
72 out="$(_fill_scratch $fillsize 2>&1)"
73 echo "$out" | grep -q 'No space left on device' && continue
74 test -n "${out}" && echo "$out"
79 # Grow the filesystem while actively stressing it...
80 # Kick off more stress threads on each iteration, grow; repeat.
82 while [ $size -le $endsize ]; do
83 echo "*** stressing filesystem"
84 echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
87 size=`expr $size + $incsize`
88 sizeb=`expr $size / $dbsize` # in data blocks
89 echo "*** growing filesystem"
90 echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
91 xfs_growfs -D ${sizeb} $SCRATCH_MNT \
92 | tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
94 [ `expr $size % $modsize` -eq 0 ] && wait # every 4th iteration
95 echo AGCOUNT=$agcount | tee -a $seqres.full
96 echo && echo >> $seqres.full
98 wait # stop for any remaining stress processes