2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Fujitsu. All Rights Reserved.
7 # Test truncate/collapse range race.
8 # And this test is also a regression test for kernel commit 23fffa9,
9 # fs: move falloc collapse range check into the filesystem methods
10 # If the race occurs, it will trigger a BUG_ON().
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # real QA test starts here
35 _require_xfs_io_command "fcollapse"
37 testfile=$TEST_DIR/testfile.$seq
38 NCPUS=`$here/src/feature -o`
39 # cap NCPUS to 8 at maximum to avoid long run time on hosts with many cpus
40 if [ $NCPUS -gt 8 ]; then
43 OUTER_LOOPS=$((10 * $NCPUS * $LOAD_FACTOR))
44 INNER_LOOPS=$((50 * $NCPUS * $LOAD_FACTOR))
45 # fcollapse/truncate continuously and simultaneously a same file
46 for ((i=1; i <= OUTER_LOOPS; i++)); do
47 for ((i=1; i <= INNER_LOOPS; i++)); do
48 $XFS_IO_PROG -f -c 'truncate 100k' \
49 -c 'fcollapse 0 16k' $testfile > /dev/null 2>&1
51 for ((i=1; i <= INNER_LOOPS; i++)); do
52 $XFS_IO_PROG -f -c 'truncate 0' $testfile > /dev/null 2>&1
57 echo "Silence is golden"