4 # Test truncate/collapse range race.
5 # And this test is also a regression test for kernel commit 23fffa9,
6 # fs: move falloc collapse range check into the filesystem methods
7 # If the race occurs, it will trigger a BUG_ON().
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2015 Fujitsu. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
40 trap "_cleanup; exit \$status" 0 1 2 3 15
42 # get standard environment, filters and checks
46 # real QA test starts here
50 _require_xfs_io_command "fcollapse"
52 testfile=$TEST_DIR/testfile.$seq
53 NCPUS=`$here/src/feature -o`
54 # cap NCPUS to 8 at maximum to avoid long run time on hosts with many cpus
55 if [ $NCPUS -gt 8 ]; then
58 OUTER_LOOPS=$((10 * $NCPUS * $LOAD_FACTOR))
59 INNER_LOOPS=$((50 * $NCPUS * $LOAD_FACTOR))
60 # fcollapse/truncate continuously and simultaneously a same file
61 for ((i=1; i <= OUTER_LOOPS; i++)); do
62 for ((i=1; i <= INNER_LOOPS; i++)); do
63 $XFS_IO_PROG -f -c 'truncate 100k' \
64 -c 'fcollapse 0 16k' $testfile > /dev/null 2>&1
66 for ((i=1; i <= INNER_LOOPS; i++)); do
67 $XFS_IO_PROG -f -c 'truncate 0' $testfile > /dev/null 2>&1
72 echo "Silence is golden"