common/rc: check support for xfs_io copy_range -f N
authorAmir Goldstein <amir73il@gmail.com>
Mon, 15 Jul 2019 12:55:14 +0000 (15:55 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 21 Jul 2019 13:53:43 +0000 (21:53 +0800)
Implement "_require_xfs_io_command copy_range -f" to check for
the option added by following xfsprogs commit:

  10d4ca4aeff5 ("xfs_io: allow passing an open file to copy_range")

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index 827fa8826202114fc8bd7498925d457c7cea4255..3fe5647ec6581372bc6f64aca59dd888921fe78c 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2105,9 +2105,16 @@ _require_xfs_io_command()
                ;;
        "copy_range")
                local testcopy=$TEST_DIR/$$.copy.xfs_io
+               local copy_opts=$testfile
+               if [ "$param" == "-f" ]; then
+                       # source file is the open destination file
+                       testcopy=$testfile
+                       copy_opts="0 -d 4k"
+               fi
                $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1
-               testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1`
+               testio=`$XFS_IO_PROG -F -f -c "copy_range $param $copy_opts" $testcopy 2>&1`
                rm -f $testcopy > /dev/null 2>&1
+               param_checked="$param"
                ;;
        "falloc" )
                testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`