2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
7 # Run write(2) and fallocate(2) in parallel and the total needed data space
8 # for these operations don't exceed whole fs free data space, to see whether
9 # we will get any unexpected ENOSPC error.
12 _begin_fstest auto quick enospc prealloc
14 # Import common functions.
17 # Modify as appropriate.
20 _require_xfs_io_command "falloc"
21 test "$FSTYP" = "xfs" && _require_xfs_io_command "extsize"
23 _scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
26 # Disable speculative post-EOF preallocation on XFS, which can grow fast enough
27 # that a racing fallocate then fails.
28 if [ "$FSTYP" = "xfs" ]; then
29 alloc_sz="$(_get_file_block_size $SCRATCH_MNT)"
30 $XFS_IO_PROG -c "extsize $alloc_sz" $SCRATCH_MNT >> $seqres.full
33 testfile1=$SCRATCH_MNT/testfile1
34 testfile2=$SCRATCH_MNT/testfile2
36 echo "Silence is golden"
37 for ((i=0; i<100; i++)); do
38 $XFS_IO_PROG -fc "pwrite 0 80M" $testfile1 >/dev/null
43 for ((i=0; i<100; i++)); do
44 $XFS_IO_PROG -fc "falloc 0 80M" $testfile2 >/dev/null