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
39 # make a 1GB filesystem
40 _scratch_mkfs_sized `expr 1024 \* 1024 \* 1024` > $seqres.full 2>&1
41 _scratch_mount >> $seqres.full 2>&1
43 # set the reserved block pool to almost empty for XFS
44 if [ "$FSTYP" = "xfs" ]; then
45 $XFS_IO_PROG -x -c "resblks 4" $SCRATCH_MNT >> $seqres.full 2>&1
49 for i in `seq 0 1 $FILES`; do
51 # set the file size to be 10MB - that way the direct IO will always try
52 # to read at least 10MB even if only 4k was written. This allows
53 # discarded delalloc pages that would have been beyond EOF to be
57 $XFS_IO_PROG -f -c "truncate 10485760" $SCRATCH_MNT/testfile.$i
58 dd if=/dev/zero of=$SCRATCH_MNT/testfile.$i bs=4k conv=notrunc
63 for i in `seq 0 1 $FILES`; do
64 dd of=/dev/null if=$SCRATCH_MNT/testfile.$i bs=512k iflag=direct > /dev/null 2>&1 &
67 echo "*** Silence is golden ***"
69 # unmount and check dmesg, filtering out expected warnings about mixed
70 # direct and buffered I/O
72 _check_dmesg _filter_aiodio_dmesg