2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
5 # FS QA Test No. btrfs/122
7 # Test that qgroup counts are valid after snapshot creation. This has
8 # been broken in btrfs since Linux v4.1
11 _begin_fstest auto quick snapshot qgroup
13 # Import common functions.
16 # real QA test starts here
19 _require_btrfs_qgroup_report
21 # Force a small leaf size to make it easier to blow out our root
23 _scratch_mkfs "--nodesize 16384" >/dev/null
25 _run_btrfs_util_prog quota enable $SCRATCH_MNT
27 mkdir "$SCRATCH_MNT/snaps"
29 # First make some simple snapshots - the bug was initially reproduced like this
30 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT "$SCRATCH_MNT/snaps/empty1"
31 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT "$SCRATCH_MNT/snaps/empty2"
33 # This forces the fs tree out past level 0, adding at least one tree
34 # block which must be properly accounted for when we make our next
36 mkdir "$SCRATCH_MNT/data"
37 for i in `seq 0 640`; do
38 $XFS_IO_PROG -f -c "pwrite 0 1M" "$SCRATCH_MNT/data/file$i" > /dev/null 2>&1
42 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT "$SCRATCH_MNT/snaps/snap1"
43 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT "$SCRATCH_MNT/snaps/snap2"
47 # qgroup will be checked by fstest at _check_scratch_fs()