btrfs: Verify falloc on multiple holes won't leak qgroup reserved data space
[xfstests-dev.git] / tests / btrfs / 076
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Wang Shilong.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/076
6 #
7 # Regression test for btrfs incorrect inode ratio detection.
8 # This was fixed in the following linux kernel patch:
9 #
10 #     Btrfs: fix incorrect compression ratio detection
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18
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 -fr $tmp
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/defrag
32
33 # real QA test starts here
34 _supported_fs btrfs
35 _supported_os Linux
36 _require_test
37 _require_scratch
38
39 rm -f $seqres.full
40
41 _scratch_mkfs >> $seqres.full 2>&1
42 _scratch_mount "-o compress=lzo"
43
44 $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \
45         $SCRATCH_MNT/data >> $seqres.full 2>&1
46
47 _extent_count $SCRATCH_MNT/data
48
49 $XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \
50         $SCRATCH_MNT/data >> $seqres.full 2>&1
51
52 $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \
53         $SCRATCH_MNT/data >> $seqres.full 2>&1
54
55 _extent_count $SCRATCH_MNT/data
56
57 status=0
58 exit