4 # Test out ENOSPC flushing on small filesystems.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2009 Christoph Hellwig.
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
21 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
42 # real QA test starts here
50 # get the block size first
51 _scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
54 # For xfs, we need to handle the different default log sizes that different
55 # versions of mkfs create. All should be valid with a 16MB log, so use that.
56 # And v4/512 v5/1k xfs don't have enough free inodes, set imaxpct=50 at mkfs
57 # time solves this problem.
58 [ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=16m -i maxpct=50"
60 SIZE=`expr 115 \* 1024 \* 1024`
61 _scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
62 | _filter_mkfs 2> $tmp.mkfs > /dev/null
65 # Source $tmp.mkfs to get geometry
68 # fix the reserve block pool to a known size so that the enospc calculations
69 # work out correctly. Space usages is based 22500 files and 1024 reserved blocks
70 # on a 4k block size 256 byte inode size filesystem.
74 # decrease files for inode size.
75 # 22500 * (256 + 4k) = ~97MB
76 # files * (isize + bsize) = 97MB
77 # files = (97920000 / (isize + bsize))
79 files=$((space / (isize + dbsize)))
81 echo files $files, resvblks $resv_blks >> $seqres.full
82 _scratch_resvblks $resv_blks >> $seqres.full 2>&1
84 for i in `seq 1 $files`; do
85 echo -n > $SCRATCH_MNT/$i
86 echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i