fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 028
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
4 #
5 # FS QA Test 028
6 #
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.
12 #
13 . ./common/preamble
14 _begin_fstest auto qgroup balance
15
16 # Import common functions.
17 . ./common/filter
18
19 # real QA test starts here
20 _supported_fs btrfs
21 _require_scratch
22 _require_btrfs_qgroup_report
23
24 _scratch_mkfs >/dev/null
25 _scratch_mount
26
27 _run_btrfs_util_prog quota enable $SCRATCH_MNT
28 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
29
30 # Increase the probability of generating de-refer extent, and decrease
31 # other.
32 args=`_scale_fsstress_args -z \
33         -f write=10 -f unlink=10 \
34         -f creat=10 -f fsync=10 \
35         -f fsync=10 -n 100000 -p 2 \
36         -d $SCRATCH_MNT/stress_dir`
37 echo "Run fsstress $args" >>$seqres.full
38 $FSSTRESS_PROG $args >/dev/null 2>&1 &
39 fsstress_pid=$!
40
41 echo "Start balance" >>$seqres.full
42 _btrfs_stress_balance -d $SCRATCH_MNT >/dev/null 2>&1 &
43 balance_pid=$!
44
45 # 30s is enough to trigger bug
46 sleep $((30*$TIME_FACTOR))
47 kill $fsstress_pid $balance_pid &> /dev/null
48 wait
49
50 # kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
51 # to cancel running or paused balance.
52 $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
53
54 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
55
56 _scratch_unmount
57
58 # qgroup will be checked at _check_scratch_fs() by fstest.
59 echo "Silence is golden"
60 status=0
61
62 exit