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.
10 # - Reflink the odd blocks of the first file into the second file.
11 # - 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 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
35 # real QA test starts here
37 _require_scratch_reflink
38 _require_xfs_io_command "falloc"
42 echo "Format and mount"
43 _scratch_mkfs > $seqres.full 2>&1
44 _scratch_mount >> $seqres.full 2>&1
46 testdir=$SCRATCH_MNT/test-$seq
49 echo "Create the original files"
52 filesize=$((blksz * nr))
53 _sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
57 md5sum $testdir/file1 | _filter_scratch
58 md5sum $testdir/file3 | _filter_scratch
59 md5sum $testdir/file1.chk | _filter_scratch
61 echo "CoW across the transition"
62 cowoff=$((filesize / 4))
63 cowsz=$((filesize / 2))
64 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
65 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
69 md5sum $testdir/file1 | _filter_scratch
70 md5sum $testdir/file3 | _filter_scratch
71 md5sum $testdir/file1.chk | _filter_scratch