4 # Ensuring that copy on write in directio mode to the source file when the
5 # CoW range covers holes and regular shared blocks.
7 # - Truncate the first file.
8 # - Write the odd blocks of the first file.
9 # - Reflink the odd blocks of the first file into the second file.
10 # - DIO CoW the first file across the halfway mark, starting with the
12 # - Check that the files are now different where we say they're different.
14 #-----------------------------------------------------------------------
15 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
17 # This program is free software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License as
19 # published by the Free Software Foundation.
21 # This program is distributed in the hope that it would be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write the Free Software Foundation,
28 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
51 # real QA test starts here
53 _require_scratch_reflink
54 _require_xfs_io_command "falloc"
59 echo "Format and mount"
60 _scratch_mkfs > $seqres.full 2>&1
61 _scratch_mount >> $seqres.full 2>&1
63 testdir=$SCRATCH_MNT/test-$seq
66 echo "Create the original files"
69 filesize=$((blksz * nr))
70 _sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
74 md5sum $testdir/file1 | _filter_scratch
75 md5sum $testdir/file3 | _filter_scratch
76 md5sum $testdir/file1.chk | _filter_scratch
78 echo "CoW across the transition"
79 cowoff=$((filesize / 4))
80 cowsz=$((filesize / 2))
81 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
82 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
86 md5sum $testdir/file1 | _filter_scratch
87 md5sum $testdir/file3 | _filter_scratch
88 md5sum $testdir/file1.chk | _filter_scratch