4 # Ensuring that copy on write in directio mode to the source file when the
5 # CoW range covers delalloc blocks 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 # - Write the even blocks of the first file.
11 # - DIO CoW the first file across the halfway mark, starting with the
13 # - Check that the files are now different where we say they're different.
15 #-----------------------------------------------------------------------
16 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation.
22 # This program is distributed in the hope that it would be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write the Free Software Foundation,
29 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #-----------------------------------------------------------------------
33 seqres=$RESULT_DIR/$seq
34 echo "QA output created by $seq"
38 status=1 # failure is the default!
39 trap "_cleanup; exit \$status" 0 1 2 3 15
47 # get standard environment, filters and checks
52 # real QA test starts here
54 _require_scratch_reflink
55 _require_xfs_io_command "falloc"
60 echo "Format and mount"
61 _scratch_mkfs > $seqres.full 2>&1
62 _scratch_mount >> $seqres.full 2>&1
64 testdir=$SCRATCH_MNT/test-$seq
67 echo "Create the original files"
70 filesize=$((blksz * nr))
71 _sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
75 md5sum $testdir/file1 | _filter_scratch
76 md5sum $testdir/file3 | _filter_scratch
77 md5sum $testdir/file1.chk | _filter_scratch
79 echo "CoW across the transition"
80 cowoff=$((filesize / 4))
81 cowsz=$((filesize / 2))
82 _sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
83 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
84 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
88 md5sum $testdir/file1 | _filter_scratch
89 md5sum $testdir/file3 | _filter_scratch
90 md5sum $testdir/file1.chk | _filter_scratch