2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensuring that copy on write in buffered mode to the source file when the
8 # CoW range covers regular unshared and regular shared blocks.
11 # - Reflink the odd blocks of the first file into the second file.
12 # - CoW the first file across the halfway mark, starting with the
14 # - Check that the files are now different where we say they're different.
17 _begin_fstest auto quick clone
19 # Import common functions.
23 # real QA test starts here
24 _require_scratch_reflink
25 _require_xfs_io_command "falloc"
26 _require_xfs_io_command "cowextsize"
28 echo "Format and mount"
29 _scratch_mkfs > $seqres.full 2>&1
30 _scratch_mount >> $seqres.full 2>&1
32 testdir=$SCRATCH_MNT/test-$seq
35 echo "Create the original files"
38 filesize=$((blksz * nr))
39 $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
40 _sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
44 md5sum $testdir/file1 | _filter_scratch
45 md5sum $testdir/file3 | _filter_scratch
46 md5sum $testdir/file1.chk | _filter_scratch
48 echo "CoW across the transition"
49 cowoff=$((filesize / 4))
50 cowsz=$((filesize / 2))
51 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
52 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
56 md5sum $testdir/file1 | _filter_scratch
57 md5sum $testdir/file3 | _filter_scratch
58 md5sum $testdir/file1.chk | _filter_scratch