xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 183
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FSQA Test No. 183
6 #
7 # Regression test for read corruption of compressed and shared extents after
8 # punching holes into a file.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13 tmp=/tmp/$$
14 status=1        # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -f $tmp.*
21 }
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/filter
26 . ./common/reflink
27
28 # real QA test starts here
29 _supported_fs btrfs
30 _supported_os Linux
31 _require_scratch_reflink
32 _require_xfs_io_command "fpunch"
33
34 rm -f $seqres.full
35
36 _scratch_mkfs >>$seqres.full 2>&1
37 _scratch_mount "-o compress"
38
39 # Create a file with 3 consecutive compressed extents, each corresponds to 128Kb
40 # of data (uncompressed size) and each is stored on disk as a 4Kb extent
41 # (compressed size, regardless of compression algorithm used).
42 # Each extent starts with 4Kb of zeroes, while the remaining bytes all have a
43 # value of 0xff.
44 $XFS_IO_PROG -f -c "pwrite -S 0xff 0 384K" \
45              -c "pwrite -S 0x00 0 4K" \
46              -c "pwrite -S 0x00 128K 4K" \
47              -c "pwrite -S 0x00 256K 4K" \
48              $SCRATCH_MNT/foobar | _filter_xfs_io
49
50 echo "File digest after initial creation:"
51 md5sum $SCRATCH_MNT/foobar | _filter_scratch
52
53 # Clone the first extent into offsets 128K and 256K.
54 $XFS_IO_PROG -c "reflink $SCRATCH_MNT/foobar 0 128K 128K" \
55              -c "reflink $SCRATCH_MNT/foobar 0 256K 128K" \
56              $SCRATCH_MNT/foobar | _filter_xfs_io
57
58 echo "File digest after reflinking:"
59 md5sum $SCRATCH_MNT/foobar | _filter_scratch
60
61 # Punch holes into the regions that are already full of zeroes.
62 $XFS_IO_PROG -c "fpunch 0 4K" \
63              -c "fpunch 128K 4K" \
64              -c "fpunch 256K 4K" \
65              $SCRATCH_MNT/foobar
66
67 echo "File digest after punching holes:"
68 md5sum $SCRATCH_MNT/foobar | _filter_scratch
69
70 echo 1 > /proc/sys/vm/drop_caches
71
72 echo "File digest after dropping page cache:"
73 md5sum $SCRATCH_MNT/foobar | _filter_scratch
74
75 status=0
76 exit