All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0
@ 2016-11-23  2:10 Darrick J. Wong
  2016-11-23  2:11 ` [PATCH 2/3] misc: fix some minor problems testing ocfs2 Darrick J. Wong
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-23  2:10 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests

Since btrfs doesn't interpret len=0 as "go to EOF", test for that instead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/182     |    3 ++-
 tests/generic/182.out |    2 --
 2 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/tests/generic/182 b/tests/generic/182
index f484399..dacb989 100755
--- a/tests/generic/182
+++ b/tests/generic/182
@@ -1,7 +1,8 @@
 #! /bin/bash
 # FS QA Test No. 182
 #
-# Test the convention that dedupe with length == 0 means "to the end of fileA"
+# Test the convention that dedupe with length == 0 doesn't mean "to the end of
+# fileA"
 #   - Create a file.
 #   - Try to dedupe "zero" bytes (which means dedupe to EOF).
 #   - Check that the dedupe happened.
diff --git a/tests/generic/182.out b/tests/generic/182.out
index 049a3ee..9841b76 100644
--- a/tests/generic/182.out
+++ b/tests/generic/182.out
@@ -1,12 +1,10 @@
 QA output created by 182
 Create the original files
-dedupe: Extents did not match.
 f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
 69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2
 69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2.chk
 Compare against check files
 Make the original file almost dedup-able
-dedupe: Extents did not match.
 f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
 158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2
 158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2.chk


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

* [PATCH 2/3] misc: fix some minor problems testing ocfs2
  2016-11-23  2:10 [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Darrick J. Wong
@ 2016-11-23  2:11 ` Darrick J. Wong
  2016-11-23  9:59   ` Eryu Guan
  2016-11-23  2:11 ` [PATCH 3/3] ocfs2: test reflinking to inline data files Darrick J. Wong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-23  2:11 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests

There are a a few things about ocfs2 tools that need special-casing in
xfstests, so fix them so that we can start testing ocfs2.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/quota |    2 +-
 common/rc    |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)


diff --git a/common/quota b/common/quota
index 678bc43..d9bb8d9 100644
--- a/common/quota
+++ b/common/quota
@@ -34,7 +34,7 @@ _require_quota()
 	    _notrun "Installed kernel does not support quotas"
 	fi
 	;;
-    gfs2)
+    gfs2|ocfs2)
 	;;
     xfs)
 	if [ ! -f /proc/fs/xfs/xqmstat ]; then
diff --git a/common/rc b/common/rc
index 8e078da..c75b614 100644
--- a/common/rc
+++ b/common/rc
@@ -978,7 +978,7 @@ _scratch_mkfs_sized()
     xfs)
 	def_blksz=`echo $MKFS_OPTIONS|sed -rn 's/.*-b ?size= ?+([0-9]+).*/\1/p'`
 	;;
-    ext2|ext3|ext4|ext4dev|udf|btrfs|reiser4)
+    ext2|ext3|ext4|ext4dev|udf|btrfs|reiser4|ocfs2)
 	def_blksz=`echo $MKFS_OPTIONS| sed -rn 's/.*-b ?+([0-9]+).*/\1/p'`
 	;;
     esac
@@ -1015,6 +1015,9 @@ _scratch_mkfs_sized()
     ext2|ext3|ext4|ext4dev)
 	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
 	;;
+    ocfs2)
+	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+	;;
     udf)
 	$MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
 	;;
@@ -1087,9 +1090,12 @@ _scratch_mkfs_blocksized()
     xfs)
 	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
 	;;
-    ext2|ext3|ext4|ocfs2)
+    ext2|ext3|ext4)
 	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
 	;;
+    ocfs2)
+	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
 	;;


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

* [PATCH 3/3] ocfs2: test reflinking to inline data files
  2016-11-23  2:10 [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Darrick J. Wong
  2016-11-23  2:11 ` [PATCH 2/3] misc: fix some minor problems testing ocfs2 Darrick J. Wong
@ 2016-11-23  2:11 ` Darrick J. Wong
  2016-11-23 16:34   ` Eryu Guan
  2016-11-24  1:53   ` [PATCH v2 " Darrick J. Wong
  2016-11-23 10:33 ` [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Eryu Guan
  2016-11-24  1:51 ` [PATCH v2 " Darrick J. Wong
  3 siblings, 2 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-23  2:11 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests

Make sure that we can handle reflinking from and to inline-data files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/ocfs2/001     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ocfs2/001.out |   14 ++++++++
 tests/ocfs2/group   |    1 +
 3 files changed, 103 insertions(+)
 create mode 100755 tests/ocfs2/001
 create mode 100644 tests/ocfs2/001.out
 create mode 100644 tests/ocfs2/group


diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
new file mode 100755
index 0000000..973682d
--- /dev/null
+++ b/tests/ocfs2/001
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 001
+#
+# Ensure that reflink works correctly with inline-data files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ocfs2
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
+	_notrun "Inline data is not supported."
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+sz=65536
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+echo x > $testdir/file2
+echo x > $testdir/file3
+echo y > $testdir/file4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
+echo a > $testdir/file6
+_scratch_cycle_mount
+
+echo "reflink into the start of file2"
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "reflink past the stuff in file3"
+_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
+
+echo "reflink an inline-data file to a regular one"
+_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
+
+echo "reflink an inline-data file to another inline-data file"
+_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
+
+echo "Verify the whole mess"
+_scratch_cycle_mount
+md5sum $testdir/file* | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
new file mode 100644
index 0000000..99fa43a
--- /dev/null
+++ b/tests/ocfs2/001.out
@@ -0,0 +1,14 @@
+QA output created by 001
+Format and mount
+Create the original files
+reflink into the start of file2
+reflink past the stuff in file3
+reflink an inline-data file to a regular one
+reflink an inline-data file to another inline-data file
+Verify the whole mess
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
diff --git a/tests/ocfs2/group b/tests/ocfs2/group
new file mode 100644
index 0000000..28e6807
--- /dev/null
+++ b/tests/ocfs2/group
@@ -0,0 +1 @@
+001 auto quick clone


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

* Re: [PATCH 2/3] misc: fix some minor problems testing ocfs2
  2016-11-23  2:11 ` [PATCH 2/3] misc: fix some minor problems testing ocfs2 Darrick J. Wong
@ 2016-11-23  9:59   ` Eryu Guan
  0 siblings, 0 replies; 12+ messages in thread
From: Eryu Guan @ 2016-11-23  9:59 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests

On Tue, Nov 22, 2016 at 06:11:00PM -0800, Darrick J. Wong wrote:
> There are a a few things about ocfs2 tools that need special-casing in
> xfstests, so fix them so that we can start testing ocfs2.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

This is in my last pull request to Dave, just not upstream yet (if
everything works well :-).

Thanks,
Eryu

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

* Re: [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0
  2016-11-23  2:10 [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Darrick J. Wong
  2016-11-23  2:11 ` [PATCH 2/3] misc: fix some minor problems testing ocfs2 Darrick J. Wong
  2016-11-23  2:11 ` [PATCH 3/3] ocfs2: test reflinking to inline data files Darrick J. Wong
@ 2016-11-23 10:33 ` Eryu Guan
  2016-11-23 19:13   ` Darrick J. Wong
  2016-11-24  1:51 ` [PATCH v2 " Darrick J. Wong
  3 siblings, 1 reply; 12+ messages in thread
From: Eryu Guan @ 2016-11-23 10:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests

On Tue, Nov 22, 2016 at 06:10:54PM -0800, Darrick J. Wong wrote:
> Since btrfs doesn't interpret len=0 as "go to EOF", test for that instead.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/182     |    3 ++-
>  tests/generic/182.out |    2 --
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/tests/generic/182 b/tests/generic/182
> index f484399..dacb989 100755
> --- a/tests/generic/182
> +++ b/tests/generic/182
> @@ -1,7 +1,8 @@
>  #! /bin/bash
>  # FS QA Test No. 182
>  #
> -# Test the convention that dedupe with length == 0 means "to the end of fileA"
> +# Test the convention that dedupe with length == 0 doesn't mean "to the end of
> +# fileA"

If I read the xfs patch and btrfs RFC patch thread correctly, 0 length
means do nothing, right? Should we make it more clear and specific in
the comments instead of "doesn't mean..."? I think that helps people
understand the test.

>  #   - Create a file.
>  #   - Try to dedupe "zero" bytes (which means dedupe to EOF).
>  #   - Check that the dedupe happened.

These comments need fixes too.

Thanks,
Eryu

> diff --git a/tests/generic/182.out b/tests/generic/182.out
> index 049a3ee..9841b76 100644
> --- a/tests/generic/182.out
> +++ b/tests/generic/182.out
> @@ -1,12 +1,10 @@
>  QA output created by 182
>  Create the original files
> -dedupe: Extents did not match.
>  f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
>  69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2
>  69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2.chk
>  Compare against check files
>  Make the original file almost dedup-able
> -dedupe: Extents did not match.
>  f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
>  158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2
>  158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2.chk
> 

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

* Re: [PATCH 3/3] ocfs2: test reflinking to inline data files
  2016-11-23  2:11 ` [PATCH 3/3] ocfs2: test reflinking to inline data files Darrick J. Wong
@ 2016-11-23 16:34   ` Eryu Guan
  2016-11-23 19:27     ` Darrick J. Wong
  2016-11-24  1:53   ` [PATCH v2 " Darrick J. Wong
  1 sibling, 1 reply; 12+ messages in thread
From: Eryu Guan @ 2016-11-23 16:34 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests

On Tue, Nov 22, 2016 at 06:11:06PM -0800, Darrick J. Wong wrote:
> Make sure that we can handle reflinking from and to inline-data files.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/ocfs2/001     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ocfs2/001.out |   14 ++++++++
>  tests/ocfs2/group   |    1 +
>  3 files changed, 103 insertions(+)
>  create mode 100755 tests/ocfs2/001
>  create mode 100644 tests/ocfs2/001.out
>  create mode 100644 tests/ocfs2/group
> 
> 
> diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
> new file mode 100755
> index 0000000..973682d
> --- /dev/null
> +++ b/tests/ocfs2/001
> @@ -0,0 +1,88 @@
> +#! /bin/bash
> +# FS QA Test No. 001
> +#
> +# Ensure that reflink works correctly with inline-data files.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/reflink
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ocfs2
> +_require_scratch_reflink

I'm a bit confused on this. I noticed that xfs_io reflink uses
clone_range ioctl to do the actual work, but seems that ocfs2 doesn't
have that method defined. So I got _notrun when running ocfs2/001

bootp-73-5-234:~/xfstests # ./check -s ocfs2_reflink ocfs2/001
SECTION       -- ocfs2_reflink
RECREATING    -- ocfs2 on /dev/sda3
FSTYP         -- ocfs2
PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.8.9-1-default
MKFS_OPTIONS  -- --fs-features=local,refcount /dev/sda5
MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch

ocfs2/001        [not run] Reflink not supported by scratch filesystem type: ocfs2

I also tried the djwong-devel branch of your xfsprogs tree and got the
same result. Did I miss anything?

> +_require_cp_reflink
> +
> +rm -f $seqres.full
> +
> +echo "Format and mount"
> +_scratch_mkfs > $seqres.full 2>&1
> +tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
> +	_notrun "Inline data is not supported."

Test still passes even if ocfs2 has no inline-data feature enabled,
right? Then I think we can skip this check, just let the user specify
the test configuration and decide what features are tested.

And further, if we skip this check, then this test has nothing ocfs2
specific, it could be a generic test.

> +_scratch_mount >> $seqres.full 2>&1
> +
> +testdir=$SCRATCH_MNT/test-$seq
> +mkdir $testdir
> +
> +sz=65536
> +echo "Create the original files"
> +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
> +echo x > $testdir/file2
> +echo x > $testdir/file3
> +echo y > $testdir/file4
> +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
> +echo a > $testdir/file6
> +_scratch_cycle_mount
> +
> +echo "reflink into the start of file2"
> +_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
> +
> +echo "reflink past the stuff in file3"
> +_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
> +
> +echo "reflink an inline-data file to a regular one"
> +_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
> +
> +echo "reflink an inline-data file to another inline-data file"
> +_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
> +
> +echo "Verify the whole mess"
> +_scratch_cycle_mount
> +md5sum $testdir/file* | _filter_scratch
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
> new file mode 100644
> index 0000000..99fa43a
> --- /dev/null
> +++ b/tests/ocfs2/001.out
> @@ -0,0 +1,14 @@
> +QA output created by 001
> +Format and mount
> +Create the original files
> +reflink into the start of file2
> +reflink past the stuff in file3
> +reflink an inline-data file to a regular one
> +reflink an inline-data file to another inline-data file
> +Verify the whole mess
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> +4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> diff --git a/tests/ocfs2/group b/tests/ocfs2/group
> new file mode 100644
> index 0000000..28e6807
> --- /dev/null
> +++ b/tests/ocfs2/group
> @@ -0,0 +1 @@
> +001 auto quick clone

A tests/ocfs2/Makefile is needed to do the tests installation work, if
we decide to add new ocfs2 specific tests.

Thanks,
Eryu

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

* Re: [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0
  2016-11-23 10:33 ` [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Eryu Guan
@ 2016-11-23 19:13   ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-23 19:13 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests

On Wed, Nov 23, 2016 at 06:33:23PM +0800, Eryu Guan wrote:
> On Tue, Nov 22, 2016 at 06:10:54PM -0800, Darrick J. Wong wrote:
> > Since btrfs doesn't interpret len=0 as "go to EOF", test for that instead.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/182     |    3 ++-
> >  tests/generic/182.out |    2 --
> >  2 files changed, 2 insertions(+), 3 deletions(-)
> > 
> > 
> > diff --git a/tests/generic/182 b/tests/generic/182
> > index f484399..dacb989 100755
> > --- a/tests/generic/182
> > +++ b/tests/generic/182
> > @@ -1,7 +1,8 @@
> >  #! /bin/bash
> >  # FS QA Test No. 182
> >  #
> > -# Test the convention that dedupe with length == 0 means "to the end of fileA"
> > +# Test the convention that dedupe with length == 0 doesn't mean "to the end of
> > +# fileA"
> 
> If I read the xfs patch and btrfs RFC patch thread correctly, 0 length
> means do nothing, right? Should we make it more clear and specific in
> the comments instead of "doesn't mean..."? I think that helps people
> understand the test.

Yeah, this is confusing and contradictory; I'll fix it.

--D

> 
> >  #   - Create a file.
> >  #   - Try to dedupe "zero" bytes (which means dedupe to EOF).
> >  #   - Check that the dedupe happened.
> 
> These comments need fixes too.
> 
> Thanks,
> Eryu
> 
> > diff --git a/tests/generic/182.out b/tests/generic/182.out
> > index 049a3ee..9841b76 100644
> > --- a/tests/generic/182.out
> > +++ b/tests/generic/182.out
> > @@ -1,12 +1,10 @@
> >  QA output created by 182
> >  Create the original files
> > -dedupe: Extents did not match.
> >  f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
> >  69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2
> >  69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2.chk
> >  Compare against check files
> >  Make the original file almost dedup-able
> > -dedupe: Extents did not match.
> >  f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
> >  158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2
> >  158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2.chk
> > 

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

* Re: [PATCH 3/3] ocfs2: test reflinking to inline data files
  2016-11-23 16:34   ` Eryu Guan
@ 2016-11-23 19:27     ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-23 19:27 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests

On Thu, Nov 24, 2016 at 12:34:48AM +0800, Eryu Guan wrote:
> On Tue, Nov 22, 2016 at 06:11:06PM -0800, Darrick J. Wong wrote:
> > Make sure that we can handle reflinking from and to inline-data files.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/ocfs2/001     |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ocfs2/001.out |   14 ++++++++
> >  tests/ocfs2/group   |    1 +
> >  3 files changed, 103 insertions(+)
> >  create mode 100755 tests/ocfs2/001
> >  create mode 100644 tests/ocfs2/001.out
> >  create mode 100644 tests/ocfs2/group
> > 
> > 
> > diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
> > new file mode 100755
> > index 0000000..973682d
> > --- /dev/null
> > +++ b/tests/ocfs2/001
> > @@ -0,0 +1,88 @@
> > +#! /bin/bash
> > +# FS QA Test No. 001
> > +#
> > +# Ensure that reflink works correctly with inline-data files.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ocfs2
> > +_require_scratch_reflink
> 
> I'm a bit confused on this. I noticed that xfs_io reflink uses
> clone_range ioctl to do the actual work, but seems that ocfs2 doesn't
> have that method defined. So I got _notrun when running ocfs2/001

Yes, you need the patch series I sent to fsdevel/ocfs2-devel connecting
ocfs2 to the new vfs interfaces.  This isn't intended to test the old
(~2009 era) reflink ioctl at all.

> bootp-73-5-234:~/xfstests # ./check -s ocfs2_reflink ocfs2/001
> SECTION       -- ocfs2_reflink
> RECREATING    -- ocfs2 on /dev/sda3
> FSTYP         -- ocfs2
> PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.8.9-1-default
> MKFS_OPTIONS  -- --fs-features=local,refcount /dev/sda5
> MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> 
> ocfs2/001        [not run] Reflink not supported by scratch filesystem type: ocfs2
> 
> I also tried the djwong-devel branch of your xfsprogs tree and got the
> same result. Did I miss anything?

Here's the ocfs2 patches as a branch:
https://github.com/djwong/linux/tree/ocfs2-vfs-reflink-3

No changes to xfsprogs are necessary for ocfs2 support.

> > +_require_cp_reflink
> > +
> > +rm -f $seqres.full
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > $seqres.full 2>&1
> > +tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
> > +	_notrun "Inline data is not supported."
> 
> Test still passes even if ocfs2 has no inline-data feature enabled,
> right? Then I think we can skip this check, just let the user specify
> the test configuration and decide what features are tested.

I should've mentioned, this test exercises some bugs I found in ocfs2
w.r.t.  reflinking into and out of inline-data files.  In the ideal
world mkfs.ocfs2 would support multiple --fs-features= arguments so I
could just do:

_scratch_mkfs --fs-features=inline-data

but it doesn't, so I don't have a good way to forcibly enable
inline-data.  IIRC reflinking into and out of small files is already
tested by one of the generic tests; this one is designed specifically to
pound on a corner case that I missed in the first spin of the patch.

Though now that I think about it, mkfs.ocfs2 sets the feature flags
based on the last instance of --fs-features, so I actually /can/ use
what I proposed above so long as I turn on all the features I need.
That seems appropriate for a test of a specific regression, so I'll do
that.

> And further, if we skip this check, then this test has nothing ocfs2
> specific, it could be a generic test.
> 
> > +_scratch_mount >> $seqres.full 2>&1
> > +
> > +testdir=$SCRATCH_MNT/test-$seq
> > +mkdir $testdir
> > +
> > +sz=65536
> > +echo "Create the original files"
> > +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
> > +echo x > $testdir/file2
> > +echo x > $testdir/file3
> > +echo y > $testdir/file4
> > +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
> > +echo a > $testdir/file6
> > +_scratch_cycle_mount
> > +
> > +echo "reflink into the start of file2"
> > +_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
> > +
> > +echo "reflink past the stuff in file3"
> > +_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
> > +
> > +echo "reflink an inline-data file to a regular one"
> > +_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
> > +
> > +echo "reflink an inline-data file to another inline-data file"
> > +_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
> > +
> > +echo "Verify the whole mess"
> > +_scratch_cycle_mount
> > +md5sum $testdir/file* | _filter_scratch
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
> > new file mode 100644
> > index 0000000..99fa43a
> > --- /dev/null
> > +++ b/tests/ocfs2/001.out
> > @@ -0,0 +1,14 @@
> > +QA output created by 001
> > +Format and mount
> > +Create the original files
> > +reflink into the start of file2
> > +reflink past the stuff in file3
> > +reflink an inline-data file to a regular one
> > +reflink an inline-data file to another inline-data file
> > +Verify the whole mess
> > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > +4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > diff --git a/tests/ocfs2/group b/tests/ocfs2/group
> > new file mode 100644
> > index 0000000..28e6807
> > --- /dev/null
> > +++ b/tests/ocfs2/group
> > @@ -0,0 +1 @@
> > +001 auto quick clone
> 
> A tests/ocfs2/Makefile is needed to do the tests installation work, if
> we decide to add new ocfs2 specific tests.

Ok.

--D
> 
> Thanks,
> Eryu

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

* [PATCH v2 1/3] generic/182: retain existing btrfs behavior when len == 0
  2016-11-23  2:10 [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Darrick J. Wong
                   ` (2 preceding siblings ...)
  2016-11-23 10:33 ` [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Eryu Guan
@ 2016-11-24  1:51 ` Darrick J. Wong
  3 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-24  1:51 UTC (permalink / raw)
  To: david, eguan; +Cc: linux-xfs, fstests

Since btrfs has always interpreted src_length=0 as "return 0 having
taken no action", test for that instead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/182     |    6 +++---
 tests/generic/182.out |    2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/generic/182 b/tests/generic/182
index f484399..7fafec0 100755
--- a/tests/generic/182
+++ b/tests/generic/182
@@ -1,10 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 182
 #
-# Test the convention that dedupe with length == 0 means "to the end of fileA"
+# Test the convention that dedupe with length == 0 always returns success.
 #   - Create a file.
-#   - Try to dedupe "zero" bytes (which means dedupe to EOF).
-#   - Check that the dedupe happened.
+#   - Try to dedupe "zero" bytes.
+#   - Check that the dedupe happened and nothing changed.
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
diff --git a/tests/generic/182.out b/tests/generic/182.out
index 049a3ee..9841b76 100644
--- a/tests/generic/182.out
+++ b/tests/generic/182.out
@@ -1,12 +1,10 @@
 QA output created by 182
 Create the original files
-dedupe: Extents did not match.
 f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
 69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2
 69ad53078a16243d98e21d9f8704a071  TEST_DIR/test-182/file2.chk
 Compare against check files
 Make the original file almost dedup-able
-dedupe: Extents did not match.
 f4820540fc0ac02750739896fe028d56  TEST_DIR/test-182/file1
 158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2
 158d4e3578b94b89cbb44493a2110fb9  TEST_DIR/test-182/file2.chk

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

* [PATCH v2 3/3] ocfs2: test reflinking to inline data files
  2016-11-23  2:11 ` [PATCH 3/3] ocfs2: test reflinking to inline data files Darrick J. Wong
  2016-11-23 16:34   ` Eryu Guan
@ 2016-11-24  1:53   ` Darrick J. Wong
  2016-11-24  9:01     ` Eryu Guan
  1 sibling, 1 reply; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-24  1:53 UTC (permalink / raw)
  To: david, eguan; +Cc: linux-xfs, fstests

Make sure that we can handle reflinking from and to inline-data files.
This pounds on a regression test discovered while implementing ocfs2
reflink support.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: Format the fs with the feature flags we need.
---
 tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ocfs2/001.out  |   14 ++++++++
 tests/ocfs2/Makefile |   20 +++++++++++
 tests/ocfs2/group    |    1 +
 4 files changed, 123 insertions(+)
 create mode 100755 tests/ocfs2/001
 create mode 100644 tests/ocfs2/001.out
 create mode 100644 tests/ocfs2/Makefile
 create mode 100644 tests/ocfs2/group

diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
new file mode 100755
index 0000000..0f9765e
--- /dev/null
+++ b/tests/ocfs2/001
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 001
+#
+# Ensure that reflink works correctly with inline-data files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ocfs2
+_require_scratch
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
+tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
+	_notrun "Inline data is not supported."
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+sz=65536
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+echo x > $testdir/file2
+echo x > $testdir/file3
+echo y > $testdir/file4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
+echo a > $testdir/file6
+_scratch_cycle_mount
+
+echo "reflink into the start of file2"
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "reflink past the stuff in file3"
+_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
+
+echo "reflink an inline-data file to a regular one"
+_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
+
+echo "reflink an inline-data file to another inline-data file"
+_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
+
+echo "Verify the whole mess"
+_scratch_cycle_mount
+md5sum $testdir/file* | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
new file mode 100644
index 0000000..99fa43a
--- /dev/null
+++ b/tests/ocfs2/001.out
@@ -0,0 +1,14 @@
+QA output created by 001
+Format and mount
+Create the original files
+reflink into the start of file2
+reflink past the stuff in file3
+reflink an inline-data file to a regular one
+reflink an inline-data file to another inline-data file
+Verify the whole mess
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
new file mode 100644
index 0000000..70a4f16
--- /dev/null
+++ b/tests/ocfs2/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2016 Oracle.  All Rights Reserved.
+#
+
+TOPDIR = ../..
+include $(TOPDIR)/include/builddefs
+
+OCFS2_DIR = ocfs2
+TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
+
+include $(BUILDRULES)
+
+install:
+	$(INSTALL) -m 755 -d $(TARGET_DIR)
+	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
+	$(INSTALL) -m 644 group $(TARGET_DIR)
+	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
+
+# Nothing.
+install-dev install-lib:
diff --git a/tests/ocfs2/group b/tests/ocfs2/group
new file mode 100644
index 0000000..28e6807
--- /dev/null
+++ b/tests/ocfs2/group
@@ -0,0 +1 @@
+001 auto quick clone

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

* Re: [PATCH v2 3/3] ocfs2: test reflinking to inline data files
  2016-11-24  1:53   ` [PATCH v2 " Darrick J. Wong
@ 2016-11-24  9:01     ` Eryu Guan
  2016-11-28 17:22       ` Darrick J. Wong
  0 siblings, 1 reply; 12+ messages in thread
From: Eryu Guan @ 2016-11-24  9:01 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests

On Wed, Nov 23, 2016 at 05:53:09PM -0800, Darrick J. Wong wrote:
> Make sure that we can handle reflinking from and to inline-data files.
> This pounds on a regression test discovered while implementing ocfs2
> reflink support.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> v2: Format the fs with the feature flags we need.
> ---
>  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ocfs2/001.out  |   14 ++++++++
>  tests/ocfs2/Makefile |   20 +++++++++++
>  tests/ocfs2/group    |    1 +
>  4 files changed, 123 insertions(+)
>  create mode 100755 tests/ocfs2/001
>  create mode 100644 tests/ocfs2/001.out
>  create mode 100644 tests/ocfs2/Makefile
>  create mode 100644 tests/ocfs2/group
> 
> diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
> new file mode 100755
> index 0000000..0f9765e
> --- /dev/null
> +++ b/tests/ocfs2/001
> @@ -0,0 +1,88 @@
> +#! /bin/bash
> +# FS QA Test No. 001
> +#
> +# Ensure that reflink works correctly with inline-data files.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/reflink
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ocfs2
> +_require_scratch

I think we still need _require_scratch_reflink, otherwise ocfs2 without
clone_range support fails and reports Operation not supported.

But _require_scratch_reflink introduces another issue, it prints
"mkfs.ocfs2 <ver_number>" at mkfs time and causes test to fail too. But
I'm working on a patch to fix this in a general way, which also allows
usage such as

"_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data"

to succeed even if there're mkfs option conflicts between MKFS_OPTIONS,
just like what _scratch_mkfs_xfs does (mkfs again without MKFS_OPTIONS).

I'll send my patch later after it passed my test run.

> +_require_cp_reflink
> +
> +rm -f $seqres.full
> +
> +echo "Format and mount"
> +_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
> +tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
> +	_notrun "Inline data is not supported."
> +_scratch_mount >> $seqres.full 2>&1
> +
> +testdir=$SCRATCH_MNT/test-$seq
> +mkdir $testdir
> +
> +sz=65536
> +echo "Create the original files"
> +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
> +echo x > $testdir/file2
> +echo x > $testdir/file3
> +echo y > $testdir/file4
> +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
> +echo a > $testdir/file6
> +_scratch_cycle_mount
> +
> +echo "reflink into the start of file2"
> +_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full

I built and installed your ocfs2-vfs-reflink-3 branch and hit this test
failure, is this expected?

bootp-73-5-234:~/xfstests # ./check -s ocfs2 ocfs2/001
SECTION       -- ocfs2
RECREATING    -- ocfs2 on /dev/sda3
FSTYP         -- ocfs2
PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc6.djwong-ocfs2+
MKFS_OPTIONS  -- --fs-features=local /dev/sda5
MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch

ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
    --- tests/ocfs2/001.out     2016-11-24 12:58:34.474925404 +0800
    +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-11-24 16:41:57.307401368 +0800
    @@ -2,13 +2,16 @@
     Format and mount
     Create the original files
     reflink into the start of file2
    +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
     reflink past the stuff in file3
     reflink an inline-data file to a regular one
    +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
    ...

Thanks,
Eryu

> +
> +echo "reflink past the stuff in file3"
> +_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
> +
> +echo "reflink an inline-data file to a regular one"
> +_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
> +
> +echo "reflink an inline-data file to another inline-data file"
> +_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
> +
> +echo "Verify the whole mess"
> +_scratch_cycle_mount
> +md5sum $testdir/file* | _filter_scratch
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
> new file mode 100644
> index 0000000..99fa43a
> --- /dev/null
> +++ b/tests/ocfs2/001.out
> @@ -0,0 +1,14 @@
> +QA output created by 001
> +Format and mount
> +Create the original files
> +reflink into the start of file2
> +reflink past the stuff in file3
> +reflink an inline-data file to a regular one
> +reflink an inline-data file to another inline-data file
> +Verify the whole mess
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> +4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
> new file mode 100644
> index 0000000..70a4f16
> --- /dev/null
> +++ b/tests/ocfs2/Makefile
> @@ -0,0 +1,20 @@
> +#
> +# Copyright (c) 2016 Oracle.  All Rights Reserved.
> +#
> +
> +TOPDIR = ../..
> +include $(TOPDIR)/include/builddefs
> +
> +OCFS2_DIR = ocfs2
> +TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
> +
> +include $(BUILDRULES)
> +
> +install:
> +	$(INSTALL) -m 755 -d $(TARGET_DIR)
> +	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
> +	$(INSTALL) -m 644 group $(TARGET_DIR)
> +	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
> +
> +# Nothing.
> +install-dev install-lib:
> diff --git a/tests/ocfs2/group b/tests/ocfs2/group
> new file mode 100644
> index 0000000..28e6807
> --- /dev/null
> +++ b/tests/ocfs2/group
> @@ -0,0 +1 @@
> +001 auto quick clone

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

* Re: [PATCH v2 3/3] ocfs2: test reflinking to inline data files
  2016-11-24  9:01     ` Eryu Guan
@ 2016-11-28 17:22       ` Darrick J. Wong
  0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2016-11-28 17:22 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests

On Thu, Nov 24, 2016 at 05:01:48PM +0800, Eryu Guan wrote:
> On Wed, Nov 23, 2016 at 05:53:09PM -0800, Darrick J. Wong wrote:
> > Make sure that we can handle reflinking from and to inline-data files.
> > This pounds on a regression test discovered while implementing ocfs2
> > reflink support.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > v2: Format the fs with the feature flags we need.
> > ---
> >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ocfs2/001.out  |   14 ++++++++
> >  tests/ocfs2/Makefile |   20 +++++++++++
> >  tests/ocfs2/group    |    1 +
> >  4 files changed, 123 insertions(+)
> >  create mode 100755 tests/ocfs2/001
> >  create mode 100644 tests/ocfs2/001.out
> >  create mode 100644 tests/ocfs2/Makefile
> >  create mode 100644 tests/ocfs2/group
> > 
> > diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
> > new file mode 100755
> > index 0000000..0f9765e
> > --- /dev/null
> > +++ b/tests/ocfs2/001
> > @@ -0,0 +1,88 @@
> > +#! /bin/bash
> > +# FS QA Test No. 001
> > +#
> > +# Ensure that reflink works correctly with inline-data files.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  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, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ocfs2
> > +_require_scratch
> 
> I think we still need _require_scratch_reflink, otherwise ocfs2 without
> clone_range support fails and reports Operation not supported.
> 
> But _require_scratch_reflink introduces another issue, it prints
> "mkfs.ocfs2 <ver_number>" at mkfs time and causes test to fail too. But
> I'm working on a patch to fix this in a general way, which also allows
> usage such as
> 
> "_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data"
> 
> to succeed even if there're mkfs option conflicts between MKFS_OPTIONS,
> just like what _scratch_mkfs_xfs does (mkfs again without MKFS_OPTIONS).
> 
> I'll send my patch later after it passed my test run.

Ok.  I'll change it back to _require_scratch_reflink and resubmit.

> > +_require_cp_reflink
> > +
> > +rm -f $seqres.full
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
> > +tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
> > +	_notrun "Inline data is not supported."
> > +_scratch_mount >> $seqres.full 2>&1
> > +
> > +testdir=$SCRATCH_MNT/test-$seq
> > +mkdir $testdir
> > +
> > +sz=65536
> > +echo "Create the original files"
> > +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
> > +echo x > $testdir/file2
> > +echo x > $testdir/file3
> > +echo y > $testdir/file4
> > +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
> > +echo a > $testdir/file6
> > +_scratch_cycle_mount
> > +
> > +echo "reflink into the start of file2"
> > +_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
> 
> I built and installed your ocfs2-vfs-reflink-3 branch and hit this test
> failure, is this expected?
> 
> bootp-73-5-234:~/xfstests # ./check -s ocfs2 ocfs2/001
> SECTION       -- ocfs2
> RECREATING    -- ocfs2 on /dev/sda3
> FSTYP         -- ocfs2
> PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc6.djwong-ocfs2+
> MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> 
> ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
>     --- tests/ocfs2/001.out     2016-11-24 12:58:34.474925404 +0800
>     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-11-24 16:41:57.307401368 +0800
>     @@ -2,13 +2,16 @@
>      Format and mount
>      Create the original files
>      reflink into the start of file2
>     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
>      reflink past the stuff in file3
>      reflink an inline-data file to a regular one
>     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists


...no?

$ dpkg --status coreutils | grep Version
Version: 8.25-2ubuntu2

I could try changing the _cp_reflink definition to pass -f to cp.

--D

>     ...
> 
> Thanks,
> Eryu
> 
> > +
> > +echo "reflink past the stuff in file3"
> > +_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
> > +
> > +echo "reflink an inline-data file to a regular one"
> > +_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
> > +
> > +echo "reflink an inline-data file to another inline-data file"
> > +_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
> > +
> > +echo "Verify the whole mess"
> > +_scratch_cycle_mount
> > +md5sum $testdir/file* | _filter_scratch
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
> > new file mode 100644
> > index 0000000..99fa43a
> > --- /dev/null
> > +++ b/tests/ocfs2/001.out
> > @@ -0,0 +1,14 @@
> > +QA output created by 001
> > +Format and mount
> > +Create the original files
> > +reflink into the start of file2
> > +reflink past the stuff in file3
> > +reflink an inline-data file to a regular one
> > +reflink an inline-data file to another inline-data file
> > +Verify the whole mess
> > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > +4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > +009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
> > new file mode 100644
> > index 0000000..70a4f16
> > --- /dev/null
> > +++ b/tests/ocfs2/Makefile
> > @@ -0,0 +1,20 @@
> > +#
> > +# Copyright (c) 2016 Oracle.  All Rights Reserved.
> > +#
> > +
> > +TOPDIR = ../..
> > +include $(TOPDIR)/include/builddefs
> > +
> > +OCFS2_DIR = ocfs2
> > +TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
> > +
> > +include $(BUILDRULES)
> > +
> > +install:
> > +	$(INSTALL) -m 755 -d $(TARGET_DIR)
> > +	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
> > +	$(INSTALL) -m 644 group $(TARGET_DIR)
> > +	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
> > +
> > +# Nothing.
> > +install-dev install-lib:
> > diff --git a/tests/ocfs2/group b/tests/ocfs2/group
> > new file mode 100644
> > index 0000000..28e6807
> > --- /dev/null
> > +++ b/tests/ocfs2/group
> > @@ -0,0 +1 @@
> > +001 auto quick clone
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" 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] 12+ messages in thread

end of thread, other threads:[~2016-11-28 17:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23  2:10 [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Darrick J. Wong
2016-11-23  2:11 ` [PATCH 2/3] misc: fix some minor problems testing ocfs2 Darrick J. Wong
2016-11-23  9:59   ` Eryu Guan
2016-11-23  2:11 ` [PATCH 3/3] ocfs2: test reflinking to inline data files Darrick J. Wong
2016-11-23 16:34   ` Eryu Guan
2016-11-23 19:27     ` Darrick J. Wong
2016-11-24  1:53   ` [PATCH v2 " Darrick J. Wong
2016-11-24  9:01     ` Eryu Guan
2016-11-28 17:22       ` Darrick J. Wong
2016-11-23 10:33 ` [PATCH 1/3] generic/182: retain existing btrfs behavior when len == 0 Eryu Guan
2016-11-23 19:13   ` Darrick J. Wong
2016-11-24  1:51 ` [PATCH v2 " Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.