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 SIZE=`expr 104 \* 1024 \* 1024`
55 _scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
56 | _filter_mkfs 2> $tmp.mkfs > /dev/null
61 # fix the reserve block pool to a known size so that the enospc calculations
62 # work out correctly. Space usages is based 22500 files and 1024 reserved blocks
63 # on a 4k block size 256 byte inode size filesystem.
67 # decrease files for inode size.
68 # 22500 * (256 + 4k) = ~97MB
69 # files * (isize + bsize) = 97MB
70 # files = (97920000 / (isize + bsize))
72 files=$((space / (isize + dbsize)))
73 resv_blks=$((resv_blks * (4096 / dbsize)))
75 echo files $files, resvblks $resv_blks >> $seqres.full
76 _scratch_resvblks $resv_blks >> $seqres.full 2>&1
78 for i in `seq 1 $files`; do
79 echo -n > $SCRATCH_MNT/$i
80 echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i