2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
7 # Test if qgroup can handle extent de-reference during reallocation.
8 # "extent de-reference" means that reducing an extent's reference count
9 # or freeing an extent.
10 # Although current qgroup can handle it, we still need to prevent any
11 # regression which may break current qgroup.
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
32 # remove previous $seqres.full before test
35 # real QA test starts here
39 _require_btrfs_qgroup_report
41 _scratch_mkfs >/dev/null
44 _run_btrfs_util_prog quota enable $SCRATCH_MNT
45 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
47 # Increase the probability of generating de-refer extent, and decrease
49 args=`_scale_fsstress_args -z \
50 -f write=10 -f unlink=10 \
51 -f creat=10 -f fsync=10 \
52 -f fsync=10 -n 100000 -p 2 \
53 -d $SCRATCH_MNT/stress_dir`
54 echo "Run fsstress $args" >>$seqres.full
55 $FSSTRESS_PROG $args >/dev/null 2>&1 &
58 echo "Start balance" >>$seqres.full
59 _btrfs_stress_balance -d $SCRATCH_MNT >/dev/null 2>&1 &
62 # 30s is enough to trigger bug
63 sleep $((30*$TIME_FACTOR))
64 kill $fsstress_pid $balance_pid &> /dev/null
67 # kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
68 # to cancel running or paused balance.
69 $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
71 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
75 # qgroup will be checked at _check_scratch_fs() by fstest.
76 echo "Silence is golden"