2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat, Inc. All Rights Reserved.
7 # Exercise copy_file_range() across devices supported by some
8 # filesystems since kernel commit:
10 # 5dae222a5ff0 vfs: allow copy_file_range to copy across devices
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 7 15
27 # get standard environment, filters and checks
31 # real QA test starts here
38 _require_xfs_io_command "copy_range"
40 _scratch_mkfs >>$seqres.full 2>&1
44 testdir=$TEST_DIR/test-$seq
49 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1
51 # expect success or EXDEV on filesystem/kernel that do not support
52 # cross-device copy_range
53 testio=`$XFS_IO_PROG -f -c "copy_range -l 128k $testdir/file" $SCRATCH_MNT/copy 2>&1`
54 echo $testio | grep -q "cross-device" && \
55 _notrun "$FSTYP does not support cross-device copy_file_range"
57 cmp $testdir/file $SCRATCH_MNT/copy
58 echo "md5sums after xdev copy:"
59 md5sum $testdir/file $SCRATCH_MNT/copy | _filter_testdir_and_scratch