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
30 _require_scratch_reflink
32 _require_aiodio "aiocp"
33 AIO_TEST="$here/src/aio-dio-regress/aiocp"
38 echo "Format and mount"
39 _scratch_mkfs > $seqres.full 2>&1
40 _scratch_mount >> $seqres.full 2>&1
42 testdir=$SCRATCH_MNT/test-$seq
48 filesize=$((blksz * nr))
49 bufsize=$((blksz * bufnr))
51 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
53 echo "Create the original files"
54 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
55 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
59 md5sum $testdir/file1 | _filter_scratch
60 md5sum $testdir/file2 | _filter_scratch
62 echo "CoW and unmount"
63 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
64 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
66 $AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
70 md5sum $testdir/file1 | _filter_scratch
71 md5sum $testdir/file2 | _filter_scratch
73 echo "Check for damage"
75 _repair_scratch_fs >> $seqres.full