xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / btrfs / 014
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/014
6 #
7 # Btrfs balance tests
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here="`pwd`"
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16
17 _create_snapshot()
18 {
19         for i in $(seq 20)
20         do
21                 $BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snapshot0 >/dev/null
22                 $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/snapshot0 >/dev/null
23         done
24 }
25
26 _balance()
27 {
28         for i in $(seq 20)
29         do
30                 _run_btrfs_balance_start $SCRATCH_MNT >> $seqres.full
31         done
32 }
33
34 #get standard environment, filters and checks
35 . ./common/rc
36 . ./common/filter
37
38 # real QA test starts here
39 _supported_fs btrfs
40
41 _require_scratch
42 _scratch_mkfs >/dev/null 2>&1
43 _scratch_mount
44
45 echo "Tip: Run dmesg to see the error on failure"
46
47 _create_snapshot &
48
49 _balance &
50
51 wait
52
53 status=0
54 exit