linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Add copy_file_range() tests
@ 2016-09-07 19:56 Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 1/4] generic/377: Add copy to new file test Anna Schumaker
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Anna Schumaker @ 2016-09-07 19:56 UTC (permalink / raw)
  To: fstests; +Cc: Anna.Schumaker, linux-nfs, hch

These tests exercise the copy_file_range() system call, and check copying
data to both a new file and overwriting data inside an existing file.  I use
the xfs_io "copy_range" command for the actual copies, so running these
tests requires an up-to-date version of xfsprogs.

Thanks,
Anna

Anna Schumaker (4):
  generic/377: Add copy to new file test
  generic/378: Add small copies to new file test
  generic/379: Add copy test that overwrites data
  generic/380: Add a copy test for overwriting small amounts of data

 tests/generic/377     | 102 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/377.out |  21 ++++++++++
 tests/generic/378     |  88 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/378.out |  14 +++++++
 tests/generic/379     | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/379.out |  17 ++++++++
 tests/generic/380     |  94 ++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/380.out |  17 ++++++++
 tests/generic/group   |   4 ++
 9 files changed, 464 insertions(+)
 create mode 100644 tests/generic/377
 create mode 100644 tests/generic/377.out
 create mode 100644 tests/generic/378
 create mode 100644 tests/generic/378.out
 create mode 100644 tests/generic/379
 create mode 100644 tests/generic/379.out
 create mode 100644 tests/generic/380
 create mode 100644 tests/generic/380.out

-- 
2.9.3


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] generic/377: Add copy to new file test
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
@ 2016-09-07 19:56 ` Anna Schumaker
  2016-09-09  6:21   ` Eryu Guan
  2016-09-07 19:56 ` [PATCH v2 2/4] generic/378: Add small copies " Anna Schumaker
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Anna Schumaker @ 2016-09-07 19:56 UTC (permalink / raw)
  To: fstests; +Cc: Anna.Schumaker, linux-nfs, hch

This test copies data from various points in a source file to a new
file.  This is useful for testing the basics of copy_file_range().

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 tests/generic/377     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/377.out |  21 +++++++++++
 tests/generic/group   |   1 +
 3 files changed, 124 insertions(+)
 create mode 100644 tests/generic/377
 create mode 100644 tests/generic/377.out

diff --git a/tests/generic/377 b/tests/generic/377
new file mode 100644
index 0000000..352b9bb
--- /dev/null
+++ b/tests/generic/377
@@ -0,0 +1,102 @@
+#!/bin/bash
+# FS QA Test No. 377
+#
+# Tests vfs_copy_file_range():
+#   - Copy a file
+#   - Copy beginning of original to new file
+#   - Copy middle of original to a new file
+#   - Copy end of original to new file
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Netapp, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+
+_checksum_files()
+{
+	for f in $*; do
+		md5sum $testdir/$f | _filter_test_dir
+	done
+}
+
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0    1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+cmp $testdir/file $testdir/copy
+echo "Original md5sums:"
+_checksum_files file copy
+
+echo "Copy beginning of original file"
+$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning"
+cmp -n 1000 $testdir/file $testdir/beginning
+echo "md5sums after copying beginning:"
+_checksum_files file beginning
+
+echo "Copy middle of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle"
+cmp -n 3000 $testdir/file $testdir/middle 1000
+echo "md5sums after copying middle:"
+_checksum_files file middle
+
+echo "Copy end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end"
+cmp -n 1000 $testdir/file $testdir/end 4000
+echo "md5sums after copying end:"
+_checksum_files file end
+
+echo "Copy beyond end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond"
+cmp -n 1000 $testdir/file $testdir/end 4000
+echo "md5sums after copying beyond:"
+_checksum_files file beyond
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/377.out b/tests/generic/377.out
new file mode 100644
index 0000000..8ad8b53
--- /dev/null
+++ b/tests/generic/377.out
@@ -0,0 +1,21 @@
+QA output created by 377
+Create the original file and then copy
+Original md5sums:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/copy
+Copy beginning of original file
+md5sums after copying beginning:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
+cabe45dcc9ae5b66ba86600cca6b8ba8  TEST_DIR/test-377/beginning
+Copy middle of original file
+md5sums after copying middle:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
+4197de9da5badfc302715486b82bcdf1  TEST_DIR/test-377/middle
+Copy end of original file
+md5sums after copying end:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
+e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/end
+Copy beyond end of original file
+md5sums after copying beyond:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
+e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/beyond
diff --git a/tests/generic/group b/tests/generic/group
index bad71bc..dec0d64 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -379,3 +379,4 @@
 374 auto quick clone dedupe
 375 auto quick acl
 376 auto quick metadata
+377 auto quick copy
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] generic/378: Add small copies to new file test
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 1/4] generic/377: Add copy to new file test Anna Schumaker
@ 2016-09-07 19:56 ` Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 3/4] generic/379: Add copy test that overwrites data Anna Schumaker
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Anna Schumaker @ 2016-09-07 19:56 UTC (permalink / raw)
  To: fstests; +Cc: Anna.Schumaker, linux-nfs, hch

This test copies single bytes from a source file into various new files
just to make sure that we can handle very small copies.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 tests/generic/378     | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/378.out | 14 ++++++++
 tests/generic/group   |  1 +
 3 files changed, 103 insertions(+)
 create mode 100644 tests/generic/378
 create mode 100644 tests/generic/378.out

diff --git a/tests/generic/378 b/tests/generic/378
new file mode 100644
index 0000000..0b3ad50
--- /dev/null
+++ b/tests/generic/378
@@ -0,0 +1,88 @@
+#!/bin/bash
+# FS QA Test No. 378
+#
+# Tests vfs_copy_file_range():
+#   - Copy a small file
+#   - Small copies from various points in the original file
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Netapp, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+
+_checksum_files()
+{
+	for f in $*; do
+		md5sum $testdir/$f | _filter_test_dir
+	done
+}
+
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+echo -n "abcde" > $testdir/file
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+echo -n "abcde" | cmp $testdir/copy
+echo "Original md5sums:"
+_checksum_files file copy
+
+echo "Small copies from various points in the original file"
+$XFS_IO_PROG -f -c "copy_range -s 0 -l 1 $testdir/file" "$testdir/a"
+$XFS_IO_PROG -f -c "copy_range -s 1 -l 1 $testdir/file" "$testdir/b"
+$XFS_IO_PROG -f -c "copy_range -s 2 -l 1 $testdir/file" "$testdir/c"
+$XFS_IO_PROG -f -c "copy_range -s 3 -l 1 $testdir/file" "$testdir/d"
+$XFS_IO_PROG -f -c "copy_range -s 4 -l 1 $testdir/file" "$testdir/e"
+$XFS_IO_PROG -f -c "copy_range -s 5 -l 1 $testdir/file" "$testdir/f"
+echo -n "a" | cmp $testdir/a
+echo -n "b" | cmp $testdir/b
+echo -n "c" | cmp $testdir/c
+echo -n "d" | cmp $testdir/d
+echo -n "e" | cmp $testdir/e
+echo -n ""  | cmp $testdir/f
+echo "md5sums after small copies"
+_checksum_files file a b c d e f
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/378.out b/tests/generic/378.out
new file mode 100644
index 0000000..5d63a71
--- /dev/null
+++ b/tests/generic/378.out
@@ -0,0 +1,14 @@
+QA output created by 378
+Create the original file and then copy
+Original md5sums:
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-378/file
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-378/copy
+Small copies from various points in the original file
+md5sums after small copies
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-378/file
+0cc175b9c0f1b6a831c399e269772661  TEST_DIR/test-378/a
+92eb5ffee6ae2fec3ad71c777531578f  TEST_DIR/test-378/b
+4a8a08f09d37b73795649038408b5f33  TEST_DIR/test-378/c
+8277e0910d750195b448797616e091ad  TEST_DIR/test-378/d
+e1671797c52e15f763380b45e841ec32  TEST_DIR/test-378/e
+d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-378/f
diff --git a/tests/generic/group b/tests/generic/group
index dec0d64..2147238 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -380,3 +380,4 @@
 375 auto quick acl
 376 auto quick metadata
 377 auto quick copy
+378 auto quick copy
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] generic/379: Add copy test that overwrites data
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 1/4] generic/377: Add copy to new file test Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 2/4] generic/378: Add small copies " Anna Schumaker
@ 2016-09-07 19:56 ` Anna Schumaker
  2016-09-07 19:56 ` [PATCH v2 4/4] generic/380: Add a copy test for overwriting small amounts of data Anna Schumaker
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Anna Schumaker @ 2016-09-07 19:56 UTC (permalink / raw)
  To: fstests; +Cc: Anna.Schumaker, linux-nfs, hch

Using copy to overwrite data in the destination file is perfectly valid,
so let's make sure this case works as expected.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 tests/generic/379     | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/379.out |  17 ++++++++
 tests/generic/group   |   1 +
 3 files changed, 125 insertions(+)
 create mode 100644 tests/generic/379
 create mode 100644 tests/generic/379.out

diff --git a/tests/generic/379 b/tests/generic/379
new file mode 100644
index 0000000..0a0faf3
--- /dev/null
+++ b/tests/generic/379
@@ -0,0 +1,107 @@
+#!/bin/bash
+# FS QA Test No. 379
+#
+# Tests vfs_copy_file_range():
+#   - Copy a file
+#   - Use copy to swap data at beginning and end
+#   - Use copy to swap data in the middle
+#   - Use copy to simultaneously overwrite and append to destination file
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Netapp, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+
+_checksum_files()
+{
+	for f in file copy; do
+		md5sum $testdir/$f | _filter_test_dir
+	done
+}
+
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0    1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+cmp $testdir/file  $testdir/copy
+echo "Original md5sums:"
+_checksum_files
+
+echo "Swap beginning and end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -f -c "copy_range -d 4000 -l 1000 $testdir/file" "$testdir/copy"
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 3000 $testdir/file $testdir/copy 1000 1000
+cmp -n 1000 $testdir/file $testdir/copy 0 4000
+echo "md5sums after swapping beginning and end:"
+_checksum_files
+
+echo "Swap middle parts of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 1000 $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -f -c "copy_range -s 3000 -d 1000 -l 1000 $testdir/file" "$testdir/copy"
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 1000 $testdir/file $testdir/copy 3000 1000
+cmp -n 1000 $testdir/file $testdir/copy 2000 2000
+cmp -n 1000 $testdir/file $testdir/copy 1000 3000
+cmp -n 1000 $testdir/file $testdir/copy 0 4000
+echo "md5sums after swapping middle:"
+_checksum_files
+
+echo "Copy tail of original file onto copy"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 4000 $testdir/file" "$testdir/copy"
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 1000 $testdir/file $testdir/copy 3000 1000
+cmp -n 1000 $testdir/file $testdir/copy 2000 2000
+cmp -n 4000 $testdir/file $testdir/copy 1000 3000
+echo "md5sums after copying tail:"
+_checksum_files
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/379.out b/tests/generic/379.out
new file mode 100644
index 0000000..269d6ac
--- /dev/null
+++ b/tests/generic/379.out
@@ -0,0 +1,17 @@
+QA output created by 379
+Create the original file and then copy
+Original md5sums:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-379/file
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-379/copy
+Swap beginning and end of original file
+md5sums after swapping beginning and end:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-379/file
+5f4e111811dd9a810143c9db9bec6d80  TEST_DIR/test-379/copy
+Swap middle parts of original file
+md5sums after swapping middle:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-379/file
+8c81889a5a50b311197110bcf769a695  TEST_DIR/test-379/copy
+Copy tail of original file onto copy
+md5sums after copying tail:
+e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-379/file
+e5fbacd993eaa5e80ebc2b14b969887d  TEST_DIR/test-379/copy
diff --git a/tests/generic/group b/tests/generic/group
index 2147238..8accae0 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -381,3 +381,4 @@
 376 auto quick metadata
 377 auto quick copy
 378 auto quick copy
+379 auto quick copy
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] generic/380: Add a copy test for overwriting small amounts of data
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
                   ` (2 preceding siblings ...)
  2016-09-07 19:56 ` [PATCH v2 3/4] generic/379: Add copy test that overwrites data Anna Schumaker
@ 2016-09-07 19:56 ` Anna Schumaker
  2016-09-17 17:03 ` [PATCH v2 0/4] Add copy_file_range() tests Darrick J. Wong
  2016-10-26  8:26 ` Christoph Hellwig
  5 siblings, 0 replies; 16+ messages in thread
From: Anna Schumaker @ 2016-09-07 19:56 UTC (permalink / raw)
  To: fstests; +Cc: Anna.Schumaker, linux-nfs, hch

This test is similar to 345, except that it copies one byte at a time to
make sure that this case works as expected.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 tests/generic/380     | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/380.out | 17 ++++++++++
 tests/generic/group   |  1 +
 3 files changed, 112 insertions(+)
 create mode 100644 tests/generic/380
 create mode 100644 tests/generic/380.out

diff --git a/tests/generic/380 b/tests/generic/380
new file mode 100644
index 0000000..8ca51e4
--- /dev/null
+++ b/tests/generic/380
@@ -0,0 +1,94 @@
+#!/bin/bash
+# FS QA Test No. 380
+#
+# Tests vfs_copy_file_range():
+#   - Copy a small file
+#   - Use copy to swap data at beginning and end
+#   - Use copy to swap data in the middle
+#   - Use copy to swap data in a small file
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Netapp, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+
+_checksum_files()
+{
+	for f in file copy; do
+		md5sum $testdir/$f | _filter_test_dir
+	done
+}
+
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+echo -n "abcde" > $testdir/file
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+cmp $testdir/file $testdir/copy
+echo "Original md5sums:"
+_checksum_files
+
+echo "Swap beginning and end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 0 -d 4 -l 1 $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -f -c "copy_range -s 4 -d 0 -l 1 $testdir/file" "$testdir/copy"
+echo -n "ebcda" | cmp $testdir/copy
+echo "md5sums after swapping beginning and end:"
+_checksum_files
+
+echo "Swap middle parts of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 1 $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -f -c "copy_range -s 3 -d 1 -l 1 $testdir/file" "$testdir/copy"
+echo -n "edcba" | cmp $testdir/copy
+echo "md5sums after swapping middle:"
+_checksum_files
+
+echo "Copy tail of original file onto copy"
+$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 4 $testdir/file" "$testdir/copy"
+echo -n "edcbcde" | cmp $testdir/copy
+echo "md5sums after copying tail:"
+_checksum_files
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/380.out b/tests/generic/380.out
new file mode 100644
index 0000000..4159613
--- /dev/null
+++ b/tests/generic/380.out
@@ -0,0 +1,17 @@
+QA output created by 380
+Create the original file and then copy
+Original md5sums:
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-380/file
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-380/copy
+Swap beginning and end of original file
+md5sums after swapping beginning and end:
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-380/file
+32db1f6d06d15f7e38e1ab1c69da498a  TEST_DIR/test-380/copy
+Swap middle parts of original file
+md5sums after swapping middle:
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-380/file
+295228f3d82d344bbcf2f0030519c2ea  TEST_DIR/test-380/copy
+Copy tail of original file onto copy
+md5sums after copying tail:
+ab56b4d92b40713acc5af89985d4b786  TEST_DIR/test-380/file
+0c4aac952f72fa078e2f8419aca70b28  TEST_DIR/test-380/copy
diff --git a/tests/generic/group b/tests/generic/group
index 8accae0..2b3e4e0 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -382,3 +382,4 @@
 377 auto quick copy
 378 auto quick copy
 379 auto quick copy
+380 auto quick copy
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] generic/377: Add copy to new file test
  2016-09-07 19:56 ` [PATCH v2 1/4] generic/377: Add copy to new file test Anna Schumaker
@ 2016-09-09  6:21   ` Eryu Guan
  2016-09-09  6:29     ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Eryu Guan @ 2016-09-09  6:21 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: fstests, linux-nfs, hch

On Wed, Sep 07, 2016 at 03:56:16PM -0400, Anna Schumaker wrote:
> This test copies data from various points in a source file to a new
> file.  This is useful for testing the basics of copy_file_range().
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  tests/generic/377     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/377.out |  21 +++++++++++
>  tests/generic/group   |   1 +
>  3 files changed, 124 insertions(+)
>  create mode 100644 tests/generic/377

File mode of test case should be 755, i.e. it has x permission. So "git
diff" won't complain the mode change after running these tests.

>  create mode 100644 tests/generic/377.out
> 
> diff --git a/tests/generic/377 b/tests/generic/377
> new file mode 100644
> index 0000000..352b9bb
> --- /dev/null
> +++ b/tests/generic/377
> @@ -0,0 +1,102 @@
> +#!/bin/bash
> +# FS QA Test No. 377
> +#
> +# Tests vfs_copy_file_range():
> +#   - Copy a file
> +#   - Copy beginning of original to new file
> +#   - Copy middle of original to a new file
> +#   - Copy end of original to new file
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 Netapp, Inc. All rights reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf $tmp.*
> +}
> +
> +# get standard environment
> +. common/rc
> +. common/filter
> +
> +# real QA test starts here
> +_supported_os Linux

Need "_supported_fs generic" in all these tests.

> +
> +_require_xfs_io_command "copy_range"

Do we need to test the support status on kernel side? e.g. what happens
if filesystems have no "copy_file_range" implemented? Seems
copy_file_range falls back to splice in this case, but I'm not sure. If
so I think it's OK to have no kernel side detection.

> +_require_test
> +
> +testdir=$TEST_DIR/test-$seq
> +rm -rf $testdir
> +mkdir $testdir
> +
> +_checksum_files()

We usually name local functions without the leading "_".

> +{
> +	for f in $*; do
> +		md5sum $testdir/$f | _filter_test_dir
> +	done
> +}
> +
> +rm -f $seqres.full
> +
> +echo "Create the original file and then copy"
> +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0    1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +cmp $testdir/file $testdir/copy
> +echo "Original md5sums:"
> +_checksum_files file copy

I saw test failures when testing on XFS and btrfs, 4.8-rc3 kernel, and
similar failures in other tests. Are these failures expected?

[root@dhcp-66-86-11 xfstests]# diff -u tests/generic/377.out /root/workspace/xfstests/results//xfs_4k_crc/generic/377.out.bad
--- tests/generic/377.out       2016-09-09 12:17:40.790000000 +0800
+++ /root/workspace/xfstests/results//xfs_4k_crc/generic/377.out.bad    2016-09-09 14:14:48.483000000 +0800
@@ -4,18 +4,22 @@
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/copy
 Copy beginning of original file
+cmp: EOF on /mnt/testarea/test/test-377/beginning
 md5sums after copying beginning:
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
-cabe45dcc9ae5b66ba86600cca6b8ba8  TEST_DIR/test-377/beginning
+d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/beginning
 Copy middle of original file
+cmp: EOF on /mnt/testarea/test/test-377/middle
 md5sums after copying middle:
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
-4197de9da5badfc302715486b82bcdf1  TEST_DIR/test-377/middle
+d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/middle
 Copy end of original file
+cmp: EOF on /mnt/testarea/test/test-377/end
 md5sums after copying end:
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
-e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/end
+d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/end
 Copy beyond end of original file
+cmp: EOF on /mnt/testarea/test/test-377/end
 md5sums after copying beyond:
 e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
-e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/beyond
+d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/beyond

> +
> +echo "Copy beginning of original file"
> +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning"
> +cmp -n 1000 $testdir/file $testdir/beginning
> +echo "md5sums after copying beginning:"
> +_checksum_files file beginning
> +
> +echo "Copy middle of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle"
> +cmp -n 3000 $testdir/file $testdir/middle 1000
> +echo "md5sums after copying middle:"
> +_checksum_files file middle
> +
> +echo "Copy end of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end"
> +cmp -n 1000 $testdir/file $testdir/end 4000
> +echo "md5sums after copying end:"
> +_checksum_files file end
> +
> +echo "Copy beyond end of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond"

I noticed that xfs_io hung on copying beyond EOF when testing with ext4
and NFSv4.1, xfs_io was in "R" state for 10 minutes until I killed it.
Is it kernel bug or test is not suitable on such filesystems?

Thanks,
Eryu

> +cmp -n 1000 $testdir/file $testdir/end 4000
> +echo "md5sums after copying beyond:"
> +_checksum_files file beyond
> +
> +#success, all done
> +status=0
> +exit
> diff --git a/tests/generic/377.out b/tests/generic/377.out
> new file mode 100644
> index 0000000..8ad8b53
> --- /dev/null
> +++ b/tests/generic/377.out
> @@ -0,0 +1,21 @@
> +QA output created by 377
> +Create the original file and then copy
> +Original md5sums:
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/copy
> +Copy beginning of original file
> +md5sums after copying beginning:
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> +cabe45dcc9ae5b66ba86600cca6b8ba8  TEST_DIR/test-377/beginning
> +Copy middle of original file
> +md5sums after copying middle:
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> +4197de9da5badfc302715486b82bcdf1  TEST_DIR/test-377/middle
> +Copy end of original file
> +md5sums after copying end:
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> +e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/end
> +Copy beyond end of original file
> +md5sums after copying beyond:
> +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> +e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/beyond
> diff --git a/tests/generic/group b/tests/generic/group
> index bad71bc..dec0d64 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -379,3 +379,4 @@
>  374 auto quick clone dedupe
>  375 auto quick acl
>  376 auto quick metadata
> +377 auto quick copy
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] generic/377: Add copy to new file test
  2016-09-09  6:21   ` Eryu Guan
@ 2016-09-09  6:29     ` Darrick J. Wong
  2016-09-09  7:01       ` Eryu Guan
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2016-09-09  6:29 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Anna Schumaker, fstests, linux-nfs, hch

On Fri, Sep 09, 2016 at 02:21:36PM +0800, Eryu Guan wrote:
> On Wed, Sep 07, 2016 at 03:56:16PM -0400, Anna Schumaker wrote:
> > This test copies data from various points in a source file to a new
> > file.  This is useful for testing the basics of copy_file_range().
> > 
> > Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > ---
> >  tests/generic/377     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/377.out |  21 +++++++++++
> >  tests/generic/group   |   1 +
> >  3 files changed, 124 insertions(+)
> >  create mode 100644 tests/generic/377
> 
> File mode of test case should be 755, i.e. it has x permission. So "git
> diff" won't complain the mode change after running these tests.
> 
> >  create mode 100644 tests/generic/377.out
> > 
> > diff --git a/tests/generic/377 b/tests/generic/377
> > new file mode 100644
> > index 0000000..352b9bb
> > --- /dev/null
> > +++ b/tests/generic/377
> > @@ -0,0 +1,102 @@
> > +#!/bin/bash
> > +# FS QA Test No. 377
> > +#
> > +# Tests vfs_copy_file_range():
> > +#   - Copy a file
> > +#   - Copy beginning of original to new file
> > +#   - Copy middle of original to a new file
> > +#   - Copy end of original to new file
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016 Netapp, Inc. All rights reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf $tmp.*
> > +}
> > +
> > +# get standard environment
> > +. common/rc
> > +. common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> 
> Need "_supported_fs generic" in all these tests.
> 
> > +
> > +_require_xfs_io_command "copy_range"
> 
> Do we need to test the support status on kernel side? e.g. what happens
> if filesystems have no "copy_file_range" implemented? Seems
> copy_file_range falls back to splice in this case, but I'm not sure. If
> so I think it's OK to have no kernel side detection.

But... it's a totally new syscall, so _require_io_command should actually try
calling it so that we can _notrun on old kernels.

> > +_require_test
> > +
> > +testdir=$TEST_DIR/test-$seq
> > +rm -rf $testdir
> > +mkdir $testdir
> > +
> > +_checksum_files()
> 
> We usually name local functions without the leading "_".
> 
> > +{
> > +	for f in $*; do
> > +		md5sum $testdir/$f | _filter_test_dir
> > +	done
> > +}

Or perhaps just "md5sum file copy | _filter_test_dir" directly?

--D

> > +
> > +rm -f $seqres.full
> > +
> > +echo "Create the original file and then copy"
> > +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0    1000' $testdir/file >> $seqres.full 2>&1
> > +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
> > +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
> > +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
> > +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
> > +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > +cmp $testdir/file $testdir/copy
> > +echo "Original md5sums:"
> > +_checksum_files file copy
> 
> I saw test failures when testing on XFS and btrfs, 4.8-rc3 kernel, and
> similar failures in other tests. Are these failures expected?
> 
> [root@dhcp-66-86-11 xfstests]# diff -u tests/generic/377.out /root/workspace/xfstests/results//xfs_4k_crc/generic/377.out.bad
> --- tests/generic/377.out       2016-09-09 12:17:40.790000000 +0800
> +++ /root/workspace/xfstests/results//xfs_4k_crc/generic/377.out.bad    2016-09-09 14:14:48.483000000 +0800
> @@ -4,18 +4,22 @@
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/copy
>  Copy beginning of original file
> +cmp: EOF on /mnt/testarea/test/test-377/beginning
>  md5sums after copying beginning:
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> -cabe45dcc9ae5b66ba86600cca6b8ba8  TEST_DIR/test-377/beginning
> +d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/beginning
>  Copy middle of original file
> +cmp: EOF on /mnt/testarea/test/test-377/middle
>  md5sums after copying middle:
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> -4197de9da5badfc302715486b82bcdf1  TEST_DIR/test-377/middle
> +d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/middle
>  Copy end of original file
> +cmp: EOF on /mnt/testarea/test/test-377/end
>  md5sums after copying end:
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> -e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/end
> +d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/end
>  Copy beyond end of original file
> +cmp: EOF on /mnt/testarea/test/test-377/end
>  md5sums after copying beyond:
>  e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> -e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/beyond
> +d41d8cd98f00b204e9800998ecf8427e  TEST_DIR/test-377/beyond
> 
> > +
> > +echo "Copy beginning of original file"
> > +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning"
> > +cmp -n 1000 $testdir/file $testdir/beginning
> > +echo "md5sums after copying beginning:"
> > +_checksum_files file beginning
> > +
> > +echo "Copy middle of original file"
> > +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle"
> > +cmp -n 3000 $testdir/file $testdir/middle 1000
> > +echo "md5sums after copying middle:"
> > +_checksum_files file middle
> > +
> > +echo "Copy end of original file"
> > +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end"
> > +cmp -n 1000 $testdir/file $testdir/end 4000
> > +echo "md5sums after copying end:"
> > +_checksum_files file end
> > +
> > +echo "Copy beyond end of original file"
> > +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond"
> 
> I noticed that xfs_io hung on copying beyond EOF when testing with ext4
> and NFSv4.1, xfs_io was in "R" state for 10 minutes until I killed it.
> Is it kernel bug or test is not suitable on such filesystems?
> 
> Thanks,
> Eryu
> 
> > +cmp -n 1000 $testdir/file $testdir/end 4000
> > +echo "md5sums after copying beyond:"
> > +_checksum_files file beyond
> > +
> > +#success, all done
> > +status=0
> > +exit
> > diff --git a/tests/generic/377.out b/tests/generic/377.out
> > new file mode 100644
> > index 0000000..8ad8b53
> > --- /dev/null
> > +++ b/tests/generic/377.out
> > @@ -0,0 +1,21 @@
> > +QA output created by 377
> > +Create the original file and then copy
> > +Original md5sums:
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/copy
> > +Copy beginning of original file
> > +md5sums after copying beginning:
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> > +cabe45dcc9ae5b66ba86600cca6b8ba8  TEST_DIR/test-377/beginning
> > +Copy middle of original file
> > +md5sums after copying middle:
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> > +4197de9da5badfc302715486b82bcdf1  TEST_DIR/test-377/middle
> > +Copy end of original file
> > +md5sums after copying end:
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> > +e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/end
> > +Copy beyond end of original file
> > +md5sums after copying beyond:
> > +e11fbace556cba26bf0076e74cab90a3  TEST_DIR/test-377/file
> > +e68d4a150c4e42f4f9ea3ffe4c9cf4ed  TEST_DIR/test-377/beyond
> > diff --git a/tests/generic/group b/tests/generic/group
> > index bad71bc..dec0d64 100644
> > --- a/tests/generic/group
> > +++ b/tests/generic/group
> > @@ -379,3 +379,4 @@
> >  374 auto quick clone dedupe
> >  375 auto quick acl
> >  376 auto quick metadata
> > +377 auto quick copy
> > -- 
> > 2.9.3
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] generic/377: Add copy to new file test
  2016-09-09  6:29     ` Darrick J. Wong
@ 2016-09-09  7:01       ` Eryu Guan
  2016-09-11 23:10         ` Dave Chinner
  0 siblings, 1 reply; 16+ messages in thread
From: Eryu Guan @ 2016-09-09  7:01 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Anna Schumaker, fstests, linux-nfs, hch

On Thu, Sep 08, 2016 at 11:29:25PM -0700, Darrick J. Wong wrote:
> > > +
> > > +_require_xfs_io_command "copy_range"
> > 
> > Do we need to test the support status on kernel side? e.g. what happens
> > if filesystems have no "copy_file_range" implemented? Seems
> > copy_file_range falls back to splice in this case, but I'm not sure. If
> > so I think it's OK to have no kernel side detection.
> 
> But... it's a totally new syscall, so _require_io_command should actually try
> calling it so that we can _notrun on old kernels.

The only reason that I think it's OK to check xfs_io support only is
that the "copy_range" subcommand won't be even compiled in xfs_io if
kernel has no copy_file_range syscall support.

But yeah, I agree that calling it and see how kernel handles it would be
the best option, like how we handle falloc, fpunch in
_require_xfs_io_command.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] generic/377: Add copy to new file test
  2016-09-09  7:01       ` Eryu Guan
@ 2016-09-11 23:10         ` Dave Chinner
  0 siblings, 0 replies; 16+ messages in thread
From: Dave Chinner @ 2016-09-11 23:10 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Darrick J. Wong, Anna Schumaker, fstests, linux-nfs, hch

On Fri, Sep 09, 2016 at 03:01:46PM +0800, Eryu Guan wrote:
> On Thu, Sep 08, 2016 at 11:29:25PM -0700, Darrick J. Wong wrote:
> > > > +
> > > > +_require_xfs_io_command "copy_range"
> > > 
> > > Do we need to test the support status on kernel side? e.g. what happens
> > > if filesystems have no "copy_file_range" implemented? Seems
> > > copy_file_range falls back to splice in this case, but I'm not sure. If
> > > so I think it's OK to have no kernel side detection.
> > 
> > But... it's a totally new syscall, so _require_io_command should actually try
> > calling it so that we can _notrun on old kernels.
> 
> The only reason that I think it's OK to check xfs_io support only is
> that the "copy_range" subcommand won't be even compiled in xfs_io if
> kernel has no copy_file_range syscall support.

It's not uncommon to have an xfs_io that will support a new syscall
or syscall flags by directly coding the support when it's
not found by the configure script. e.g. io/prealloc.c support for
all the different fallocate flags, regardless of whether the
underlying kernel or userspace headers support them.

> But yeah, I agree that calling it and see how kernel handles it would be
> the best option, like how we handle falloc, fpunch in
> _require_xfs_io_command.

Which we do for precisely the reason above. :P

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
                   ` (3 preceding siblings ...)
  2016-09-07 19:56 ` [PATCH v2 4/4] generic/380: Add a copy test for overwriting small amounts of data Anna Schumaker
@ 2016-09-17 17:03 ` Darrick J. Wong
  2016-10-26  8:26 ` Christoph Hellwig
  5 siblings, 0 replies; 16+ messages in thread
From: Darrick J. Wong @ 2016-09-17 17:03 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: fstests, linux-nfs, hch

On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
> These tests exercise the copy_file_range() system call, and check copying
> data to both a new file and overwriting data inside an existing file.  I use
> the xfs_io "copy_range" command for the actual copies, so running these
> tests requires an up-to-date version of xfsprogs.
> 
> Thanks,
> Anna
> 
> Anna Schumaker (4):
>   generic/377: Add copy to new file test
>   generic/378: Add small copies to new file test
>   generic/379: Add copy test that overwrites data
>   generic/380: Add a copy test for overwriting small amounts of data

By the way, do you have a test to check that invalid inputs produce
the error codes listed in the manpage?

--D

> 
>  tests/generic/377     | 102 +++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/377.out |  21 ++++++++++
>  tests/generic/378     |  88 +++++++++++++++++++++++++++++++++++++++++
>  tests/generic/378.out |  14 +++++++
>  tests/generic/379     | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/379.out |  17 ++++++++
>  tests/generic/380     |  94 ++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/380.out |  17 ++++++++
>  tests/generic/group   |   4 ++
>  9 files changed, 464 insertions(+)
>  create mode 100644 tests/generic/377
>  create mode 100644 tests/generic/377.out
>  create mode 100644 tests/generic/378
>  create mode 100644 tests/generic/378.out
>  create mode 100644 tests/generic/379
>  create mode 100644 tests/generic/379.out
>  create mode 100644 tests/generic/380
>  create mode 100644 tests/generic/380.out
> 
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
                   ` (4 preceding siblings ...)
  2016-09-17 17:03 ` [PATCH v2 0/4] Add copy_file_range() tests Darrick J. Wong
@ 2016-10-26  8:26 ` Christoph Hellwig
  2016-11-25  8:05   ` Christoph Hellwig
  5 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2016-10-26  8:26 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: fstests, linux-nfs, hch

On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
> These tests exercise the copy_file_range() system call, and check copying
> data to both a new file and overwriting data inside an existing file.  I use
> the xfs_io "copy_range" command for the actual copies, so running these
> tests requires an up-to-date version of xfsprogs.

Hi Anna,

what's the status of these tests?  Did you get a chance to look
into xfs_io copyfile support?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-10-26  8:26 ` Christoph Hellwig
@ 2016-11-25  8:05   ` Christoph Hellwig
  2016-11-29 20:47     ` J. Bruce Fields
  0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2016-11-25  8:05 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: fstests, linux-nfs

On Wed, Oct 26, 2016 at 01:26:38AM -0700, Christoph Hellwig wrote:
> On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
> > These tests exercise the copy_file_range() system call, and check copying
> > data to both a new file and overwriting data inside an existing file.  I use
> > the xfs_io "copy_range" command for the actual copies, so running these
> > tests requires an up-to-date version of xfsprogs.
> 
> Hi Anna,
> 
> what's the status of these tests?  Did you get a chance to look
> into xfs_io copyfile support?

Another month, another ping - it would be really sad to not have any
real testing for copy_file_range.  I've been holding a pending change
for it back for month now because I want to verify it more than cursory,
but I guess I'll just have to send it anyway.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-11-25  8:05   ` Christoph Hellwig
@ 2016-11-29 20:47     ` J. Bruce Fields
  2016-11-29 20:59       ` Anna Schumaker
  0 siblings, 1 reply; 16+ messages in thread
From: J. Bruce Fields @ 2016-11-29 20:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Anna Schumaker, fstests, linux-nfs

On Fri, Nov 25, 2016 at 12:05:10AM -0800, Christoph Hellwig wrote:
> On Wed, Oct 26, 2016 at 01:26:38AM -0700, Christoph Hellwig wrote:
> > On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
> > > These tests exercise the copy_file_range() system call, and check copying
> > > data to both a new file and overwriting data inside an existing file.  I use
> > > the xfs_io "copy_range" command for the actual copies, so running these
> > > tests requires an up-to-date version of xfsprogs.
> > 
> > Hi Anna,
> > 
> > what's the status of these tests?  Did you get a chance to look
> > into xfs_io copyfile support?
> 
> Another month, another ping - it would be really sad to not have any
> real testing for copy_file_range.

Agreed, Anna, are you still planning on doing this?

--b.

> I've been holding a pending change
> for it back for month now because I want to verify it more than cursory,
> but I guess I'll just have to send it anyway.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-11-29 20:47     ` J. Bruce Fields
@ 2016-11-29 20:59       ` Anna Schumaker
  2016-11-29 23:21         ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Anna Schumaker @ 2016-11-29 20:59 UTC (permalink / raw)
  To: J. Bruce Fields, Christoph Hellwig; +Cc: fstests, linux-nfs

Sorry for the delay!  I've been busy looking at other things and forgot to update the copy_file_range() stuff :(

On 11/29/2016 03:47 PM, J. Bruce Fields wrote:
> On Fri, Nov 25, 2016 at 12:05:10AM -0800, Christoph Hellwig wrote:
>> On Wed, Oct 26, 2016 at 01:26:38AM -0700, Christoph Hellwig wrote:
>>> On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
>>>> These tests exercise the copy_file_range() system call, and check copying
>>>> data to both a new file and overwriting data inside an existing file.  I use
>>>> the xfs_io "copy_range" command for the actual copies, so running these
>>>> tests requires an up-to-date version of xfsprogs.
>>>
>>> Hi Anna,
>>>
>>> what's the status of these tests?  Did you get a chance to look
>>> into xfs_io copyfile support?

xfs_io has support for copying now, so I'll make sure that the tests use that correctly.  I promise to send out an update this week, once I check that everything still works!

Thanks for the reminders,
Anna

>>
>> Another month, another ping - it would be really sad to not have any
>> real testing for copy_file_range.
> 
> Agreed, Anna, are you still planning on doing this?
> 
> --b.
> 
>> I've been holding a pending change
>> for it back for month now because I want to verify it more than cursory,
>> but I guess I'll just have to send it anyway.
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-11-29 20:59       ` Anna Schumaker
@ 2016-11-29 23:21         ` Darrick J. Wong
  2016-12-02 20:00           ` Anna Schumaker
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2016-11-29 23:21 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: J. Bruce Fields, Christoph Hellwig, fstests, linux-nfs

On Tue, Nov 29, 2016 at 03:59:29PM -0500, Anna Schumaker wrote:

> Sorry for the delay!  I've been busy looking at other things and
> forgot to update the copy_file_range() stuff :(

While you're at it, please make a test to check the return value for
invalid inputs.  I'd prefer we avoid repeating what happened with the
vfs dedupe ioctl.

--D

> 
> On 11/29/2016 03:47 PM, J. Bruce Fields wrote:
> > On Fri, Nov 25, 2016 at 12:05:10AM -0800, Christoph Hellwig wrote:
> >> On Wed, Oct 26, 2016 at 01:26:38AM -0700, Christoph Hellwig wrote:
> >>> On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
> >>>> These tests exercise the copy_file_range() system call, and check copying
> >>>> data to both a new file and overwriting data inside an existing file.  I use
> >>>> the xfs_io "copy_range" command for the actual copies, so running these
> >>>> tests requires an up-to-date version of xfsprogs.
> >>>
> >>> Hi Anna,
> >>>
> >>> what's the status of these tests?  Did you get a chance to look
> >>> into xfs_io copyfile support?
> 
> xfs_io has support for copying now, so I'll make sure that the tests
> use that correctly.  I promise to send out an update this week, once I
> check that everything still works!
> 
> Thanks for the reminders,
> Anna
> 
> >>
> >> Another month, another ping - it would be really sad to not have any
> >> real testing for copy_file_range.
> > 
> > Agreed, Anna, are you still planning on doing this?
> > 
> > --b.
> > 
> >> I've been holding a pending change
> >> for it back for month now because I want to verify it more than cursory,
> >> but I guess I'll just have to send it anyway.
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] Add copy_file_range() tests
  2016-11-29 23:21         ` Darrick J. Wong
@ 2016-12-02 20:00           ` Anna Schumaker
  0 siblings, 0 replies; 16+ messages in thread
From: Anna Schumaker @ 2016-12-02 20:00 UTC (permalink / raw)
  To: Darrick J. Wong, Anna Schumaker
  Cc: J. Bruce Fields, Christoph Hellwig, fstests, linux-nfs



On 11/29/2016 06:21 PM, Darrick J. Wong wrote:
> On Tue, Nov 29, 2016 at 03:59:29PM -0500, Anna Schumaker wrote:
> 
>> Sorry for the delay!  I've been busy looking at other things and
>> forgot to update the copy_file_range() stuff :(
> 
> While you're at it, please make a test to check the return value for
> invalid inputs.  I'd prefer we avoid repeating what happened with the
> vfs dedupe ioctl.

I'll see what I can do.  So far I've updated the tests with the other comments and added in the "copy_range" check directly to _require_xfs_io_command().  I'll play with error codes next week and then resubmit.

Anna

> 
> --D
> 
>>
>> On 11/29/2016 03:47 PM, J. Bruce Fields wrote:
>>> On Fri, Nov 25, 2016 at 12:05:10AM -0800, Christoph Hellwig wrote:
>>>> On Wed, Oct 26, 2016 at 01:26:38AM -0700, Christoph Hellwig wrote:
>>>>> On Wed, Sep 07, 2016 at 03:56:15PM -0400, Anna Schumaker wrote:
>>>>>> These tests exercise the copy_file_range() system call, and check copying
>>>>>> data to both a new file and overwriting data inside an existing file.  I use
>>>>>> the xfs_io "copy_range" command for the actual copies, so running these
>>>>>> tests requires an up-to-date version of xfsprogs.
>>>>>
>>>>> Hi Anna,
>>>>>
>>>>> what's the status of these tests?  Did you get a chance to look
>>>>> into xfs_io copyfile support?
>>
>> xfs_io has support for copying now, so I'll make sure that the tests
>> use that correctly.  I promise to send out an update this week, once I
>> check that everything still works!
>>
>> Thanks for the reminders,
>> Anna
>>
>>>>
>>>> Another month, another ping - it would be really sad to not have any
>>>> real testing for copy_file_range.
>>>
>>> Agreed, Anna, are you still planning on doing this?
>>>
>>> --b.
>>>
>>>> I've been holding a pending change
>>>> for it back for month now because I want to verify it more than cursory,
>>>> but I guess I'll just have to send it anyway.
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-12-02 20:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-07 19:56 [PATCH v2 0/4] Add copy_file_range() tests Anna Schumaker
2016-09-07 19:56 ` [PATCH v2 1/4] generic/377: Add copy to new file test Anna Schumaker
2016-09-09  6:21   ` Eryu Guan
2016-09-09  6:29     ` Darrick J. Wong
2016-09-09  7:01       ` Eryu Guan
2016-09-11 23:10         ` Dave Chinner
2016-09-07 19:56 ` [PATCH v2 2/4] generic/378: Add small copies " Anna Schumaker
2016-09-07 19:56 ` [PATCH v2 3/4] generic/379: Add copy test that overwrites data Anna Schumaker
2016-09-07 19:56 ` [PATCH v2 4/4] generic/380: Add a copy test for overwriting small amounts of data Anna Schumaker
2016-09-17 17:03 ` [PATCH v2 0/4] Add copy_file_range() tests Darrick J. Wong
2016-10-26  8:26 ` Christoph Hellwig
2016-11-25  8:05   ` Christoph Hellwig
2016-11-29 20:47     ` J. Bruce Fields
2016-11-29 20:59       ` Anna Schumaker
2016-11-29 23:21         ` Darrick J. Wong
2016-12-02 20:00           ` Anna Schumaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).