4 # Test if qgroup can handle extent de-reference during reallocation.
5 # "extent de-reference" means that reducing an extent's reference count
6 # or freeing an extent.
7 # Although current qgroup can handle it, we still need to prevent any
8 # regression which may break current qgroup.
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
47 # remove previous $seqres.full before test
50 # real QA test starts here
54 _require_btrfs_qgroup_report
59 _run_btrfs_util_prog quota enable $SCRATCH_MNT
60 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
62 # Increase the probability of generating de-refer extent, and decrease
64 args=`_scale_fsstress_args -z \
65 -f write=10 -f unlink=10 \
66 -f creat=10 -f fsync=10 \
67 -f fsync=10 -n 100000 -p 2 \
68 -d $SCRATCH_MNT/stress_dir`
69 echo "Run fsstress $args" >>$seqres.full
70 $FSSTRESS_PROG $args >/dev/null 2>&1 &
73 echo "Start balance" >>$seqres.full
74 _btrfs_stress_balance -d $SCRATCH_MNT >/dev/null 2>&1 &
77 # 30s is enough to trigger bug
78 sleep $((30*$TIME_FACTOR))
79 kill $fsstress_pid $balance_pid
82 # kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
83 # to cancel running or paused balance.
84 $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
86 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
90 # qgroup will be checked at _check_scratch_fs() by fstest.
91 echo "Silence is golden"