fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 122
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/122
6 #
7 # Test that qgroup counts are valid after snapshot creation. This has
8 # been broken in btrfs since Linux v4.1
9 #
10 . ./common/preamble
11 _begin_fstest auto quick snapshot qgroup
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17 _supported_fs btrfs
18 _require_scratch
19 _require_btrfs_qgroup_report
20
21 # Force a small leaf size to make it easier to blow out our root
22 # subvolume tree
23 _scratch_mkfs "--nodesize 16384" >/dev/null
24 _scratch_mount
25 _run_btrfs_util_prog quota enable $SCRATCH_MNT
26
27 mkdir "$SCRATCH_MNT/snaps"
28
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"
32
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
35 # snapshots.
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
39 done
40
41 # Snapshot twice.
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"
44
45 _scratch_unmount
46
47 # qgroup will be checked by fstest at _check_scratch_fs()
48 status=0
49 exit