2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Test AIO CoW behavior.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
21 rm -rf $tmp.* $TEST_DIR/moo
24 # get standard environment, filters and checks
29 # real QA test starts here
32 _require_scratch_reflink
34 _require_xfs_io_command "cowextsize"
35 _require_aiodio "aiocp"
36 AIO_TEST="src/aio-dio-regress/aiocp"
41 echo "Format and mount"
42 _scratch_mkfs > $seqres.full 2>&1
43 _scratch_mount >> $seqres.full 2>&1
45 testdir=$SCRATCH_MNT/test-$seq
51 filesize=$((blksz * nr))
52 bufsize=$((blksz * bufnr))
56 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
58 echo "Create the original files"
59 $XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
60 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
61 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
65 md5sum $testdir/file1 | _filter_scratch
66 md5sum $testdir/file2 | _filter_scratch
68 echo "CoW and unmount"
69 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
70 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
72 $AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
76 md5sum $testdir/file1 | _filter_scratch
77 md5sum $testdir/file2 | _filter_scratch
79 echo "Check for damage"
81 _repair_scratch_fs >> $seqres.full