From: "Darrick J. Wong" <darrick.wong@oracle.com> To: eguan@redhat.com, darrick.wong@oracle.com Cc: ocfs2-devel@oss.oracle.com, fstests@vger.kernel.org Subject: [PATCH 1/7] ocfs2: test reflinking to inline data files Date: Sun, 11 Dec 2016 13:52:51 -0800 [thread overview] Message-ID: <148149317133.31093.439907074888693999.stgit@birch.djwong.org> (raw) In-Reply-To: <148149316504.31093.16129068344227450710.stgit@birch.djwong.org> Make sure that we can handle reflinking from and to inline-data files. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/reflink | 2 + tests/ocfs2/001 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ocfs2/001.out | 14 ++++++++ tests/ocfs2/Makefile | 20 +++++++++++ tests/ocfs2/group | 1 + 5 files changed, 124 insertions(+), 1 deletion(-) 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/common/reflink b/common/reflink index 9d51729..d048045 100644 --- a/common/reflink +++ b/common/reflink @@ -197,7 +197,7 @@ _cp_reflink() { file1="$1" file2="$2" - cp --reflink=always -p "$file1" "$file2" + cp --reflink=always -p -f "$file1" "$file2" } # Reflink some file1 into file2 diff --git a/tests/ocfs2/001 b/tests/ocfs2/001 new file mode 100755 index 0000000..afb9ce9 --- /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 --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
WARNING: multiple messages have this Message-ID (diff)
From: Darrick J. Wong <darrick.wong@oracle.com> To: eguan@redhat.com, darrick.wong@oracle.com Cc: ocfs2-devel@oss.oracle.com, fstests@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files Date: Sun, 11 Dec 2016 13:52:51 -0800 [thread overview] Message-ID: <148149317133.31093.439907074888693999.stgit@birch.djwong.org> (raw) In-Reply-To: <148149316504.31093.16129068344227450710.stgit@birch.djwong.org> Make sure that we can handle reflinking from and to inline-data files. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/reflink | 2 + tests/ocfs2/001 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ocfs2/001.out | 14 ++++++++ tests/ocfs2/Makefile | 20 +++++++++++ tests/ocfs2/group | 1 + 5 files changed, 124 insertions(+), 1 deletion(-) 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/common/reflink b/common/reflink index 9d51729..d048045 100644 --- a/common/reflink +++ b/common/reflink @@ -197,7 +197,7 @@ _cp_reflink() { file1="$1" file2="$2" - cp --reflink=always -p "$file1" "$file2" + cp --reflink=always -p -f "$file1" "$file2" } # Reflink some file1 into file2 diff --git a/tests/ocfs2/001 b/tests/ocfs2/001 new file mode 100755 index 0000000..afb9ce9 --- /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 --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
next prev parent reply other threads:[~2016-12-11 21:53 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-12-11 21:52 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong 2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-11 21:52 ` Darrick J. Wong [this message] 2016-12-11 21:52 ` [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files Darrick J. Wong 2016-12-12 9:01 ` Eryu Guan 2016-12-12 18:09 ` Darrick J. Wong 2016-12-12 18:09 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-13 3:20 ` Eryu Guan 2016-12-13 7:11 ` Darrick J. Wong 2016-12-13 7:11 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-13 21:35 ` Darrick J. Wong 2016-12-13 21:35 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-14 7:32 ` Eric Ren 2016-12-14 7:32 ` [Ocfs2-devel] " Eric Ren 2016-12-11 21:52 ` [PATCH 2/7] ocfs2/reflink: fix file block size reporting Darrick J. Wong 2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-12 9:48 ` Eryu Guan 2016-12-12 23:08 ` Darrick J. Wong 2016-12-12 23:08 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-11 21:53 ` [PATCH 3/7] reflink: fix quota tests to work properly Darrick J. Wong 2016-12-11 21:53 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-12 10:06 ` Eryu Guan 2016-12-12 23:08 ` Darrick J. Wong 2016-12-12 23:08 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-11 21:53 ` [PATCH 4/7] reflink: fix space consumption tests Darrick J. Wong 2016-12-11 21:53 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-12 10:25 ` Eryu Guan 2016-12-12 23:03 ` Darrick J. Wong 2016-12-12 23:03 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-13 3:22 ` Eryu Guan 2016-12-11 21:53 ` [PATCH 5/7] reflink: make error reporting consistent Darrick J. Wong 2016-12-11 21:53 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-12 10:47 ` Eryu Guan 2016-12-12 23:06 ` Darrick J. Wong 2016-12-12 23:06 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-11 21:53 ` [PATCH 6/7] reflink: don't test disjoint block sharing sets Darrick J. Wong 2016-12-11 21:53 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-11 21:53 ` [PATCH 7/7] xfs/ext4: check negative inode size Darrick J. Wong 2016-12-11 21:53 ` [Ocfs2-devel] " Darrick J. Wong 2016-12-12 11:07 ` Eryu Guan 2016-12-13 21:49 ` Darrick J. Wong 2016-12-13 21:49 ` [Ocfs2-devel] " Darrick J. Wong 2017-01-05 1:04 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong 2017-01-05 1:04 ` [PATCH 1/7] ocfs2: test reflinking to inline data files Darrick J. Wong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=148149317133.31093.439907074888693999.stgit@birch.djwong.org \ --to=darrick.wong@oracle.com \ --cc=eguan@redhat.com \ --cc=fstests@vger.kernel.org \ --cc=ocfs2-devel@oss.oracle.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.