common: kill _supported_os
[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 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24         cd /
25         rm -f $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31
32 # remove previous $seqres.full before test
33 rm -f $seqres.full
34
35 # real QA test starts here
36 _supported_fs btrfs
37 _require_scratch
38 _require_btrfs_qgroup_report
39
40 _scratch_mkfs >/dev/null
41 _scratch_mount
42
43 _run_btrfs_util_prog quota enable $SCRATCH_MNT
44 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
45
46 # Increase the probability of generating de-refer extent, and decrease
47 # other.
48 args=`_scale_fsstress_args -z \
49         -f write=10 -f unlink=10 \
50         -f creat=10 -f fsync=10 \
51         -f fsync=10 -n 100000 -p 2 \
52         -d $SCRATCH_MNT/stress_dir`
53 echo "Run fsstress $args" >>$seqres.full
54 $FSSTRESS_PROG $args >/dev/null 2>&1 &
55 fsstress_pid=$!
56
57 echo "Start balance" >>$seqres.full
58 _btrfs_stress_balance -d $SCRATCH_MNT >/dev/null 2>&1 &
59 balance_pid=$!
60
61 # 30s is enough to trigger bug
62 sleep $((30*$TIME_FACTOR))
63 kill $fsstress_pid $balance_pid &> /dev/null
64 wait
65
66 # kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
67 # to cancel running or paused balance.
68 $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
69
70 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
71
72 _scratch_unmount
73
74 # qgroup will be checked at _check_scratch_fs() by fstest.
75 echo "Silence is golden"
76 status=0
77
78 exit