4 # Check several growfs corner cases
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
35 trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
41 umount -d $LOOP_MNT 2>/dev/null
46 # get standard environment, filters and checks
50 # loop devices are available in Linux only
54 # Must have loop device
57 LOOP_IMG=$TEST_DIR/$seq.fs
58 LOOP_MNT=$TEST_DIR/$seq.mnt
65 # real QA test starts here
67 echo "*** create loop mount point"
68 rmdir $LOOP_MNT 2>/dev/null
69 mkdir -p $LOOP_MNT || _fail "cannot create loopback mount point"
79 dparam="file,name=$LOOP_IMG,size=$original"
80 if [ -n "$agsize" ]; then
81 dparam="$dparam,agsize=$agsize"
85 echo "=== GROWFS (from $original to $new_size, $bsize blocksize)"
88 echo "*** mkfs loop file (size=$original)"
89 $MKFS_XFS_PROG -b size=$bsize -d $dparam \
90 | _filter_mkfs 2>/dev/null
92 echo "*** extend loop file"
93 $XFS_IO_PROG -c "pwrite $new_size $bsize" $LOOP_IMG | _filter_io
94 echo "*** mount loop filesystem"
95 mount -t xfs -o loop $LOOP_IMG $LOOP_MNT
97 echo "*** grow loop filesystem"
98 #xfs_growfs $LOOP_MNT 2>&1 | grep -e "^data" #| _filter_growfs 2>/dev/null
99 $XFS_GROWFS_PROG $LOOP_MNT 2>&1 | _filter_growfs 2>&1
102 umount -d $LOOP_MNT > /dev/null 2>&1
104 # Large grows takes forever to check..
105 if [ "$check" -gt "0" ]
108 LOOP_DEV=`losetup -f`
109 losetup $LOOP_DEV $LOOP_IMG
110 _check_xfs_filesystem $LOOP_DEV none none
117 # Wes' problem sizes...
118 _grow_loop 168024b 1376452608 4096 1
120 # Some other blocksize cases...
121 _grow_loop 168024b 1376452608 2048 1
122 _grow_loop 168024b 1376452608 512 1 16m
123 _grow_loop 168024b 688230400 1024 1
126 # Other corner cases suggested by dgc
127 # also the following doesn't check if the filesystem is consistent.
128 # - grow 1TB by 1.5TB (control)
129 _grow_loop 1t 2500g 4096 0
131 # - grow 1TB by 2.5TB (grow by > 2TB)
132 _grow_loop 1t 3500g 4096 0
134 # - grow 1TB by 3.5TB (grow past 4TB)
135 _grow_loop 1t 4500g 4096 0
137 # - grow 1TB by 4.5TB (grow by > 4TB)
138 _grow_loop 1t 5500g 4096 0
140 # - grow 1TB by 7.5TB (grow past 8TB)
141 _grow_loop 1t 8500g 4096 0
143 # - grow 1TB by 8.5TB (grow by > 8TB)
144 _grow_loop 1t 9500g 4096 0
146 # - grow 1TB by 14.5TB (grow by > 8TB)
147 _grow_loop 1t 15500g 4096 0
149 # - grow 1TB by 15TB (grow to 16TB)
150 _grow_loop 1t 16000g 4096 0
152 # It would be nice to go on, but this would require a totally new test in order
153 # to take care of 64-bit machines.