xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 017
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Liu Bo.  All Rights Reserved.
4 #
5 # FS QA Test No. 017
6 #
7 # Verify that removing shared extents can end up incorrect qgroup accounting.
8 #
9 # Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
10 # this will throw a warning into dmesg.
11 #
12 # The issue is fixed by https://patchwork.kernel.org/patch/5499981/
13 # "Btrfs: fix a warning of qgroup account on shared extents"
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26     cd /
27     rm -f $tmp.*
28 }
29
30 # get standard environment, filters and checks
31 . ./common/rc
32 . ./common/filter
33
34 # real QA test starts here
35
36 _supported_fs btrfs
37 _supported_os Linux
38 _require_scratch
39 _require_cloner
40
41 rm -f $seqres.full
42
43 # Currently in btrfs the node/leaf size can not be smaller than the page
44 # size (but it can be greater than the page size). So use the largest
45 # supported node/leaf size (64Kb) so that the test can run on any platform
46 # that Linux supports.
47 _scratch_mkfs "--nodesize 65536" >>$seqres.full 2>&1
48 _scratch_mount
49
50 BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
51 EXTENT_SIZE=$((2 * $BLOCK_SIZE))
52
53 $XFS_IO_PROG -f -d -c "pwrite 0 $EXTENT_SIZE" $SCRATCH_MNT/foo \
54         | _filter_xfs_io_blocks_modified
55
56 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
57
58 $CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
59
60 $CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo \
61              $SCRATCH_MNT/snap/foo-reflink
62
63 $CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo \
64              $SCRATCH_MNT/snap/foo-reflink2
65
66 _run_btrfs_util_prog quota enable $SCRATCH_MNT
67 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
68
69 rm -fr $SCRATCH_MNT/foo*
70 rm -fr $SCRATCH_MNT/snap/foo*
71
72 sync
73
74 units=`_btrfs_qgroup_units`
75 $BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | $AWK_PROG '/[0-9]/ {print $2" "$3}'
76
77 # success, all done
78 status=0
79 exit