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
17 # Override the default cleanup function.
21 rm -f $SCRATCH_MNT/testfile.*
24 # Import common functions.
27 # real QA test starts here
32 # make a 1GB filesystem
33 _scratch_mkfs_sized `expr 1024 \* 1024 \* 1024` > $seqres.full 2>&1
34 _scratch_mount >> $seqres.full 2>&1
36 # set the reserved block pool to almost empty for XFS
37 if [ "$FSTYP" = "xfs" ]; then
38 $XFS_IO_PROG -x -c "resblks 4" $SCRATCH_MNT >> $seqres.full 2>&1
42 for i in `seq 0 1 $FILES`; do
44 # set the file size to be 10MB - that way the direct IO will always try
45 # to read at least 10MB even if only 4k was written. This allows
46 # discarded delalloc pages that would have been beyond EOF to be
50 $XFS_IO_PROG -f -c "truncate 10485760" $SCRATCH_MNT/testfile.$i
51 dd if=/dev/zero of=$SCRATCH_MNT/testfile.$i bs=4k conv=notrunc
56 for i in `seq 0 1 $FILES`; do
57 dd of=/dev/null if=$SCRATCH_MNT/testfile.$i bs=512k iflag=direct > /dev/null 2>&1 &
60 echo "*** Silence is golden ***"
62 # unmount and check dmesg, filtering out expected warnings about mixed
63 # direct and buffered I/O
65 _check_dmesg _filter_aiodio_dmesg