2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Dave Chinner. All Rights Reserved.
7 # Delayed allocation at ENOSPC test
9 # Derived from a test case from Lachlan McIlroy and improved to
10 # reliably trigger a BUG in xfs_get_blocks(). Despite this XFS
11 # focus, the test can to run on any filesystem to exercise ENOSPC
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
25 rm -f $SCRATCH_MNT/testfile.*
28 trap "_cleanup ; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
34 # real QA test starts here
40 # make a 1GB filesystem
41 _scratch_mkfs_sized `expr 1024 \* 1024 \* 1024` > $seqres.full 2>&1
42 _scratch_mount >> $seqres.full 2>&1
44 # set the reserved block pool to almost empty for XFS
45 if [ "$FSTYP" = "xfs" ]; then
46 $XFS_IO_PROG -x -c "resblks 4" $SCRATCH_MNT >> $seqres.full 2>&1
50 for i in `seq 0 1 $FILES`; do
52 # set the file size to be 10MB - that way the direct IO will always try
53 # to read at least 10MB even if only 4k was written. This allows
54 # discarded delalloc pages that would have been beyond EOF to be
58 $XFS_IO_PROG -f -c "truncate 10485760" $SCRATCH_MNT/testfile.$i
59 dd if=/dev/zero of=$SCRATCH_MNT/testfile.$i bs=4k conv=notrunc
64 for i in `seq 0 1 $FILES`; do
65 dd of=/dev/null if=$SCRATCH_MNT/testfile.$i bs=512k iflag=direct > /dev/null 2>&1 &
68 echo "*** Silence is golden ***"
70 # unmount and check dmesg, filtering out expected warnings about mixed
71 # direct and buffered I/O
73 _check_dmesg _filter_aiodio_dmesg