2 # FS QA Test No. generic/439
4 # Test that if we punch a hole in a file, with either a range that goes beyond
5 # the file's size or covers a file range that is already a hole, and that if
6 # after we do some buffered write operations that cover different parts of the
7 # hole, no warnings are emmitted in syslog/dmesg and the file's content is
8 # correct after remounting the filesystem.
10 #-----------------------------------------------------------------------
12 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
13 # Author: Filipe Manana <fdmanana@suse.com>
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #-----------------------------------------------------------------------
31 seqres=$RESULT_DIR/$seq
32 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
44 # get standard environment, filters and checks
48 # real QA test starts here
53 _require_xfs_io_command "fpunch"
57 _scratch_mkfs >>$seqres.full 2>&1
60 $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 100K" $SCRATCH_MNT/f | _filter_xfs_io
61 $XFS_IO_PROG -c "fpunch 60K 90K" $SCRATCH_MNT/f
62 $XFS_IO_PROG -c "pwrite -S 0xbb -b 100K 50K 100K" $SCRATCH_MNT/f | _filter_xfs_io
63 $XFS_IO_PROG -c "pwrite -S 0xcc -b 50K 100K 50K" $SCRATCH_MNT/f | _filter_xfs_io
65 $XFS_IO_PROG -f -c "fpunch 695K 820K" $SCRATCH_MNT/f2
66 $XFS_IO_PROG -c "pwrite -S 0xaa 1008K 307K" $SCRATCH_MNT/f2 | _filter_xfs_io
67 $XFS_IO_PROG -c "pwrite -S 0xbb -b 630K 1073K 630K" $SCRATCH_MNT/f2 \
69 $XFS_IO_PROG -c "pwrite -S 0xcc -b 459K 1068K 459K" $SCRATCH_MNT/f2 \
74 echo "File f contents after remounting filesystem:"
75 od -t x1 $SCRATCH_MNT/f
76 echo "File f2 contents after remounting filesystem:"
77 od -t x1 $SCRATCH_MNT/f2