* [PATCH 1/3] fstests: generic/373: change test to validate cross-vfsmount reflink
2022-03-24 20:24 [PATCH 0/3] fstests: cross-vfsmount reflink changes Josef Bacik
@ 2022-03-24 20:24 ` Josef Bacik
2022-03-25 0:07 ` Dave Chinner
2022-03-24 20:24 ` [PATCH 2/3] fstests: generic/374: validate cross-vfsmount dedupe Josef Bacik
2022-03-24 20:24 ` [PATCH 3/3] fstests: btrfs/029: change the cross vfsmount reflink test Josef Bacik
2 siblings, 1 reply; 6+ messages in thread
From: Josef Bacik @ 2022-03-24 20:24 UTC (permalink / raw)
To: linux-btrfs, fstests
We now allow cross-vfsmount reflinks so change the test to validate that
cross-vfsmount reflinks work.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
tests/generic/373 | 8 ++++----
tests/generic/373.out | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/generic/373 b/tests/generic/373
index 2f68b24f..e85308c7 100755
--- a/tests/generic/373
+++ b/tests/generic/373
@@ -4,7 +4,7 @@
#
# FS QA Test No. 373
#
-# Check that cross-mountpoint reflink doesn't work.
+# Check that cross-mountpoint reflink works.
#
. ./common/preamble
_begin_fstest auto quick clone
@@ -49,17 +49,17 @@ $MOUNT_PROG --bind $SCRATCH_MNT $otherdir
echo "Create file"
_pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
-filter_md5()
+filter_otherdir()
{
_filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g"
}
echo "Reflink one file to another"
-_cp_reflink $testdir/file $othertestdir/otherfiles 2>&1 | filter_md5
+_cp_reflink $testdir/file $othertestdir/otherfile 2>&1 | filter_otherdir
echo "Check output"
md5sum $testdir/file | _filter_scratch
-test -e $othertestdir/otherfile && echo "otherfile should not exist"
+md5sum $othertestdir/otherfile | filter_otherdir
echo "Unmount otherdir"
$UMOUNT_PROG $otherdir
diff --git a/tests/generic/373.out b/tests/generic/373.out
index 60f280fc..51f5c62b 100644
--- a/tests/generic/373.out
+++ b/tests/generic/373.out
@@ -3,7 +3,7 @@ Format and mount
Mount otherdir
Create file
Reflink one file to another
-cp: failed to clone 'OTHER_DIR/test-373/otherfiles' from 'SCRATCH_MNT/test-373/file': Invalid cross-device link
Check output
2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-373/file
+2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-373/otherfile
Unmount otherdir
--
2.26.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] fstests: generic/374: validate cross-vfsmount dedupe
2022-03-24 20:24 [PATCH 0/3] fstests: cross-vfsmount reflink changes Josef Bacik
2022-03-24 20:24 ` [PATCH 1/3] fstests: generic/373: change test to validate cross-vfsmount reflink Josef Bacik
@ 2022-03-24 20:24 ` Josef Bacik
2022-03-25 0:08 ` Dave Chinner
2022-03-24 20:24 ` [PATCH 3/3] fstests: btrfs/029: change the cross vfsmount reflink test Josef Bacik
2 siblings, 1 reply; 6+ messages in thread
From: Josef Bacik @ 2022-03-24 20:24 UTC (permalink / raw)
To: linux-btrfs, fstests
We allow for cross-vfsmount dedupes now, change this test to validate dedupe
works properly cross-vfsmount.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
tests/generic/374 | 5 +++--
tests/generic/374.out | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/generic/374 b/tests/generic/374
index d9f33bc3..f66d1397 100755
--- a/tests/generic/374
+++ b/tests/generic/374
@@ -4,7 +4,7 @@
#
# FS QA Test No. 374
#
-# Check that cross-mountpoint dedupe doesn't work.
+# Check that cross-mountpoint dedupe works
#
. ./common/preamble
_begin_fstest auto quick clone dedupe
@@ -50,7 +50,8 @@ _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
_pwrite_byte 0x61 0 $sz $testdir/otherfile >> $seqres.full
echo "Dedupe one file to another"
-_dedupe_range $testdir/file 0 $othertestdir/otherfile 0 $sz 2>&1 | _filter_dedupe_error
+_dedupe_range $testdir/file 0 $othertestdir/otherfile 0 $sz 2>&1 \
+ | _filter_xfs_io
filter_md5()
{
diff --git a/tests/generic/374.out b/tests/generic/374.out
index 3243ad3d..b62c64b4 100644
--- a/tests/generic/374.out
+++ b/tests/generic/374.out
@@ -3,7 +3,8 @@ Format and mount
Mount otherdir
Create file
Dedupe one file to another
-XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link
+deduped 65536/65536 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Check output
2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-374/file
2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-374/otherfile
--
2.26.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] fstests: btrfs/029: change the cross vfsmount reflink test
2022-03-24 20:24 [PATCH 0/3] fstests: cross-vfsmount reflink changes Josef Bacik
2022-03-24 20:24 ` [PATCH 1/3] fstests: generic/373: change test to validate cross-vfsmount reflink Josef Bacik
2022-03-24 20:24 ` [PATCH 2/3] fstests: generic/374: validate cross-vfsmount dedupe Josef Bacik
@ 2022-03-24 20:24 ` Josef Bacik
2 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2022-03-24 20:24 UTC (permalink / raw)
To: linux-btrfs, fstests
We now allow cross vfsmount reflinks, change this test to make sure we pass the
cross-vfsmount reflink.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
tests/btrfs/029 | 60 ++++++++++++++++++++++++++-------------------
tests/btrfs/029.out | 3 ++-
2 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/tests/btrfs/029 b/tests/btrfs/029
index 1bdbc951..94886788 100755
--- a/tests/btrfs/029
+++ b/tests/btrfs/029
@@ -5,14 +5,15 @@
# FS QA Test No. 029
#
# Check if creating a sparse copy ("reflink") of a file on btrfs
-# expectedly fails when it's done between different filesystems or
-# different mount points of the same filesystem.
+# expectedly fails when it's done between different filesystems but
+# not for different mount points of the same filesystem.
#
# For both situations, these actions are executed:
# - Copy a file with the reflink=auto option.
# A normal copy should be created.
# - Copy a file with the reflink=always option. Should result in
-# error.
+# error for different file systems, but succeed for the same fs
+# but different mount points.
#
. ./common/preamble
_begin_fstest auto quick clone
@@ -31,38 +32,47 @@ _require_cp_reflink
reflink_test_dir=$TEST_DIR/test-$seq
rm -rf $reflink_test_dir
mkdir $reflink_test_dir
+orig_file=$SCRATCH_MNT/original
+copy_file=$reflink_test_dir/copy
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/original >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $orig_file >> $seqres.full
-_create_reflinks()
-{
- # auto reflink, should fall back to non-reflink
- rm -rf $2
- echo "reflink=auto:"
- cp --reflink=auto $1 $2
- md5sum $1 | _filter_testdir_and_scratch
- md5sum $2 | _filter_testdir_and_scratch
-
- # always reflink, should fail outright
- rm -rf $2
- echo "reflink=always:"
- cp --reflink=always $1 $2 >> $seqres.full 2>&1 || echo "cp reflink failed"
+echo "test reflinks across different devices"
+# auto reflink, should fall back to non-reflink
+rm -rf $copy_file
+echo "reflink=auto:"
+cp --reflink=auto $orig_file $copy_file
+md5sum $orig_file | _filter_testdir_and_scratch
+md5sum $copy_file | _filter_testdir_and_scratch
- # The failed target gets created with zero sizes by cp(1) version 8.32. But
- # in older cp(1) version 8.30 target file is not created when the
- # cp --reflink=always fails.
- ls $2 >> $seqres.full 2>&1
-}
+# always reflink, should fail outright
+rm -rf $copy_file
+echo "reflink=always:"
+cp --reflink=always $orig_file $copy_file >> $seqres.full 2>&1 || echo "cp reflink failed"
-echo "test reflinks across different devices"
-_create_reflinks $SCRATCH_MNT/original $reflink_test_dir/copy
+# The failed target gets created with zero sizes by cp(1) version 8.32. But in
+# older cp(1) version 8.30 target file is not created when the cp
+# --reflink=always fails.
+ls $copy_file >> $seqres.full 2>&1
echo "test reflinks across different mountpoints of same device"
rm -rf $reflink_test_dir/*
_mount $SCRATCH_DEV $reflink_test_dir
-_create_reflinks $SCRATCH_MNT/original $reflink_test_dir/copy
+
+echo "reflink=auto:"
+cp --reflink=auto $orig_file $copy_file
+md5sum $orig_file | _filter_testdir_and_scratch
+md5sum $copy_file | _filter_testdir_and_scratch
+
+# always reflink, should fail outright
+rm -rf $copy_file
+echo "reflink=always:"
+cp --reflink=always $orig_file $copy_file >> $seqres.full 2>&1 || echo "cp reflink failed"
+md5sum $orig_file | _filter_testdir_and_scratch
+md5sum $copy_file | _filter_testdir_and_scratch
+
$UMOUNT_PROG $reflink_test_dir
# success, all done
diff --git a/tests/btrfs/029.out b/tests/btrfs/029.out
index f1c88780..c4971fcb 100644
--- a/tests/btrfs/029.out
+++ b/tests/btrfs/029.out
@@ -10,4 +10,5 @@ reflink=auto:
42d69d1a6d333a7ebdf64792a555e392 SCRATCH_MNT/original
42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-029/copy
reflink=always:
-cp reflink failed
+42d69d1a6d333a7ebdf64792a555e392 SCRATCH_MNT/original
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-029/copy
--
2.26.3
^ permalink raw reply related [flat|nested] 6+ messages in thread