xfs/004: don't fail test due to realtime files
[xfstests-dev.git] / tests / xfs / 104
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 104
6 #
7 # XFS online growfs-while-allocating tests (data subvol variant)
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 _create_scratch()
23 {
24         echo "*** mkfs"
25         _scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
26         . $tmp.mkfs
27
28         echo "*** mount"
29         if ! _try_scratch_mount 2>/dev/null
30         then
31                 echo "failed to mount $SCRATCH_DEV"
32                 exit 1
33         fi
34
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
38 }
39
40 _fill_scratch()
41 {
42         $XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
43 }
44
45 _stress_scratch()
46 {
47         procs=3
48         nops=1000
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 &
53 }
54
55 # real QA test starts here
56 _supported_fs xfs
57 _require_scratch
58 _require_xfs_io_command "falloc"
59
60 rm -f $seqres.full
61 _scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
62 . $tmp.mkfs     # extract blocksize and data size for scratch device
63
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
67
68 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
69
70 nags=4
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}
76
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"
83         break
84 done
85
86 #
87 # Grow the filesystem while actively stressing it...
88 # Kick off more stress threads on each iteration, grow; repeat.
89 #
90 while [ $size -le $endsize ]; do
91         echo "*** stressing filesystem"
92         echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
93         _stress_scratch
94         sleep 1
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
101         . $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
105 done
106 wait    # stop for any remaining stress processes
107
108 _scratch_unmount
109
110 status=0
111 exit