2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 Fujitsu. All rights reserved.
5 # FSQA Test No. btrfs/057
7 # Quota rescan stress test, we run fsstress and quota rescan concurrently
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
22 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # real QA test starts here
35 # use small leaf size to get higher btree height.
36 run_check _scratch_mkfs "-b 1g --nodesize 4096"
38 # inode cache is saved in the FS tree itself for every
39 # individual FS tree,that affects the sizes reported by qgroup show
40 # so we need to explicitly turn it off to get consistent values.
41 _scratch_mount "-o noinode_cache"
43 # -w ensures that the only ops are ones which cause write I/O
44 run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 \
45 $FSSTRESS_AVOID >&/dev/null
47 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT \
50 run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 \
51 $FSSTRESS_AVOID >&/dev/null
53 _run_btrfs_util_prog quota enable $SCRATCH_MNT
54 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
56 # remove all file/dir other than subvolume
57 rm -rf $SCRATCH_MNT/snap1/* >& /dev/null
58 rm -rf $SCRATCH_MNT/p* >& /dev/null
60 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
61 units=`_btrfs_qgroup_units`
62 $BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' \
63 | $AWK_PROG '{print $2" "$3}'