4 # Ensuring that copy on write in buffered mode to the source file when the
5 # CoW range covers regular unshared and regular shared blocks.
8 # - Reflink the odd blocks of the first file into the second file.
9 # - CoW the first file across the halfway mark, starting with the
11 # - Check that the files are now different where we say they're different.
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
31 seqres=$RESULT_DIR/$seq
32 echo "QA output created by $seq"
36 status=1 # failure is the default!
37 trap "_cleanup; exit \$status" 0 1 2 3 15
45 # get standard environment, filters and checks
50 # real QA test starts here
52 _require_scratch_reflink
53 _require_xfs_io_command "falloc"
54 _require_xfs_io_command "cowextsize"
58 echo "Format and mount"
59 _scratch_mkfs > $seqres.full 2>&1
60 _scratch_mount >> $seqres.full 2>&1
62 testdir=$SCRATCH_MNT/test-$seq
65 echo "Create the original files"
68 filesize=$((blksz * nr))
69 $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
70 _sweave_reflink_regular $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 -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