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
34 _require_xfs_io_command "fcollapse"
36 testfile=$TEST_DIR/testfile.$seq
37 NCPUS=`$here/src/feature -o`
38 # cap NCPUS to 8 at maximum to avoid long run time on hosts with many cpus
39 if [ $NCPUS -gt 8 ]; then
42 OUTER_LOOPS=$((10 * $NCPUS * $LOAD_FACTOR))
43 INNER_LOOPS=$((50 * $NCPUS * $LOAD_FACTOR))
44 # fcollapse/truncate continuously and simultaneously a same file
45 for ((i=1; i <= OUTER_LOOPS; i++)); do
46 for ((i=1; i <= INNER_LOOPS; i++)); do
47 $XFS_IO_PROG -f -c 'truncate 100k' \
48 -c 'fcollapse 0 16k' $testfile > /dev/null 2>&1
50 for ((i=1; i <= INNER_LOOPS; i++)); do
51 $XFS_IO_PROG -f -c 'truncate 0' $testfile > /dev/null 2>&1
56 echo "Silence is golden"