2 # SPDX-License-Identifier: GPL-2.0
6 # Ensuring that copy on write in mmap mode to the source file when the
7 # CoW range covers regular unshared and regular shared blocks.
8 # (MMAP version of generic/284,287)
10 # - Reflink the odd blocks of the first file into the second file.
11 # - mmap 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.
16 _begin_fstest auto quick clone
18 # Import common functions.
22 # real QA test starts here
23 _require_scratch_reflink
24 _require_xfs_io_command "falloc"
26 echo "Format and mount"
27 _scratch_mkfs > $seqres.full 2>&1
28 _scratch_mount >> $seqres.full 2>&1
30 testdir=$SCRATCH_MNT/test-$seq
33 echo "Create the original files"
36 filesize=$((blksz * nr))
37 _sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
41 md5sum $testdir/file1 | _filter_scratch
42 md5sum $testdir/file3 | _filter_scratch
43 md5sum $testdir/file1.chk | _filter_scratch
45 echo "mmap CoW across the transition"
46 cowoff=$((filesize / 4))
47 cowsz=$((filesize / 2))
48 mmapsz=$((cowoff + cowsz))
49 _mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full
50 _mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full
54 md5sum $testdir/file1 | _filter_scratch
55 md5sum $testdir/file3 | _filter_scratch
56 md5sum $testdir/file1.chk | _filter_scratch