4 # Delayed allocation at ENOSPC test
6 # Derived from a test case from Lachlan McIlroy and improved to
7 # reliably trigger a BUG in xfs_get_blocks(). Despite this XFS
8 # focus, the test can to run on any filesystem to exercise ENOSPC
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2010 Dave Chinner. All Rights Reserved.
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #-----------------------------------------------------------------------
30 owner=david@fromorbit.com
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
42 rm -f $SCRATCH_MNT/testfile.*
45 trap "_cleanup ; exit \$status" 0 1 2 3 15
47 # get standard environment, filters and checks
51 # real QA test starts here
57 # make a 1GB filesystem
58 _scratch_mkfs_sized `expr 1024 \* 1024 \* 1024` > $seq.full 2>&1
59 _scratch_mount >> $seq.full 2>&1
61 # set the reserved block pool to almost empty for XFS
62 if [ "$FSTYP" = "xfs" ]; then
63 xfs_io -x -c "resblks 4" $SCRATCH_MNT >> $seq.full 2>&1
67 for i in `seq 0 1 $FILES`; do
69 # set the file size to be 10MB - that way the direct IO will always try
70 # to read at least 10MB even if only 4k was written. This allows
71 # discarded delalloc pages that would have been beyond EOF to be
75 xfs_io -f -c "truncate 10485760" $SCRATCH_MNT/testfile.$i
76 dd if=/dev/zero of=$SCRATCH_MNT/testfile.$i bs=4k conv=notrunc
81 for i in `seq 0 1 $FILES`; do
82 dd of=/dev/null if=$SCRATCH_MNT/testfile.$i bs=512k iflag=direct > /dev/null 2>&1 &
85 echo "*** Silence is golden ***"