2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
7 # See what happens if we dirty a lot of pages via CoW and immediately
11 _begin_fstest auto quick clone
13 # Override the default cleanup function.
17 rm -rf $tmp.* $testdir
20 # Import common functions.
24 # real QA test starts here
25 _require_scratch_reflink
26 _require_xfs_io_command "falloc"
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 _pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
40 _pwrite_byte 0x62 0 $filesize $testdir/file3 >> $seqres.full
41 _pwrite_byte 0x62 0 $filesize $testdir/file3.chk >> $seqres.full
42 seq 0 2 $((nr-1)) | while read f; do
43 _reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
44 _pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
49 md5sum $testdir/file1 | _filter_scratch
50 md5sum $testdir/file3 | _filter_scratch
51 md5sum $testdir/file3.chk | _filter_scratch
53 echo "CoW and unmount"
54 cowoff=$((filesize / 4))
55 cowsz=$((filesize / 2))
56 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full