xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 196
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Facebook.  All Rights Reserved.
4 #
5 # FS QA Test 196
6 #
7 # Test multi subvolume fsync to test a bug where we'd end up pointing at a block
8 # we haven't written.  This was fixed by the patch
9 #
10 # btrfs: fix incorrect updating of log root tree
11 #
12 # Will do log replay and check the filesystem.
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 fio_config=$tmp.fio
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26         cd /
27         _log_writes_cleanup &> /dev/null
28         _dmthin_cleanup
29         rm -f $tmp.*
30 }
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35 . ./common/dmthin
36 . ./common/dmlogwrites
37
38 # remove previous $seqres.full before test
39 rm -f $seqres.full
40
41 # real QA test starts here
42
43 # Modify as appropriate.
44 _supported_fs btrfs
45 _supported_os Linux
46
47 # Use thin device as replay device, which requires $SCRATCH_DEV
48 _require_scratch_nocheck
49 # and we need extra device as log device
50 _require_log_writes
51 _require_dm_target thin-pool
52
53 cat >$fio_config <<EOF
54 [global]
55 readwrite=write
56 fallocate=none
57 bs=4k
58 fsync=1
59 size=128k
60 EOF
61
62 for i in $(seq 0 49); do
63         echo "[foo$i]" >> $fio_config
64         echo "filename=$SCRATCH_MNT/$i/file" >> $fio_config
65 done
66
67 _require_fio $fio_config
68
69 cat $fio_config >> $seqres.full
70
71 # Use a thin device to provide deterministic discard behavior. Discards are used
72 # by the log replay tool for fast zeroing to prevent out-of-order replay issues.
73 _dmthin_init
74 _log_writes_init $DMTHIN_VOL_DEV
75 _log_writes_mkfs >> $seqres.full 2>&1
76 _log_writes_mark mkfs
77
78 _log_writes_mount
79
80 # First create all the subvolumes
81 for i in $(seq 0 49); do
82         $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/$i" > /dev/null
83 done
84
85 $FIO_PROG $fio_config > /dev/null 2>&1
86 _log_writes_unmount
87
88 _log_writes_remove
89 prev=$(_log_writes_mark_to_entry_number mkfs)
90 [ -z "$prev" ] && _fail "failed to locate entry mark 'mkfs'"
91 cur=$(_log_writes_find_next_fua $prev)
92 [ -z "$cur" ] && _fail "failed to locate next FUA write"
93
94 while [ ! -z "$cur" ]; do
95         _log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
96
97         # We need to mount the fs because btrfsck won't bother checking the log.
98         _dmthin_mount
99         _dmthin_check_fs
100
101         prev=$cur
102         cur=$(_log_writes_find_next_fua $(($cur + 1)))
103         [ -z "$cur" ] && break
104 done
105
106 echo "Silence is golden"
107
108 # success, all done
109 status=0
110 exit