2 # SPDX-License-Identifier: GPL-2.0
6 # Ensuring that copy on write in mmap mode works when the CoW
7 # range originally covers multiple extents, mixed with reflinked, unwritten,
8 # hole, regular and delalloc blocks.
9 # (MMAP version of generic/200,199)
10 # - Create a file with the following repeating sequence of blocks:
16 # - mmap CoW across the halfway mark, starting with the unwritten extent.
17 # - Check that the files are now different where we say they're different.
20 _begin_fstest auto quick clone punch
22 # Import common functions.
26 # real QA test starts here
27 _require_scratch_reflink
28 _require_scratch_delalloc
29 _require_xfs_io_command "falloc"
30 _require_xfs_io_command "fpunch"
32 echo "Format and mount"
33 _scratch_mkfs > $seqres.full 2>&1
34 _scratch_mount >> $seqres.full 2>&1
36 testdir=$SCRATCH_MNT/test-$seq
39 echo "Create the original files"
42 filesize=$((blksz * nr))
43 _weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
47 md5sum $testdir/file1 | _filter_scratch
48 md5sum $testdir/file3 | _filter_scratch
49 md5sum $testdir/file3.chk | _filter_scratch
51 echo "mmap CoW across the transition"
52 cowoff=$((filesize / 4))
53 cowsz=$((filesize / 2))
54 _weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
56 mmapsz=$((cowoff + cowsz))
57 _mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full
58 _mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full
62 md5sum $testdir/file1 | _filter_scratch
63 md5sum $testdir/file3 | _filter_scratch
64 md5sum $testdir/file3.chk | _filter_scratch