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
39 _require_xfs_io_command "copy_range"
41 _scratch_mkfs >>$seqres.full 2>&1
45 testdir=$TEST_DIR/test-$seq
50 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1
52 # expect success or EXDEV on filesystem/kernel that do not support
53 # cross-device copy_range
54 testio=`$XFS_IO_PROG -f -c "copy_range -l 128k $testdir/file" $SCRATCH_MNT/copy 2>&1`
55 echo $testio | grep -q "cross-device" && \
56 _notrun "$FSTYP does not support cross-device copy_file_range"
58 cmp $testdir/file $SCRATCH_MNT/copy
59 echo "md5sums after xdev copy:"
60 md5sum $testdir/file $SCRATCH_MNT/copy | _filter_testdir_and_scratch