xfstests: convert tests to use new results directory
[xfstests-dev.git] / tests / xfs / 104
1 #! /bin/bash
2 # FS QA Test No. 104
3 #
4 # XFS online growfs-while-allocating tests (data subvol variant)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39
40 _create_scratch()
41 {
42         echo "*** mkfs"
43         _scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
44         . $tmp.mkfs
45
46         echo "*** mount"
47         if ! _scratch_mount 2>/dev/null
48         then
49                 echo "failed to mount $SCRATCH_DEV"
50                 exit 1
51         fi
52
53         # fix the reserve block pool to a known size so that the enospc
54         # calculations work out correctly.
55         _scratch_resvblks 1024 >  /dev/null 2>&1
56 }
57
58 _fill_scratch()
59 {
60         $XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
61 }
62
63 _stress_scratch()
64 {
65         procs=3
66         nops=1000
67         # -w ensures that the only ops are ones which cause write I/O
68         FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
69             -n $nops $FSSTRESS_AVOID`
70         $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full &
71 }
72
73 # real QA test starts here
74 _supported_fs xfs
75 _require_scratch
76 _scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
77 . $tmp.mkfs     # extract blocksize and data size for scratch device
78
79 endsize=`expr 550 \* 1048576`   # stop after growing this big
80 incsize=`expr  42 \* 1048576`   # grow in chunks of this size
81 modsize=`expr   4 \* $incsize`  # pause after this many increments
82
83 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
84
85 nags=4
86 size=`expr 120 \* 1048576`      # 120 megabytes initially
87 sizeb=`expr $size / $dbsize`    # in data blocks
88 echo "*** creating scratch filesystem"
89 _create_scratch -dsize=${size} -dagcount=${nags}
90
91 fillsize=`expr 110 \* 1048576`  # 110 megabytes of filling
92 echo "*** using some initial space on scratch filesystem"
93 _fill_scratch $fillsize
94
95 #
96 # Grow the filesystem while actively stressing it...
97 # Kick off more stress threads on each iteration, grow; repeat.
98 #
99 while [ $size -le $endsize ]; do
100         echo "*** stressing a ${size} byte filesystem"
101         echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
102         _stress_scratch
103         sleep 1
104         size=`expr $size + $incsize`
105         sizeb=`expr $size / $dbsize`    # in data blocks
106         echo "*** growing to a ${size} byte filesystem"
107         echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
108         xfs_growfs -D ${sizeb} $SCRATCH_MNT \
109                 | tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
110         . $tmp.growfs
111         [ `expr $size % $modsize` -eq 0 ] && wait       # every 4th iteration
112         echo AGCOUNT=$agcount | tee -a $seqres.full
113         echo && echo >> $seqres.full
114 done
115 wait    # stop for any remaining stress processes
116
117 umount $SCRATCH_DEV
118 _check_scratch_fs
119
120 status=0
121 exit