pv 955274 - Fix random test failures due to u_char to char type mismatch comparison.
[xfstests-dev.git] / 104
1 #! /bin/sh
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 #
10 # creator
11 owner=nathans@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20
21 # get standard environment, filters and checks
22 . ./common.rc
23 . ./common.filter
24
25 _create_scratch()
26 {
27         echo "*** mkfs"
28         _scratch_mkfs_xfs $@ | tee -a $seq.full | _filter_mkfs 2>$tmp.mkfs
29         . $tmp.mkfs
30
31         echo "*** mount"
32         if ! _scratch_mount 2>/dev/null
33         then
34                 echo "failed to mount $SCRATCH_DEV"
35                 exit 1
36         fi
37 }
38
39 _fill_scratch()
40 {
41         $XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
42 }
43
44 _stress_scratch()
45 {
46         procs=3
47         nops=1000
48         # -w ensures that the only ops are ones which cause write I/O
49         $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n $nops $FSSTRESS_AVOID &
50 }
51
52 # real QA test starts here
53 _supported_fs xfs
54 _require_scratch
55 _scratch_mkfs_xfs | tee -a $seq.full | _filter_mkfs 2>$tmp.mkfs
56 . $tmp.mkfs     # extract blocksize and data size for scratch device
57
58 endsize=`expr 550 \* 1048576`   # stop after growing this big
59 incsize=`expr  42 \* 1048576`   # grow in chunks of this size
60 modsize=`expr   4 \* $incsize`  # pause after this many increments
61
62 [ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
63
64 nags=4
65 size=`expr 120 \* 1048576`      # 120 megabytes initially
66 sizeb=`expr $size / $dbsize`    # in data blocks
67 echo "*** creating scratch filesystem"
68 _create_scratch -dsize=${size} -dagcount=${nags}
69
70 fillsize=`expr 110 \* 1048576`  # 110 megabytes of filling
71 echo "*** using some initial space on scratch filesystem"
72 _fill_scratch $fillsize
73
74 #
75 # Grow the filesystem while actively stressing it...
76 # Kick off more stress threads on each iteration, grow; repeat.
77 #
78 while [ $size -le $endsize ]; do
79         echo "*** stressing a ${size} byte filesystem"
80         echo "*** stressing a ${sizeb} block filesystem" >> $seq.full
81         _stress_scratch
82         sleep 1
83         size=`expr $size + $incsize`
84         sizeb=`expr $size / $dbsize`    # in data blocks
85         echo "*** growing to a ${size} byte filesystem"
86         echo "*** growing to a ${sizeb} block filesystem" >> $seq.full
87         xfs_growfs -D ${sizeb} $SCRATCH_MNT \
88                 | tee -a $seq.full | _filter_mkfs 2>$tmp.growfs
89         . $tmp.growfs
90         [ `expr $size % $modsize` -eq 0 ] && wait       # every 4th iteration
91         echo AGCOUNT=$agcount | tee -a $seq.full
92         echo && echo >> $seq.full
93 done
94 wait    # stop for any remaining stress processes
95
96 umount $SCRATCH_DEV
97 _check_scratch_fs
98
99 status=0
100 exit