fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 217
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test 217
6 #
7 # Test if the following workload would cause problem:
8 # - fstrim
9 # - shrink device
10 # - fstrim
11 #
12 . ./common/preamble
13 _begin_fstest auto quick trim dangerous
14
15 # Import common functions.
16 . ./common/filter
17
18 # real QA test starts here
19
20 # Modify as appropriate.
21 _supported_fs btrfs
22 _require_scratch_size $((5 * 1024 * 1024)) #kB
23 _require_fstrim
24
25 # Create a 5G fs
26 _scratch_mkfs_sized $((5 * 1024 * 1024 * 1024)) >> $seqres.full
27 _scratch_mount
28
29 # Fstrim to populate the device->alloc_status CHUNK_TRIMMED bits
30 $FSTRIM_PROG -v $SCRATCH_MNT >> $seqres.full 2>&1 || \
31         _notrun "FSTRIM not supported"
32
33 # Shrink the fs to 4G, so the existing CHUNK_TRIMMED bits are beyond
34 # device boundary
35 $BTRFS_UTIL_PROG filesystem resize 1:-1G "$SCRATCH_MNT" >> $seqres.full
36
37 # Do fstrim again to trigger the bug
38 $FSTRIM_PROG -v $SCRATCH_MNT >> $seqres.full
39
40 echo "Silence is golden"
41
42 # success, all done
43 status=0
44 exit