* [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls
@ 2015-06-30 4:15 Darrick J. Wong
2015-06-30 4:15 ` [PATCH 01/11] fuzz XFS and ext4 filesystems Darrick J. Wong
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Hi all,
This is a RFC-quality pass at making xfstests perform more rigorous
testing of the btrfs/xfs file clone, reflink, and dedupe ioctls.
There are now tests of the basic functionality of the three ioctls;
tests to ensure that the filesystem exhibits the expected copy on
write semantics; tests to try to suss out race conditions in the new
write paths; tests to ensure that the ioctls peform basic disk
accounting correctly; tests of the interaction between reflink and the
various fallocate verbs (allocate, punch, collapse, insert zeroes);
and some attempts to test the upper limits of reflinking. The first
patch in the series adds fuzz testing to ext4 and XFS; aside from
being first in line, it isn't tied to any of the reflink
functionality.
To run these tests, you'll have to patch xfsprogs to have reflink and
dedupe support[1]; the patch ought to apply fairly cleanly against the
upstream git. They should more or less work with the btrfs that
appears in 4.1, though if you want to test the XFS implementation,
you're going to have to apply a lot of patches to the kernel and
xfsprogs. See the cover letters[2][3] for those patchsets for more
information.
Known issues:
* I think the race checks for dedupe could be a little sharper at
finding mistakes.
* I started the numbering really high to prevent the tests from
colliding with whatever new tests might arrive; this will require
some intervention to fix.
* When ext4 gains reflink support, it shouldn't be difficult to make
these tests run on it. The patch set is based on the current
xfstest master on kernel.org.
* If the copy_file_range syscall ever comes around, we'll have to
adapt xfs_io to use that in addition to the btrfs ioctls.
Comments and questions are, as always, welcome.
--D
[1] http://djwong.org/docs/03-xfs_io-reflink-and-dedupe.patch
[2] See thread "[RFC 00/15] xfsprogs: support the reflink btree" dated today.
[3] http://oss.sgi.com/archives/xfs/2015-06/msg00407.html
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/11] fuzz XFS and ext4 filesystems
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
@ 2015-06-30 4:15 ` Darrick J. Wong
2015-06-30 4:15 ` [PATCH 02/11] move btrfs reflink tests to generic Darrick J. Wong
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Introduce tests for XFS and ext4 which format a filesystem, populate
it, then uses blocktrash and e2fuzz to corrupt the metadata. The FS
is remounted, modified, and unmounted. Following that, xfs_repair or
e2fsck are run until it no longer finds errors to correct, after which
the FS is mounted yet again and exercised to see if there are any
errors remaining.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/ext4/700 | 208 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/700.out | 3 +
tests/ext4/group | 1
tests/xfs/700 | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/700.out | 3 +
tests/xfs/group | 1
6 files changed, 435 insertions(+)
create mode 100755 tests/ext4/700
create mode 100644 tests/ext4/700.out
create mode 100755 tests/xfs/700
create mode 100644 tests/xfs/700.out
diff --git a/tests/ext4/700 b/tests/ext4/700
new file mode 100755
index 0000000..21de274
--- /dev/null
+++ b/tests/ext4/700
@@ -0,0 +1,208 @@
+#! /bin/bash
+# FS QA Test No. 700
+#
+# Create and populate an ext4 filesystem, fuzz the metadata, then see how
+# the kernel reacts, how e2fsck fares in fixing the mess, and then
+# try more kernel accesses to see if it really fixed things.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+if [ ! -x "$(which e2fuzz)" ]; then
+ _notrun "Couldn't find e2fuzz"
+fi
+
+# real QA test starts here
+_supported_fs ext4
+_supported_os Linux
+
+_require_scratch
+_require_attrs
+
+rm -f $seqres.full
+echo "See interesting results in $seqres.full" | sed -e "s,$RESULT_DIR,RESULT_DIR,g"
+SRCDIR=`pwd`
+test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-b 32 -v"
+test -z "${FSCK_PASSES}" && FSCK_PASSES=10
+BLK_SZ=4096
+
+echo "fuzzing ext4 with FUZZ_ARGS=$FUZZ_ARGS and FSCK_PASSES=$FSCK_PASSES" > $seqres.full
+
+echo "+ create scratch fs" >> $seqres.full
+_scratch_mkfs_ext4 >> $seqres.full 2>&1
+
+echo "+ populate fs image" >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "+ check fs creation" >> $seqres.full
+dumpe2fs -h "${SCRATCH_DEV}" >> $seqres.full 2>&1
+
+SRC_SZ="$(du -ks "${SRCDIR}" | cut -f 1)"
+FS_SZ="$(( $(stat -f "${SCRATCH_MNT}" -c '%a * %S') / 1024 ))"
+NR="$(( (FS_SZ * 6 / 10) / SRC_SZ ))"
+if [ "${NR}" -lt 1 ]; then
+ NR=1
+fi
+
+echo "+ make some copies" >> $seqres.full
+seq 1 "${NR}" | while read nr; do
+ cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.${nr}" >> $seqres.full 2>&1
+done
+umount "${SCRATCH_MNT}" >> $seqres.full 2>&1
+
+echo "+ check fs" >> $seqres.full
+_check_scratch_fs >> $seqres.full 2>&1
+
+echo "++ corrupt image" >> $seqres.full
+e2fuzz ${FUZZ_ARGS} ${SCRATCH_DEV} >> $seqres.full 2>&1
+
+echo "++ mount image" >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "+++ ls -laR" >> $seqres.full
+ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
+
+echo "+++ cat files" >> $seqres.full
+(find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
+
+echo "+++ expand" >> $seqres.full
+find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n 50000 | while read f; do
+ attr -l "$f" > /dev/null 2>&1
+ if [ -f "$f" -a -w "$f" ]; then
+ dd if=/dev/zero bs="${BLK_SZ}" count=1 >> "$f" 2>/dev/null
+ fi
+ mv "$f" "$f.longer" > /dev/null 2>/dev/null
+done
+sync
+
+echo "+++ create files" >> $seqres.full
+cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.moo" > /dev/null 2>&1
+sync
+
+echo "+++ remove files" >> $seqres.full
+rm -rf "${SCRATCH_MNT}/test.moo" > /dev/null 2>&1
+rm -rf "${SCRATCH_MNT}/test.1" > /dev/null 2>&1
+umount "${SCRATCH_MNT}"
+
+_fsck_pass() {
+ fsck_pass="$1"
+
+ FSCK_LOG="${tmp}-fuzz-${fsck_pass}.log"
+ echo "++ fsck pass ${fsck_pass}" > "${FSCK_LOG}"
+ e2fsck -f -y "${SCRATCH_DEV}"
+ res=$?
+ if [ "${res}" -eq 0 ]; then
+ echo "++ allegedly fixed, reverify" >> "${FSCK_LOG}"
+ _check_scratch_fs -n >> "${FSCK_LOG}" 2>&1
+ res=$?
+ fi
+ echo "++ fsck returns ${res}" >> "${FSCK_LOG}"
+ if [ "${res}" -eq 0 ]; then
+ echo "++ fsck thinks we are done" >> "${FSCK_LOG}"
+ cat "${FSCK_LOG}"
+ return 0
+ elif [ "${fsck_pass}" -eq "${FSCK_PASSES}" ]; then
+ echo "++ fsck did not fix in ${FSCK_PASSES} passes." >> "${FSCK_LOG}"
+ cat "${FSCK_LOG}"
+ return 0
+ fi
+ cat "${FSCK_LOG}"
+ if [ "${fsck_pass}" -gt 1 ]; then
+ cmp -s "${tmp}-fuzz-$((fsck_pass - 1)).log" "${FSCK_LOG}"
+ if [ $? -eq 0 ]; then
+ echo "++ fsck makes no progress"
+ return 2
+ fi
+ fi
+ return 1
+}
+
+# repair in a loop...
+for p in $(seq 1 "${FSCK_PASSES}"); do
+ _fsck_pass "$p" >> $seqres.full 2>&1 && break
+done
+echo "+ fsck loop returns ${fsck_loop_ret}" >> $seqres.full
+
+echo "++ check fs for round 2" >> $seqres.full
+_check_scratch_fs >> $seqres.full 2>&1
+
+ROUND2_LOG="${tmp}-round2-${fsck_pass}.log"
+echo "++ mount image (2)" >> $ROUND2_LOG
+_scratch_mount >> $ROUND2_LOG 2>&1
+
+echo "++ chattr -R -i" >> $ROUND2_LOG
+chattr -R -f -i "${SCRATCH_MNT}/" > /dev/null 2>> $ROUND2_LOG
+
+echo "++ ls -laR (2)" >> $ROUND2_LOG
+ls -laR "${SCRATCH_MNT}/" > /dev/null 2>> $ROUND2_LOG
+
+echo "++ cat files (2)" >> $ROUND2_LOG
+(find "${SCRATCH_MNT}/" -type f -size -1048576k -print0 | xargs -0 cat > /dev/null) 2>> $ROUND2_LOG
+
+echo "++ expand (2)" >> $ROUND2_LOG
+(find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n 50000 | while read f; do
+ attr -l "$f" > /dev/null
+ if [ -f "$f" -a -w "$f" ]; then
+ dd if=/dev/zero bs="${BLK_SZ}" count=1 >> "$f" 2> /dev/null
+ fi
+ mv "$f" "$f.longer" > /dev/null
+done) 2>> $ROUND2_LOG
+sync
+
+echo "++ create files (2)" >> $ROUND2_LOG
+cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.oom" >> $ROUND2_LOG 2>&1
+sync
+
+echo "++ remove files (2)" >> $ROUND2_LOG
+rm -rf "${SCRATCH_MNT}/test.oom" >> $ROUND2_LOG 2>&1
+
+umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1
+
+cat "$ROUND2_LOG" >> $seqres.full
+
+echo "++ check fs (2)" >> $seqres.full
+_check_scratch_fs >> $seqres.full 2>&1
+
+egrep -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
+ echo "e2fsck did not fix everything" | tee -a $seqres.full
+fi
+echo "finished fuzzing" | tee -a "$seqres.full"
+
+status=0
+exit
diff --git a/tests/ext4/700.out b/tests/ext4/700.out
new file mode 100644
index 0000000..c0a16f6
--- /dev/null
+++ b/tests/ext4/700.out
@@ -0,0 +1,3 @@
+QA output created by 700
+See interesting results in RESULT_DIR/700.full
+finished fuzzing
diff --git a/tests/ext4/group b/tests/ext4/group
index e7f1f2a..4cbc753 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -16,3 +16,4 @@
306 auto rw resize quick
307 auto ioctl rw
308 auto ioctl rw prealloc quick
+700 fuzzers
diff --git a/tests/xfs/700 b/tests/xfs/700
new file mode 100755
index 0000000..05fba25
--- /dev/null
+++ b/tests/xfs/700
@@ -0,0 +1,219 @@
+#! /bin/bash
+# FS QA Test No. 700
+#
+# Create and populate an XFS filesystem, fuzz the metadata, then see how
+# the kernel reacts, how xfs_repair fares in fixing the mess, and then
+# try more kernel accesses to see if it really fixed things.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+#_require_xfs_crc # checksum not required, but you probably want it anyway...
+#_require_xfs_mkfs_crc
+_require_attrs
+
+rm -f $seqres.full
+echo "See interesting results in $seqres.full" | sed -e "s,$RESULT_DIR,RESULT_DIR,g"
+SRCDIR=`pwd`
+test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-3 -n 32"
+test -z "${FSCK_PASSES}" && FSCK_PASSES=10
+BLK_SZ=4096
+
+echo "fuzzing xfs with FUZZ_ARGS=$FUZZ_ARGS and FSCK_PASSES=$FSCK_PASSES" > $seqres.full
+
+echo "+ create scratch fs" >> $seqres.full
+_scratch_mkfs_xfs >> $seqres.full 2>&1
+
+echo "+ populate fs image" >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "+ check fs creation" >> $seqres.full
+xfs_info "${SCRATCH_MNT}" >> $seqres.full 2>&1
+
+SRC_SZ="$(du -ks "${SRCDIR}" | cut -f 1)"
+FS_SZ="$(( $(stat -f "${SCRATCH_MNT}" -c '%a * %S') / 1024 ))"
+NR="$(( (FS_SZ * 6 / 10) / SRC_SZ ))"
+if [ "${NR}" -lt 1 ]; then
+ NR=1
+fi
+
+echo "+ make some copies" >> $seqres.full
+seq 1 "${NR}" | while read nr; do
+ cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.${nr}" >> $seqres.full 2>&1
+done
+umount "${SCRATCH_MNT}" >> $seqres.full 2>&1
+
+echo "+ check fs" >> $seqres.full
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "++ corrupt image" >> $seqres.full
+xfs_db -x -c blockget -c "blocktrash ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+
+echo "++ mount image" >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "+++ ls -laR" >> $seqres.full
+ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
+
+echo "+++ cat files" >> $seqres.full
+(find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
+
+echo "+++ expand" >> $seqres.full
+find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n 50000 | while read f; do
+ attr -l "$f" > /dev/null 2>&1
+ if [ -f "$f" -a -w "$f" ]; then
+ dd if=/dev/zero bs="${BLK_SZ}" count=1 >> "$f" 2>/dev/null
+ fi
+ mv "$f" "$f.longer" > /dev/null 2>/dev/null
+done
+sync
+
+echo "+++ create files" >> $seqres.full
+cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.moo" > /dev/null 2>&1
+sync
+
+echo "+++ remove files" >> $seqres.full
+rm -rf "${SCRATCH_MNT}/test.moo" > /dev/null 2>&1
+rm -rf "${SCRATCH_MNT}/test.1" > /dev/null 2>&1
+umount "${SCRATCH_MNT}"
+
+_fsck_pass() {
+ fsck_pass="$1"
+
+ FSCK_LOG="${tmp}-fuzz-${fsck_pass}.log"
+ echo "++ fsck pass ${fsck_pass}" > "${FSCK_LOG}"
+ _scratch_xfs_repair >> "${FSCK_LOG}" 2>&1
+ res=$?
+ if [ "${res}" -eq 0 ]; then
+ echo "++ allegedly fixed, reverify" >> "${FSCK_LOG}"
+ _scratch_xfs_repair -n >> "${FSCK_LOG}" 2>&1
+ res=$?
+ fi
+ echo "++ fsck returns ${res}" >> "${FSCK_LOG}"
+ if [ "${res}" -eq 0 ]; then
+ echo "++ fsck thinks we are done" >> "${FSCK_LOG}"
+ cat "${FSCK_LOG}"
+ return 0
+ elif [ "${res}" -eq 2 ]; then
+ # replay log?
+ echo "+++ replaying log" >> "${FSCK_LOG}"
+ _scratch_mount >> "${FSCK_LOG}" 2>&1
+ res=$?
+ echo "+++ mount returns ${res}" >> "${FSCK_LOG}"
+ if [ "${res}" -gt 0 ]; then
+ echo "+++ zeroing log" >> "${FSCK_LOG}"
+ _scratch_xfs_repair -L >> "${FSCK_LOG}" 2>&1
+ echo "+++ returns $?" >> "${FSCK_LOG}"
+ else
+ umount "${SCRATCH_MNT}" >> "${FSCK_LOG}" 2>&1
+ fi
+ elif [ "${fsck_pass}" -eq "${FSCK_PASSES}" ]; then
+ echo "++ fsck did not fix in ${FSCK_PASSES} passes." >> "${FSCK_LOG}"
+ cat "${FSCK_LOG}"
+ return 0
+ fi
+ cat "${FSCK_LOG}"
+ if [ "${fsck_pass}" -gt 1 ]; then
+ cmp -s "${tmp}-fuzz-$((fsck_pass - 1)).log" "${FSCK_LOG}"
+ if [ $? -eq 0 ]; then
+ echo "++ fsck makes no progress"
+ return 2
+ fi
+ fi
+ return 1
+}
+
+# repair in a loop...
+for p in $(seq 1 "${FSCK_PASSES}"); do
+ _fsck_pass "$p" >> $seqres.full 2>&1 && break
+done
+echo "+ fsck loop returns ${fsck_loop_ret}" >> $seqres.full
+
+echo "++ check fs for round 2" >> $seqres.full
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+ROUND2_LOG="${tmp}-round2-${fsck_pass}.log"
+echo "++ mount image (2)" >> $ROUND2_LOG
+_scratch_mount >> $ROUND2_LOG 2>&1
+
+echo "++ chattr -R -i" >> $ROUND2_LOG
+chattr -R -f -i "${SCRATCH_MNT}/" > /dev/null 2>> $ROUND2_LOG
+
+echo "++ ls -laR (2)" >> $ROUND2_LOG
+ls -laR "${SCRATCH_MNT}/" > /dev/null 2>> $ROUND2_LOG
+
+echo "++ cat files (2)" >> $ROUND2_LOG
+(find "${SCRATCH_MNT}/" -type f -size -1048576k -print0 | xargs -0 cat > /dev/null) 2>> $ROUND2_LOG
+
+echo "++ expand (2)" >> $ROUND2_LOG
+(find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n 50000 | while read f; do
+ attr -l "$f" > /dev/null
+ if [ -f "$f" -a -w "$f" ]; then
+ dd if=/dev/zero bs="${BLK_SZ}" count=1 >> "$f" 2> /dev/null
+ fi
+ mv "$f" "$f.longer" > /dev/null
+done) 2>> $ROUND2_LOG
+sync
+
+echo "++ create files (2)" >> $ROUND2_LOG
+cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.oom" >> $ROUND2_LOG 2>&1
+sync
+
+echo "++ remove files (2)" >> $ROUND2_LOG
+rm -rf "${SCRATCH_MNT}/test.oom" >> $ROUND2_LOG 2>&1
+
+umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1
+
+cat "$ROUND2_LOG" >> $seqres.full
+
+echo "++ check fs (2)" >> $seqres.full
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+egrep -q '(did not fix|makes no progress)' $seqres.full && echo "xfs_repair failed" | tee -a $seqres.full
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
+ echo "xfs_repair did not fix everything" | tee -a $seqres.full
+fi
+echo "finished fuzzing" | tee -a "$seqres.full"
+
+status=0
+exit
diff --git a/tests/xfs/700.out b/tests/xfs/700.out
new file mode 100644
index 0000000..c0a16f6
--- /dev/null
+++ b/tests/xfs/700.out
@@ -0,0 +1,3 @@
+QA output created by 700
+See interesting results in RESULT_DIR/700.full
+finished fuzzing
diff --git a/tests/xfs/group b/tests/xfs/group
index 848a1bd..c12b90a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -192,3 +192,4 @@
303 auto quick quota
304 auto quick quota
305 auto quota
+700 fuzzers
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/11] move btrfs reflink tests to generic
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-06-30 4:15 ` [PATCH 01/11] fuzz XFS and ext4 filesystems Darrick J. Wong
@ 2015-06-30 4:15 ` Darrick J. Wong
2015-06-30 4:15 ` [PATCH 03/11] generic/32[6-8]: support xfs in addition to btrfs Darrick J. Wong
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Move the cp --reflink tests from btrfs/ to generic/ since xfs now
supports that ioctl.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/btrfs/026 | 92 -----------------------------------------
tests/btrfs/026.out | 16 -------
tests/btrfs/027 | 109 -------------------------------------------------
tests/btrfs/027.out | 25 -----------
tests/btrfs/028 | 83 -------------------------------------
tests/btrfs/028.out | 7 ---
tests/btrfs/group | 3 -
tests/generic/800 | 92 +++++++++++++++++++++++++++++++++++++++++
tests/generic/800.out | 16 +++++++
tests/generic/801 | 109 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/801.out | 25 +++++++++++
tests/generic/802 | 83 +++++++++++++++++++++++++++++++++++++
tests/generic/802.out | 7 +++
tests/generic/group | 3 +
14 files changed, 335 insertions(+), 335 deletions(-)
delete mode 100755 tests/btrfs/026
delete mode 100644 tests/btrfs/026.out
delete mode 100755 tests/btrfs/027
delete mode 100644 tests/btrfs/027.out
delete mode 100755 tests/btrfs/028
delete mode 100644 tests/btrfs/028.out
create mode 100755 tests/generic/800
create mode 100644 tests/generic/800.out
create mode 100755 tests/generic/801
create mode 100644 tests/generic/801.out
create mode 100755 tests/generic/802
create mode 100644 tests/generic/802.out
diff --git a/tests/btrfs/026 b/tests/btrfs/026
deleted file mode 100755
index 7559ca2..0000000
--- a/tests/btrfs/026
+++ /dev/null
@@ -1,92 +0,0 @@
-#! /bin/bash
-# FS QA Test No. 026
-#
-# Tests file clone functionality of btrfs ("reflinks"):
-# - Reflink a file
-# - Reflink the reflinked file
-# - Modify the original file
-# - Modify the reflinked file
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2014, 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 -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. common/rc
-. common/filter
-
-# real QA test starts here
-_supported_fs btrfs
-_supported_os Linux
-
-_require_xfs_io_command "fiemap"
-_require_cp_reflink
-_require_test
-
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
-
-_checksum_files() {
- for F in original copy1 copy2
- do
- md5sum $TESTDIR1/$F | _filter_test_dir
- done
-}
-
-rm -f $seqres.full
-
-echo "Create the original file and reflink to copy1, copy2"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
- >> $seqres.full 2>&1
-cp --reflink $TESTDIR1/original $TESTDIR1/copy1
-cp --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy1
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy2
-echo "Original md5sums:"
-_checksum_files
-
-echo "Overwrite original file with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $TESTDIR1/original \
- >> $seqres.full 2>&1
-echo "md5sums after overwriting original:"
-_checksum_files
-
-echo "Overwrite copy1 with different new data"
-$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $TESTDIR1/copy1 \
- >> $seqres.full 2>&1
-echo "md5sums after overwriting copy1:"
-_checksum_files
-
-# success, all done
-status=0
-exit
diff --git a/tests/btrfs/026.out b/tests/btrfs/026.out
deleted file mode 100644
index 3b90ff0..0000000
--- a/tests/btrfs/026.out
+++ /dev/null
@@ -1,16 +0,0 @@
-QA output created by 026
-Create the original file and reflink to copy1, copy2
-Original md5sums:
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/original
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/copy1
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/copy2
-Overwrite original file with new data
-md5sums after overwriting original:
-4a847a25439532bf48b68c9e9536ed5b TEST_DIR/test-026/original
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/copy1
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/copy2
-Overwrite copy1 with different new data
-md5sums after overwriting copy1:
-4a847a25439532bf48b68c9e9536ed5b TEST_DIR/test-026/original
-e271cd47d9f62ebc96cb4e67ae4d16db TEST_DIR/test-026/copy1
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-026/copy2
diff --git a/tests/btrfs/027 b/tests/btrfs/027
deleted file mode 100755
index d2b812b..0000000
--- a/tests/btrfs/027
+++ /dev/null
@@ -1,109 +0,0 @@
-#! /bin/bash
-# FS QA Test No. 027
-#
-# Tests file clone functionality of btrfs ("reflinks") on directory
-# trees.
-# - Create directory and subdirectory, each having one file
-# - Create 2 recursive reflinked copies of the tree
-# - Modify the original files
-# - Modify one of the copies
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2014, 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 -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. common/rc
-. common/filter
-
-# real QA test starts here
-_supported_fs btrfs
-_supported_os Linux
-
-_require_xfs_io_command "fiemap"
-_require_cp_reflink
-_require_test
-
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
-
-_checksum_files() {
- for F in original/file1 original/subdir/file2 \
- copy1/file1 copy1/subdir/file2 \
- copy2/file1 copy2/subdir/file2
- do
- md5sum $TESTDIR1/$F | _filter_test_dir
- done
-}
-
-rm -f $seqres.full
-
-mkdir $TESTDIR1/original
-mkdir $TESTDIR1/original/subdir
-
-echo "Create the original files and reflink dirs"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original/file1 \
- >> $seqres.full 2>&1
-$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 11000' \
- $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
-cp --recursive --reflink $TESTDIR1/original $TESTDIR1/copy1
-cp --recursive --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
-
-_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy1/file1
-_verify_reflink $TESTDIR1/original/subdir/file2 \
- $TESTDIR1/copy1/subdir/file2
-_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy2/file1
-_verify_reflink $TESTDIR1/original/subdir/file2 \
- $TESTDIR1/copy2/subdir/file2
-
-echo "Original md5sums:"
-_checksum_files
-
-echo "Overwrite original/file1 and original/subdir/file2 with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $TESTDIR1/original/file1 \
- >> $seqres.full 2>&1
-$XFS_IO_PROG -c 'pwrite -S 0x64 5000 1000' \
- $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
-echo "md5sums now:"
-_checksum_files
-
-echo "Overwrite copy1/file1 and copy1/subdir/file2 with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $TESTDIR1/copy1/file1 \
- >> $seqres.full 2>&1
-$XFS_IO_PROG -c 'pwrite -S 0x66 5000 25000' \
- $TESTDIR1/copy1/subdir/file2 >> $seqres.full 2>&1
-echo "md5sums now:"
-_checksum_files
-
-# success, all done
-status=0
-exit
diff --git a/tests/btrfs/027.out b/tests/btrfs/027.out
deleted file mode 100644
index 7b7e3bb..0000000
--- a/tests/btrfs/027.out
+++ /dev/null
@@ -1,25 +0,0 @@
-QA output created by 027
-Create the original files and reflink dirs
-Original md5sums:
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/original/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/original/subdir/file2
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/copy1/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/copy1/subdir/file2
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/copy2/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/copy2/subdir/file2
-Overwrite original/file1 and original/subdir/file2 with new data
-md5sums now:
-260f6785c0537fd12582dcae28a3c1a9 TEST_DIR/test-027/original/file1
-b8d91fb600f6f2191f2ba66665374860 TEST_DIR/test-027/original/subdir/file2
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/copy1/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/copy1/subdir/file2
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/copy2/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/copy2/subdir/file2
-Overwrite copy1/file1 and copy1/subdir/file2 with new data
-md5sums now:
-260f6785c0537fd12582dcae28a3c1a9 TEST_DIR/test-027/original/file1
-b8d91fb600f6f2191f2ba66665374860 TEST_DIR/test-027/original/subdir/file2
-b20229a003e3985c4b0e6806abcd6642 TEST_DIR/test-027/copy1/file1
-b815b24069db14e0a3a07169fd563e93 TEST_DIR/test-027/copy1/subdir/file2
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-027/copy2/file1
-ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-027/copy2/subdir/file2
diff --git a/tests/btrfs/028 b/tests/btrfs/028
deleted file mode 100755
index 7193337..0000000
--- a/tests/btrfs/028
+++ /dev/null
@@ -1,83 +0,0 @@
-#! /bin/bash
-# FS QA Test No. 028
-#
-# Moving and deleting cloned ("reflinked") files on btrfs:
-# - Create a file and a reflink
-# - Move both to a directory
-# - Delete the original (moved) file, check that the copy still exists.
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2014, 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 -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-
-# real QA test starts here
-_supported_fs btrfs
-_supported_os Linux
-
-_require_xfs_io_command "fiemap"
-_require_cp_reflink
-_require_test
-
-rm -f $seqres.full
-
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
-
-echo "Create the original files and reflink dirs"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
- >> $seqres.full
-cp --reflink $TESTDIR1/original $TESTDIR1/copy
-
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy
-
-echo "Move orig & reflink copy to subdir and md5sum:"
-mkdir $TESTDIR1/subdir
-mv $TESTDIR1/original $TESTDIR1/subdir/original_moved
-mv $TESTDIR1/copy $TESTDIR1/subdir/copy_moved
-_verify_reflink $TESTDIR1/subdir/original_moved \
- $TESTDIR1/subdir/copy_moved
-
-md5sum $TESTDIR1/subdir/original_moved | _filter_test_dir
-md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
-
-echo "remove orig from subdir and md5sum reflink copy:"
-rm $TESTDIR1/subdir/original_moved
-md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
-rm -rf $TESTDIR1/subdir
-
-# success, all done
-status=0
-exit
diff --git a/tests/btrfs/028.out b/tests/btrfs/028.out
deleted file mode 100644
index f683fce..0000000
--- a/tests/btrfs/028.out
+++ /dev/null
@@ -1,7 +0,0 @@
-QA output created by 028
-Create the original files and reflink dirs
-Move orig & reflink copy to subdir and md5sum:
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-028/subdir/original_moved
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-028/subdir/copy_moved
-remove orig from subdir and md5sum reflink copy:
-42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-028/subdir/copy_moved
diff --git a/tests/btrfs/group b/tests/btrfs/group
index ffe18bf..f69aa6e 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -28,9 +28,6 @@
023 auto
024 auto quick compress
025 auto quick send clone
-026 auto quick clone
-027 auto quick clone
-028 auto quick clone
029 auto quick clone
030 auto quick send
031 auto quick subvol clone
diff --git a/tests/generic/800 b/tests/generic/800
new file mode 100755
index 0000000..a71f11a
--- /dev/null
+++ b/tests/generic/800
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 800
+#
+# Tests file clone functionality of btrfs ("reflinks"):
+# - Reflink a file
+# - Reflink the reflinked file
+# - Modify the original file
+# - Modify the reflinked file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+TESTDIR1=$TEST_DIR/test-$seq
+rm -rf $TESTDIR1
+mkdir $TESTDIR1
+
+_checksum_files() {
+ for F in original copy1 copy2
+ do
+ md5sum $TESTDIR1/$F | _filter_test_dir
+ done
+}
+
+rm -f $seqres.full
+
+echo "Create the original file and reflink to copy1, copy2"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
+ >> $seqres.full 2>&1
+cp --reflink $TESTDIR1/original $TESTDIR1/copy1
+cp --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
+_verify_reflink $TESTDIR1/original $TESTDIR1/copy1
+_verify_reflink $TESTDIR1/original $TESTDIR1/copy2
+echo "Original md5sums:"
+_checksum_files
+
+echo "Overwrite original file with new data"
+$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $TESTDIR1/original \
+ >> $seqres.full 2>&1
+echo "md5sums after overwriting original:"
+_checksum_files
+
+echo "Overwrite copy1 with different new data"
+$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $TESTDIR1/copy1 \
+ >> $seqres.full 2>&1
+echo "md5sums after overwriting copy1:"
+_checksum_files
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/800.out b/tests/generic/800.out
new file mode 100644
index 0000000..6978d71
--- /dev/null
+++ b/tests/generic/800.out
@@ -0,0 +1,16 @@
+QA output created by 800
+Create the original file and reflink to copy1, copy2
+Original md5sums:
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/original
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/copy1
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/copy2
+Overwrite original file with new data
+md5sums after overwriting original:
+4a847a25439532bf48b68c9e9536ed5b TEST_DIR/test-800/original
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/copy1
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/copy2
+Overwrite copy1 with different new data
+md5sums after overwriting copy1:
+4a847a25439532bf48b68c9e9536ed5b TEST_DIR/test-800/original
+e271cd47d9f62ebc96cb4e67ae4d16db TEST_DIR/test-800/copy1
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-800/copy2
diff --git a/tests/generic/801 b/tests/generic/801
new file mode 100755
index 0000000..b21c44b
--- /dev/null
+++ b/tests/generic/801
@@ -0,0 +1,109 @@
+#! /bin/bash
+# FS QA Test No. 801
+#
+# Tests file clone functionality of btrfs ("reflinks") on directory
+# trees.
+# - Create directory and subdirectory, each having one file
+# - Create 2 recursive reflinked copies of the tree
+# - Modify the original files
+# - Modify one of the copies
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+TESTDIR1=$TEST_DIR/test-$seq
+rm -rf $TESTDIR1
+mkdir $TESTDIR1
+
+_checksum_files() {
+ for F in original/file1 original/subdir/file2 \
+ copy1/file1 copy1/subdir/file2 \
+ copy2/file1 copy2/subdir/file2
+ do
+ md5sum $TESTDIR1/$F | _filter_test_dir
+ done
+}
+
+rm -f $seqres.full
+
+mkdir $TESTDIR1/original
+mkdir $TESTDIR1/original/subdir
+
+echo "Create the original files and reflink dirs"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original/file1 \
+ >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 11000' \
+ $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
+cp --recursive --reflink $TESTDIR1/original $TESTDIR1/copy1
+cp --recursive --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
+
+_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy1/file1
+_verify_reflink $TESTDIR1/original/subdir/file2 \
+ $TESTDIR1/copy1/subdir/file2
+_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy2/file1
+_verify_reflink $TESTDIR1/original/subdir/file2 \
+ $TESTDIR1/copy2/subdir/file2
+
+echo "Original md5sums:"
+_checksum_files
+
+echo "Overwrite original/file1 and original/subdir/file2 with new data"
+$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $TESTDIR1/original/file1 \
+ >> $seqres.full 2>&1
+$XFS_IO_PROG -c 'pwrite -S 0x64 5000 1000' \
+ $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
+echo "md5sums now:"
+_checksum_files
+
+echo "Overwrite copy1/file1 and copy1/subdir/file2 with new data"
+$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $TESTDIR1/copy1/file1 \
+ >> $seqres.full 2>&1
+$XFS_IO_PROG -c 'pwrite -S 0x66 5000 25000' \
+ $TESTDIR1/copy1/subdir/file2 >> $seqres.full 2>&1
+echo "md5sums now:"
+_checksum_files
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/801.out b/tests/generic/801.out
new file mode 100644
index 0000000..b8225cc
--- /dev/null
+++ b/tests/generic/801.out
@@ -0,0 +1,25 @@
+QA output created by 801
+Create the original files and reflink dirs
+Original md5sums:
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/original/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/original/subdir/file2
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/copy1/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/copy1/subdir/file2
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/copy2/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/copy2/subdir/file2
+Overwrite original/file1 and original/subdir/file2 with new data
+md5sums now:
+260f6785c0537fd12582dcae28a3c1a9 TEST_DIR/test-801/original/file1
+b8d91fb600f6f2191f2ba66665374860 TEST_DIR/test-801/original/subdir/file2
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/copy1/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/copy1/subdir/file2
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/copy2/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/copy2/subdir/file2
+Overwrite copy1/file1 and copy1/subdir/file2 with new data
+md5sums now:
+260f6785c0537fd12582dcae28a3c1a9 TEST_DIR/test-801/original/file1
+b8d91fb600f6f2191f2ba66665374860 TEST_DIR/test-801/original/subdir/file2
+b20229a003e3985c4b0e6806abcd6642 TEST_DIR/test-801/copy1/file1
+b815b24069db14e0a3a07169fd563e93 TEST_DIR/test-801/copy1/subdir/file2
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-801/copy2/file1
+ca390545f0aedb54b808d6128c56a7dd TEST_DIR/test-801/copy2/subdir/file2
diff --git a/tests/generic/802 b/tests/generic/802
new file mode 100755
index 0000000..afd8513
--- /dev/null
+++ b/tests/generic/802
@@ -0,0 +1,83 @@
+#! /bin/bash
+# FS QA Test No. 802
+#
+# Moving and deleting cloned ("reflinked") files on btrfs:
+# - Create a file and a reflink
+# - Move both to a directory
+# - Delete the original (moved) file, check that the copy still exists.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR1=$TEST_DIR/test-$seq
+rm -rf $TESTDIR1
+mkdir $TESTDIR1
+
+echo "Create the original files and reflink dirs"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
+ >> $seqres.full
+cp --reflink $TESTDIR1/original $TESTDIR1/copy
+
+_verify_reflink $TESTDIR1/original $TESTDIR1/copy
+
+echo "Move orig & reflink copy to subdir and md5sum:"
+mkdir $TESTDIR1/subdir
+mv $TESTDIR1/original $TESTDIR1/subdir/original_moved
+mv $TESTDIR1/copy $TESTDIR1/subdir/copy_moved
+_verify_reflink $TESTDIR1/subdir/original_moved \
+ $TESTDIR1/subdir/copy_moved
+
+md5sum $TESTDIR1/subdir/original_moved | _filter_test_dir
+md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
+
+echo "remove orig from subdir and md5sum reflink copy:"
+rm $TESTDIR1/subdir/original_moved
+md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
+rm -rf $TESTDIR1/subdir
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/802.out b/tests/generic/802.out
new file mode 100644
index 0000000..c20e16e
--- /dev/null
+++ b/tests/generic/802.out
@@ -0,0 +1,7 @@
+QA output created by 802
+Create the original files and reflink dirs
+Move orig & reflink copy to subdir and md5sum:
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-802/subdir/original_moved
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-802/subdir/copy_moved
+remove orig from subdir and md5sum reflink copy:
+42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/test-802/subdir/copy_moved
diff --git a/tests/generic/group b/tests/generic/group
index 0c8964c..433ac30 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -194,3 +194,6 @@
323 auto aio stress
324 auto fsr quick
325 auto quick data log
+800 auto quick clone
+801 auto quick clone
+802 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/11] generic/32[6-8]: support xfs in addition to btrfs
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-06-30 4:15 ` [PATCH 01/11] fuzz XFS and ext4 filesystems Darrick J. Wong
2015-06-30 4:15 ` [PATCH 02/11] move btrfs reflink tests to generic Darrick J. Wong
@ 2015-06-30 4:15 ` Darrick J. Wong
2015-06-30 4:15 ` [PATCH 04/11] basic tests of the reflink and dedupe ioctls Darrick J. Wong
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Modify the reflink tests to support xfs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/rc | 37 +++++++++++++++++++++++++++++++++++++
tests/generic/800 | 2 +-
tests/generic/801 | 2 +-
tests/generic/802 | 2 +-
4 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/common/rc b/common/rc
index 51d2fcb..8f20dc8 100644
--- a/common/rc
+++ b/common/rc
@@ -1397,6 +1397,43 @@ _require_xfs_crc()
umount $SCRATCH_MNT
}
+# this test requires the test fs support reflink...
+#
+_require_test_reflink()
+{
+ case $FSTYP in
+ xfs)
+ xfs_info "${TEST_DIR}" | grep reflink=1 -c -q || _notrun "Reflink not supported by this filesystem type: $FSTYP"
+ ;;
+ btrfs)
+ true
+ ;;
+ *)
+ _notrun "Reflink not supported by this filesystem type: $FSTYP"
+ ;;
+ esac
+}
+
+# this test requires the scratch fs support reflink...
+#
+_require_scratch_reflink()
+{
+ case $FSTYP in
+ xfs)
+ _scratch_mkfs > /dev/null 2>&1
+ _scratch_mount
+ xfs_info "${TEST_DIR}" | grep reflink=1 -c -q || _notrun "$FSTYP does not support reflink"
+ _scratch_unmount
+ ;;
+ btrfs)
+ true
+ ;;
+ *)
+ _notrun "Reflink not supported by this filesystem type: $FSTYP"
+ ;;
+ esac
+}
+
# this test requires the bigalloc feature to be available in mkfs.ext4
#
_require_ext4_mkfs_bigalloc()
diff --git a/tests/generic/800 b/tests/generic/800
index a71f11a..954f39d 100755
--- a/tests/generic/800
+++ b/tests/generic/800
@@ -45,7 +45,7 @@ _cleanup()
. common/filter
# real QA test starts here
-_supported_fs btrfs
+_require_test_reflink
_supported_os Linux
_require_xfs_io_command "fiemap"
diff --git a/tests/generic/801 b/tests/generic/801
index b21c44b..aedb6e9 100755
--- a/tests/generic/801
+++ b/tests/generic/801
@@ -45,7 +45,7 @@ _cleanup()
. common/filter
# real QA test starts here
-_supported_fs btrfs
+_require_test_reflink
_supported_os Linux
_require_xfs_io_command "fiemap"
diff --git a/tests/generic/802 b/tests/generic/802
index afd8513..51d3414 100755
--- a/tests/generic/802
+++ b/tests/generic/802
@@ -43,7 +43,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_supported_fs btrfs
+_require_test_reflink
_supported_os Linux
_require_xfs_io_command "fiemap"
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/11] basic tests of the reflink and dedupe ioctls
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (2 preceding siblings ...)
2015-06-30 4:15 ` [PATCH 03/11] generic/32[6-8]: support xfs in addition to btrfs Darrick J. Wong
@ 2015-06-30 4:15 ` Darrick J. Wong
2015-06-30 4:15 ` [PATCH 05/11] test CoW behaviors of reflinked files Darrick J. Wong
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Test the operation of the btrfs (and now xfs) reflink and dedupe
ioctls at various file offsets and with matching and nonmatching
files.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/rc | 44 +++++++++++++++++
tests/generic/803 | 81 +++++++++++++++++++++++++++++++
tests/generic/803.out | 11 ++++
tests/generic/804 | 86 ++++++++++++++++++++++++++++++++
tests/generic/804.out | 13 +++++
tests/generic/805 | 113 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/805.out | 26 ++++++++++
tests/generic/806 | 81 +++++++++++++++++++++++++++++++
tests/generic/806.out | 11 ++++
tests/generic/807 | 87 +++++++++++++++++++++++++++++++++
tests/generic/807.out | 15 ++++++
tests/generic/817 | 89 ++++++++++++++++++++++++++++++++++
tests/generic/817.out | 10 ++++
tests/generic/818 | 94 +++++++++++++++++++++++++++++++++++
tests/generic/818.out | 12 +++++
tests/generic/819 | 130 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/819.out | 7 +++
tests/generic/820 | 118 ++++++++++++++++++++++++++++++++++++++++++++
tests/generic/820.out | 7 +++
tests/generic/group | 9 +++
20 files changed, 1044 insertions(+)
create mode 100755 tests/generic/803
create mode 100644 tests/generic/803.out
create mode 100755 tests/generic/804
create mode 100644 tests/generic/804.out
create mode 100755 tests/generic/805
create mode 100644 tests/generic/805.out
create mode 100755 tests/generic/806
create mode 100644 tests/generic/806.out
create mode 100755 tests/generic/807
create mode 100644 tests/generic/807.out
create mode 100755 tests/generic/817
create mode 100644 tests/generic/817.out
create mode 100755 tests/generic/818
create mode 100644 tests/generic/818.out
create mode 100755 tests/generic/819
create mode 100644 tests/generic/819.out
create mode 100755 tests/generic/820
create mode 100644 tests/generic/820.out
diff --git a/common/rc b/common/rc
index 8f20dc8..7521033 100644
--- a/common/rc
+++ b/common/rc
@@ -2604,6 +2604,50 @@ _verify_reflink()
|| echo "$1 and $2 are not reflinks: different extents"
}
+# Check that a particular range is shared
+# args: filename, start, end
+_check_shared_extent()
+{
+ $XFS_IO_PROG -f -c 'fiemap -v' $1 | tr '[].:' ' ' | \
+ awk "BEGIN {x = 0;} {start = \$2 * 512; end = (\$3 + 1) * 512; if (and(strtonum(\$7), 0x2000) && start < ($3 + $2) && end > $2) {x++;}} END {print x;}"
+}
+
+# Retrieve the pblk(s) associated with a file's lblk range
+# args: filename, start, len, cache_file
+_extent_physical()
+{
+ if [ -z "$3" ]; then
+ len="512"
+ else
+ len="$3"
+ fi
+ fiemap_cache_file="$4"
+ rm_cache_file=0
+ if [ -z "$fiemap_cache_file" ]; then
+ fiemap_cache_file="/tmp/fiemap.$$"
+ rm_cache_file=1
+ fi
+ if [ ! -e "$fiemap_cache_file" ]; then
+ $XFS_IO_PROG -f -c 'fiemap -v' "$1" | tr '[].:' ' ' | tail -n +3 > "$fiemap_cache_file"
+ fi
+ cat "$fiemap_cache_file" | \
+ awk "BEGIN {x = 0;} {start = \$2 * 512; end = (\$3 + 1) * 512; phys = \$4 * 512; if (start < ($len + $2) && end > $2) {if (\$4 == \"hole\") {printf(\"-1\n\");} else {printf(\"%d\n\", phys + $2 - start);}}}"
+ if [ "$rm_cache_file" -eq 1 ]; then
+ rm "$fiemap_cache_file"
+ fi
+}
+
+_numbers_equal()
+{
+ n="$1"
+ shift
+ i=1
+ for num in "$@"; do
+ test "$num" -eq "$n" || echo "num #$i does not match #0"
+ i=$((i + 1))
+ done
+}
+
_require_atime()
{
if [ "$FSTYP" == "nfs" ]; then
diff --git a/tests/generic/803 b/tests/generic/803
new file mode 100755
index 0000000..47d89a7
--- /dev/null
+++ b/tests/generic/803
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test No. 803
+#
+# Ensure that we can reflink parts of two files:
+# - Reflink identical parts of two identical files
+# - Check that we end up with identical contents
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Reflink the middle blocks together"
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 65536 65536 65536" $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Check shared extents"
+_check_shared_extent $TESTDIR/file1 65536 65536
+_check_shared_extent $TESTDIR/file2 65536 65536
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file2 65536 65536)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/803.out b/tests/generic/803.out
new file mode 100644
index 0000000..894d180
--- /dev/null
+++ b/tests/generic/803.out
@@ -0,0 +1,11 @@
+QA output created by 803
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-803/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-803/file2
+Reflink the middle blocks together
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-803/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-803/file2
+Check shared extents
+1
+1
+Check shared extent physical mapping matches
diff --git a/tests/generic/804 b/tests/generic/804
new file mode 100755
index 0000000..56a32f9
--- /dev/null
+++ b/tests/generic/804
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 804
+#
+# Ensuring that we can reflink non-matching parts of files:
+# - Reflink identical parts of two different files
+# - Check that we end up with identical contents in the reflink section
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 196608' $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Reflink the middle blocks together"
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 65536 65536 65536" $TESTDIR/file2 >> $seqres.full
+
+echo "Checksum both files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Compare the reflinked sections"
+diff -u <($XFS_IO_PROG -f -c 'pread -q -v 65536 65536' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65536 65536' $TESTDIR/file2)
+
+echo "Check shared extents"
+_check_shared_extent $TESTDIR/file1 65536 65536
+_check_shared_extent $TESTDIR/file2 65536 65536
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file2 65536 65536)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/804.out b/tests/generic/804.out
new file mode 100644
index 0000000..d60fe8e
--- /dev/null
+++ b/tests/generic/804.out
@@ -0,0 +1,13 @@
+QA output created by 804
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-804/file1
+f419d4baba769b4f017ac91ee1acdcb1 TEST_DIR/test-804/file2
+Reflink the middle blocks together
+Checksum both files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-804/file1
+86f2e64aa5e9daa4f21a0cdd54a3bd99 TEST_DIR/test-804/file2
+Compare the reflinked sections
+Check shared extents
+1
+1
+Check shared extent physical mapping matches
diff --git a/tests/generic/805 b/tests/generic/805
new file mode 100755
index 0000000..7658fb3
--- /dev/null
+++ b/tests/generic/805
@@ -0,0 +1,113 @@
+#! /bin/bash
+# FS QA Test No. 805
+#
+# Reflinking two sets of files together:
+# - Reflink identical parts of two identical files
+# - Reflink identical parts of two other identical files
+# - Reflink identical parts of all four files
+# - Check that we end up with identical contents
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file3 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file4 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "Reflink the first blocks together"
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 131072" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file3 0 0 131072" $TESTDIR/file4 >> $seqres.full
+sync
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "Reflink the middle blocks together"
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 65536" $TESTDIR/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 65536" $TESTDIR/file4 >> $seqres.full
+sync
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "Check shared extents"
+_check_shared_extent $TESTDIR/file1 0 65536
+_check_shared_extent $TESTDIR/file2 0 65536
+_check_shared_extent $TESTDIR/file3 0 65536
+_check_shared_extent $TESTDIR/file4 0 65536
+_check_shared_extent $TESTDIR/file1 65536 65536
+_check_shared_extent $TESTDIR/file2 65536 65536
+_check_shared_extent $TESTDIR/file3 65536 65536
+_check_shared_extent $TESTDIR/file4 65536 65536
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 0 65536)" \
+ "$(_extent_physical $TESTDIR/file2 0 65536)" \
+ "$(_extent_physical $TESTDIR/file3 0 65536)" \
+ "$(_extent_physical $TESTDIR/file4 0 65536)"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file2 65536 65536)"
+_numbers_equal "$(_extent_physical $TESTDIR/file3 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file4 65536 65536)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/805.out b/tests/generic/805.out
new file mode 100644
index 0000000..ac6176f
--- /dev/null
+++ b/tests/generic/805.out
@@ -0,0 +1,26 @@
+QA output created by 805
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file2
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file3
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file4
+Reflink the first blocks together
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file2
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file3
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file4
+Reflink the middle blocks together
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file2
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file3
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-805/file4
+Check shared extents
+1
+1
+1
+1
+1
+1
+1
+1
+Check shared extent physical mapping matches
diff --git a/tests/generic/806 b/tests/generic/806
new file mode 100755
index 0000000..f11cceb
--- /dev/null
+++ b/tests/generic/806
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test No. 806
+#
+# Ensure that we can dedupe parts of two files:
+# - Dedupe identical parts of two identical files
+# - Check that we end up with identical contents
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "dedupe"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Dedupe the middle blocks together"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 65536 65536 65536" $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Check shared extents"
+_check_shared_extent $TESTDIR/file1 65536 65536
+_check_shared_extent $TESTDIR/file2 65536 65536
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file2 65536 65536)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/806.out b/tests/generic/806.out
new file mode 100644
index 0000000..c71bec4
--- /dev/null
+++ b/tests/generic/806.out
@@ -0,0 +1,11 @@
+QA output created by 806
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-806/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-806/file2
+Dedupe the middle blocks together
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-806/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-806/file2
+Check shared extents
+1
+1
+Check shared extent physical mapping matches
diff --git a/tests/generic/807 b/tests/generic/807
new file mode 100755
index 0000000..3f6e1d3
--- /dev/null
+++ b/tests/generic/807
@@ -0,0 +1,87 @@
+#! /bin/bash
+# FS QA Test No. 807
+#
+# Ensuring that we cannot dedupe non-matching parts of files:
+# - Fail to dedupe non-identical parts of two different files
+# - Check that nothing changes in either file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "dedupe"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196608' $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 196608' $TESTDIR/file2 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Dedupe the middle blocks together"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 65536 65536 65536" $TESTDIR/file2 >> $seqres.full
+
+echo "Checksum both files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+
+echo "Compare the deduped sections"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 65536 65536' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65536 65536' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+
+echo "Check shared extents"
+_check_shared_extent $TESTDIR/file1 65536 65536
+_check_shared_extent $TESTDIR/file2 65536 65536
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 65536 65536)" \
+ "$(_extent_physical $TESTDIR/file2 65536 65536)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/807.out b/tests/generic/807.out
new file mode 100644
index 0000000..61727be
--- /dev/null
+++ b/tests/generic/807.out
@@ -0,0 +1,15 @@
+QA output created by 807
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-807/file1
+f419d4baba769b4f017ac91ee1acdcb1 TEST_DIR/test-807/file2
+Dedupe the middle blocks together
+Checksum both files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-807/file1
+f419d4baba769b4f017ac91ee1acdcb1 TEST_DIR/test-807/file2
+Compare the deduped sections
+Sections do not match (intentional)
+Check shared extents
+0
+0
+Check shared extent physical mapping matches
+num #1 does not match #0
diff --git a/tests/generic/817 b/tests/generic/817
new file mode 100755
index 0000000..64ed4bb
--- /dev/null
+++ b/tests/generic/817
@@ -0,0 +1,89 @@
+#! /bin/bash
+# FS QA Test No. 817
+#
+# Ensure that we can reflink the last block of a file whose size isn't block-aligned.
+# - Create a file whose size isn't block-aligned
+# - Reflink the last block
+# - Check that we end up with identical contents
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((BLKSZ + 37))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((BLKSZ + 37))" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((BLKSZ + 37))" $TESTDIR/file3 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Reflink the last blocks together"
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $BLKSZ $BLKSZ 37" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $BLKSZ $BLKSZ 37" $TESTDIR/file3 >> $seqres.full
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 $BLKSZ)" \
+ "$(_extent_physical $TESTDIR/file2 $BLKSZ)"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 $BLKSZ)" \
+ "$(_extent_physical $TESTDIR/file3 $BLKSZ)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/817.out b/tests/generic/817.out
new file mode 100644
index 0000000..97ca8e2
--- /dev/null
+++ b/tests/generic/817.out
@@ -0,0 +1,10 @@
+QA output created by 817
+Create the original files
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-817/file1
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-817/file2
+2eb81ff80b06cee4f341410c6e82cda9 TEST_DIR/test-817/file3
+Reflink the last blocks together
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-817/file1
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-817/file2
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-817/file3
+Check shared extent physical mapping matches
diff --git a/tests/generic/818 b/tests/generic/818
new file mode 100755
index 0000000..1904b76
--- /dev/null
+++ b/tests/generic/818
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 818
+#
+# Ensure that we can dedupe the last block of a file whose size isn't block-aligned.
+# - Create a file whose size isn't block-aligned
+# - Create a second file identical to the first
+# - Create a different file of the same size
+# - Dedupe the last block of the first and second files
+# - Try to dedupe the last block of the first and third files
+# - Check that we end up with identical contents in files 1-2, and not
+# the same in 2-3.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "dedupe"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((BLKSZ + 37))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((BLKSZ + 37))" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((BLKSZ + 37))" $TESTDIR/file3 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Dedupe the last blocks together"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 $BLKSZ $BLKSZ 37" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 $BLKSZ $BLKSZ 37" $TESTDIR/file3 >> $seqres.full
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Check shared extent physical mapping matches"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 0)" \
+ "$(_extent_physical $TESTDIR/file2 0)"
+echo "Check unshared extent physical mapping doesn't match"
+_numbers_equal "$(_extent_physical $TESTDIR/file1 $BLKSZ)" \
+ "$(_extent_physical $TESTDIR/file3 $BLKSZ)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/818.out b/tests/generic/818.out
new file mode 100644
index 0000000..d3d2de5
--- /dev/null
+++ b/tests/generic/818.out
@@ -0,0 +1,12 @@
+QA output created by 818
+Create the original files
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-818/file1
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-818/file2
+2eb81ff80b06cee4f341410c6e82cda9 TEST_DIR/test-818/file3
+Dedupe the last blocks together
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-818/file1
+ce51fe7e361c6f39e48d003f0c9626d7 TEST_DIR/test-818/file2
+2eb81ff80b06cee4f341410c6e82cda9 TEST_DIR/test-818/file3
+Check shared extent physical mapping matches
+Check unshared extent physical mapping doesn't match
+num #1 does not match #0
diff --git a/tests/generic/819 b/tests/generic/819
new file mode 100755
index 0000000..5f63542
--- /dev/null
+++ b/tests/generic/819
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FS QA Test No. 819
+#
+# Ensure that we can reflink and dedupe blocks within the same file...
+# - Create a file with three distinct blocks ABB
+# - Reflink block zero to the multiple-of-three blocks
+# - Reflink block one to the multiple-of-five blocks
+# - Dedupe block two to the multiple-of-seven blocks
+# - Check that we successfully avoid deduping with holes, unwritten
+# extents, and non-matches; but actually dedupe real matches.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+if [ $FSTYP = "btrfs" ]; then
+ _notrun "btrfs doesn't support dedupe within the same file"
+fi
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "dedupe"
+_require_xfs_io_command "falloc"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $((BLKSZ * 2))" $TESTDIR/file1 >> $seqres.full
+
+NR_BLKS=1024
+
+echo "fallocate half the file"
+$XFS_IO_PROG -f -c "falloc $((NR_BLKS * BLKSZ / 2)) $((NR_BLKS * BLKSZ / 2))" $TESTDIR/file1 >> $seqres.full
+
+echo "Reflink block zero to the threes"
+seq 1 $((NR_BLKS / 3)) | while read nr; do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 $((nr * 3 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+echo "Reflink block one to the fives"
+seq 1 $((NR_BLKS / 5)) | while read nr; do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $BLKSZ $((nr * 5 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+echo "Dedupe block two to the sevens"
+seq 1 $((NR_BLKS / 7)) | while read nr; do
+ $XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 $((BLKSZ * 2)) $((nr * 7 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Check block mappings"
+pblk0=$(_extent_physical $TESTDIR/file1 0 "" $TESTDIR/file1.fiemap)
+pblk1=$(_extent_physical $TESTDIR/file1 $BLKSZ "" $TESTDIR/file1.fiemap)
+pblk2=$(_extent_physical $TESTDIR/file1 $((BLKSZ * 2)) "" $TESTDIR/file1.fiemap)
+check_block() {
+ lblk="$1"
+ rem7=$((lblk % 7))
+ rem5=$((lblk % 5))
+ rem3=$((lblk % 3))
+
+ pblk=$(_extent_physical $TESTDIR/file1 "$((lblk * BLKSZ))" "" $TESTDIR/file1.fiemap)
+ if [ $rem7 -eq 0 ]; then
+ if [ $rem5 -eq 0 ]; then
+ _numbers_equal $pblk2 $pblk
+ elif [ $rem3 -eq 0 ]; then
+ _numbers_equal $pblk0 $pblk
+ elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
+ _numbers_equal $pblk -1
+ fi
+ elif [ $rem5 -eq 0 ]; then
+ _numbers_equal $pblk1 $pblk
+ elif [ $rem3 -eq 0 ]; then
+ _numbers_equal $pblk0 $pblk
+ elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
+ _numbers_equal -1 $pblk
+ fi
+}
+seq 3 $((NR_BLKS - 1)) | while read lblk; do
+ err="$(check_block $lblk)"
+ test -n "$err" && echo "$lblk: $err"
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/819.out b/tests/generic/819.out
new file mode 100644
index 0000000..0ee5b14
--- /dev/null
+++ b/tests/generic/819.out
@@ -0,0 +1,7 @@
+QA output created by 819
+Create the original file blocks
+fallocate half the file
+Reflink block zero to the threes
+Reflink block one to the fives
+Dedupe block two to the sevens
+Check block mappings
diff --git a/tests/generic/820 b/tests/generic/820
new file mode 100755
index 0000000..9bcb513
--- /dev/null
+++ b/tests/generic/820
@@ -0,0 +1,118 @@
+#! /bin/bash
+# FS QA Test No. 820
+#
+# Ensure that we can reflink blocks within the same file...
+# - Create a file with three distinct blocks ABB
+# - Reflink block zero to the multiple-of-three blocks
+# - Reflink block one to the multiple-of-five blocks
+# - Reflink block two to the multiple-of-seven blocks
+# - Check that we successfully reflinked all the blocks.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "falloc"
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $((BLKSZ * 2))" $TESTDIR/file1 >> $seqres.full
+
+NR_BLKS=1024
+
+echo "fallocate half the file"
+$XFS_IO_PROG -f -c "falloc $((NR_BLKS * BLKSZ / 2)) $((NR_BLKS * BLKSZ / 2))" $TESTDIR/file1 >> $seqres.full
+
+echo "Reflink block zero to the threes"
+seq 1 $((NR_BLKS / 3)) | while read nr; do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 $((nr * 3 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+echo "Reflink block one to the fives"
+seq 1 $((NR_BLKS / 5)) | while read nr; do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $BLKSZ $((nr * 5 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+echo "Dedupe block two to the sevens"
+seq 1 $((NR_BLKS / 7)) | while read nr; do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $((BLKSZ * 2)) $((nr * 7 * BLKSZ)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+done
+
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Check block mappings"
+pblk0=$(_extent_physical $TESTDIR/file1 0 "" $TESTDIR/file1.fiemap)
+pblk1=$(_extent_physical $TESTDIR/file1 $BLKSZ "" $TESTDIR/file1.fiemap)
+pblk2=$(_extent_physical $TESTDIR/file1 $((BLKSZ * 2)) "" $TESTDIR/file1.fiemap)
+check_block() {
+ lblk="$1"
+ rem7=$((lblk % 7))
+ rem5=$((lblk % 5))
+ rem3=$((lblk % 3))
+
+ pblk=$(_extent_physical $TESTDIR/file1 "$((lblk * BLKSZ))" "" $TESTDIR/file1.fiemap)
+ if [ $rem7 -eq 0 ]; then
+ _numbers_equal $pblk2 $pblk
+ elif [ $rem5 -eq 0 ]; then
+ _numbers_equal $pblk1 $pblk
+ elif [ $rem3 -eq 0 ]; then
+ _numbers_equal $pblk0 $pblk
+ elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
+ _numbers_equal -1 $pblk
+ fi
+}
+seq 3 $((NR_BLKS - 1)) | while read lblk; do
+ err="$(check_block $lblk)"
+ test -n "$err" && echo "$lblk: $err"
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/820.out b/tests/generic/820.out
new file mode 100644
index 0000000..1f2784d
--- /dev/null
+++ b/tests/generic/820.out
@@ -0,0 +1,7 @@
+QA output created by 820
+Create the original file blocks
+fallocate half the file
+Reflink block zero to the threes
+Reflink block one to the fives
+Dedupe block two to the sevens
+Check block mappings
diff --git a/tests/generic/group b/tests/generic/group
index 433ac30..98d875a 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -197,3 +197,12 @@
800 auto quick clone
801 auto quick clone
802 auto quick clone
+803 auto quick clone
+804 auto quick clone
+805 auto quick clone
+806 auto quick clone
+807 auto quick clone
+817 auto quick clone
+818 auto quick clone
+819 auto quick clone
+820 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/11] test CoW behaviors of reflinked files
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (3 preceding siblings ...)
2015-06-30 4:15 ` [PATCH 04/11] basic tests of the reflink and dedupe ioctls Darrick J. Wong
@ 2015-06-30 4:15 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 06/11] reflink fallocate tests Darrick J. Wong
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:15 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Ensure that CoW happens correctly with buffered, directio, and mmap writes.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/808 | 138 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/808.out | 16 ++++++
tests/generic/809 | 138 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/809.out | 16 ++++++
tests/generic/810 | 138 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/810.out | 16 ++++++
tests/generic/837 | 88 +++++++++++++++++++++++++++++++
tests/generic/837.out | 7 ++
tests/generic/838 | 88 +++++++++++++++++++++++++++++++
tests/generic/838.out | 7 ++
tests/generic/group | 5 ++
11 files changed, 657 insertions(+)
create mode 100755 tests/generic/808
create mode 100644 tests/generic/808.out
create mode 100755 tests/generic/809
create mode 100644 tests/generic/809.out
create mode 100755 tests/generic/810
create mode 100644 tests/generic/810.out
create mode 100755 tests/generic/837
create mode 100644 tests/generic/837.out
create mode 100755 tests/generic/838
create mode 100644 tests/generic/838.out
diff --git a/tests/generic/808 b/tests/generic/808
new file mode 100755
index 0000000..10a79b5
--- /dev/null
+++ b/tests/generic/808
@@ -0,0 +1,138 @@
+#! /bin/bash
+# FS QA Test No. 808
+#
+# Ensuring that copy on write through the page cache works:
+# - Reflink two files together
+# - Write to the beginning, middle, and end
+# - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file1 >> $seqres.full
+cp --reflink $TESTDIR/file1 $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file3 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "CoW the second file"
+$XFS_IO_PROG -f -c "pwrite 0 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 0 17" $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite 60000 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 60000 17" $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite 196600 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 196600 17" $TESTDIR/file3 >> $seqres.full
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum both files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Compare the CoW'd section to the before file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196600 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196600 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+
+echo "Compare the CoW'd section to the after file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196600 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196600 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+echo "Compare the not CoW'd sections"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196500 100' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196500 100' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196500 100' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196500 100' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/808.out b/tests/generic/808.out
new file mode 100644
index 0000000..b2ca56c
--- /dev/null
+++ b/tests/generic/808.out
@@ -0,0 +1,16 @@
+QA output created by 808
+Create the original files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-808/file1
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-808/file2
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-808/file3
+CoW the second file
+Checksum both files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-808/file1
+90ca72fc3bacfe136ab1b1be1a4d2bd3 TEST_DIR/test-808/file2
+90ca72fc3bacfe136ab1b1be1a4d2bd3 TEST_DIR/test-808/file3
+Compare the CoW'd section to the before file
+Sections do not match (intentional)
+Sections do not match (intentional)
+Sections do not match (intentional)
+Compare the CoW'd section to the after file
+Compare the not CoW'd sections
diff --git a/tests/generic/809 b/tests/generic/809
new file mode 100755
index 0000000..9dce44d
--- /dev/null
+++ b/tests/generic/809
@@ -0,0 +1,138 @@
+#! /bin/bash
+# FS QA Test No. 809
+#
+# Ensuring that copy on write in direct-io mode works:
+# - Reflink two files together
+# - Write to the beginning, middle, and end in direct-io mode
+# - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file1 >> $seqres.full
+cp --reflink $TESTDIR/file1 $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file3 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "directio CoW the second file"
+$XFS_IO_PROG -f -c "pwrite 0 4096" -d $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 0 4096" -d $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite 65024 512" -d $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 65024 512" -d $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite 196096 4096" -d $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite 196096 4096" -d $TESTDIR/file3 >> $seqres.full
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum both files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Compare the CoW'd section to the before file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 4096' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 4096' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 65024 512' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65024 512' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196096 4096' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196096 4096' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+
+echo "Compare the CoW'd section to the after file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 4096' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 4096' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 65024 512' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65024 512' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196096 4096' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196096 4096' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+echo "Compare the not CoW'd sections"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 4096 512' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 4096 512' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 4096 512' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 4096 512' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 64512 512' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 64512 512' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 64512 512' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 64512 512' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 195584 512' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 195584 512' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 195584 512' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 195584 512' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 65536 512' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65536 512' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 65536 512' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 65536 512' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/809.out b/tests/generic/809.out
new file mode 100644
index 0000000..d23f30c
--- /dev/null
+++ b/tests/generic/809.out
@@ -0,0 +1,16 @@
+QA output created by 809
+Create the original files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-809/file1
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-809/file2
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-809/file3
+directio CoW the second file
+Checksum both files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-809/file1
+5f9e2359b2e8e18eabd8f6cd46d0e823 TEST_DIR/test-809/file2
+5f9e2359b2e8e18eabd8f6cd46d0e823 TEST_DIR/test-809/file3
+Compare the CoW'd section to the before file
+Sections do not match (intentional)
+Sections do not match (intentional)
+Sections do not match (intentional)
+Compare the CoW'd section to the after file
+Compare the not CoW'd sections
diff --git a/tests/generic/810 b/tests/generic/810
new file mode 100755
index 0000000..a0090fc
--- /dev/null
+++ b/tests/generic/810
@@ -0,0 +1,138 @@
+#! /bin/bash
+# FS QA Test No. 810
+#
+# Ensuring that mmap copy on write through the page cache works:
+# - Reflink two files together
+# - Write to the beginning, middle, and end
+# - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file1 >> $seqres.full
+cp --reflink $TESTDIR/file1 $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 196605' $TESTDIR/file3 >> $seqres.full
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "mmap CoW the second file"
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 0 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 0 17" $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 60000 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 60000 17" $TESTDIR/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 196588 17" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 196605" -c "mwrite 196588 17" $TESTDIR/file3 >> $seqres.full
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum both files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "Compare the CoW'd section to the before file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196588 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196588 17' $TESTDIR/file2) \
+ || echo "Sections do not match (intentional)"
+
+echo "Compare the CoW'd section to the after file"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 0 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60000 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196588 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196588 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+echo "Compare the not CoW'd sections"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 18 17' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 60018 82' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196500 88' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196500 88' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 196500 88' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 196500 88' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file1) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file2) \
+ || echo "Sections do not match"
+cmp -s <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file2) \
+ <($XFS_IO_PROG -f -c 'pread -q -v 50000 10000' $TESTDIR/file3) \
+ || echo "Sections do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/810.out b/tests/generic/810.out
new file mode 100644
index 0000000..f2e9bb1
--- /dev/null
+++ b/tests/generic/810.out
@@ -0,0 +1,16 @@
+QA output created by 810
+Create the original files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-810/file1
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-810/file2
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-810/file3
+mmap CoW the second file
+Checksum both files
+a1e4db1af2c4414774d4096bc86e04f7 TEST_DIR/test-810/file1
+9ce45bcb3bcfb0194ffee83f34e26beb TEST_DIR/test-810/file2
+9ce45bcb3bcfb0194ffee83f34e26beb TEST_DIR/test-810/file3
+Compare the CoW'd section to the before file
+Sections do not match (intentional)
+Sections do not match (intentional)
+Sections do not match (intentional)
+Compare the CoW'd section to the after file
+Compare the not CoW'd sections
diff --git a/tests/generic/837 b/tests/generic/837
new file mode 100755
index 0000000..2153b72
--- /dev/null
+++ b/tests/generic/837
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 837
+#
+# Ensure that reflinking a file N times and CoWing the copies leaves the
+# original intact.
+# - Create a file and record its hash and fiemap
+# - Create some reflink copies
+# - Rewrite all the reflink copies
+# - Compare the contents and fiemap of the original file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+SZ=$((1 * 1048576))
+NR=9
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+md5sum $TESTDIR/file1 | _filter_test_dir
+$XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 > $TESTDIR/fiemap
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+
+echo "Rewrite the copies"
+for i in `seq 2 $NR`; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 $SZ" $TESTDIR/file.$i >> $seqres.full
+ sync
+done
+
+echo "Examine original file"
+md5sum $TESTDIR/file1 | _filter_test_dir
+$XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 > $TESTDIR/fiemap.new
+cmp -s $TESTDIR/fiemap $TESTDIR/fiemap.new
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/837.out b/tests/generic/837.out
new file mode 100644
index 0000000..86d04c6
--- /dev/null
+++ b/tests/generic/837.out
@@ -0,0 +1,7 @@
+QA output created by 837
+Create the original file blocks
+7202826a7791073fe2787f0c94603278 TEST_DIR/test-837/file1
+Create the reflink copies
+Rewrite the copies
+Examine original file
+7202826a7791073fe2787f0c94603278 TEST_DIR/test-837/file1
diff --git a/tests/generic/838 b/tests/generic/838
new file mode 100755
index 0000000..33498c3
--- /dev/null
+++ b/tests/generic/838
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 837
+#
+# Ensure that reflinking a file N times and DIO CoWing the copies leaves the
+# original intact.
+# - Create a file and record its hash and fiemap
+# - Create some reflink copies
+# - Rewrite all the reflink copies with directio
+# - Compare the contents and fiemap of the original file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+SZ=$((1 * 1048576))
+NR=9
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+md5sum $TESTDIR/file1 | _filter_test_dir
+$XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 > $TESTDIR/fiemap
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+
+echo "Rewrite the copies"
+for i in `seq 2 $NR`; do
+ $XFS_IO_PROG -d -f -c "pwrite -S 0x62 0 $SZ" $TESTDIR/file.$i >> $seqres.full
+ sync
+done
+
+echo "Examine original file"
+md5sum $TESTDIR/file1 | _filter_test_dir
+$XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 > $TESTDIR/fiemap.new
+cmp -s $TESTDIR/fiemap $TESTDIR/fiemap.new
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/838.out b/tests/generic/838.out
new file mode 100644
index 0000000..6c07b9f
--- /dev/null
+++ b/tests/generic/838.out
@@ -0,0 +1,7 @@
+QA output created by 838
+Create the original file blocks
+7202826a7791073fe2787f0c94603278 TEST_DIR/test-838/file1
+Create the reflink copies
+Rewrite the copies
+Examine original file
+7202826a7791073fe2787f0c94603278 TEST_DIR/test-838/file1
diff --git a/tests/generic/group b/tests/generic/group
index 98d875a..9af1ef8 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -202,7 +202,12 @@
805 auto quick clone
806 auto quick clone
807 auto quick clone
+808 auto quick clone
+809 auto quick clone
+810 auto quick clone
817 auto quick clone
818 auto quick clone
819 auto quick clone
820 auto quick clone
+837 auto quick clone
+838 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/11] reflink fallocate tests
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (4 preceding siblings ...)
2015-06-30 4:15 ` [PATCH 05/11] test CoW behaviors of reflinked files Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 07/11] reflink concurrent operations tests Darrick J. Wong
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Check that the variants of fallocate (allocate, punch, zero range,
collapse range, insert range) do the right thing when they're run
against a range of reflinked blocks.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/811 | 104 +++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/811.out | 39 ++++++++++++++++++
tests/generic/812 | 106 ++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/812.out | 21 +++++++++
tests/generic/813 | 100 +++++++++++++++++++++++++++++++++++++++++++++
tests/generic/813.out | 24 +++++++++++
tests/generic/814 | 109 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/814.out | 24 +++++++++++
tests/generic/815 | 95 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/815.out | 16 +++++++
tests/generic/816 | 100 +++++++++++++++++++++++++++++++++++++++++++++
tests/generic/816.out | 24 +++++++++++
tests/generic/group | 6 +++
13 files changed, 768 insertions(+)
create mode 100755 tests/generic/811
create mode 100644 tests/generic/811.out
create mode 100755 tests/generic/812
create mode 100644 tests/generic/812.out
create mode 100755 tests/generic/813
create mode 100644 tests/generic/813.out
create mode 100755 tests/generic/814
create mode 100644 tests/generic/814.out
create mode 100755 tests/generic/815
create mode 100644 tests/generic/815.out
create mode 100755 tests/generic/816
create mode 100644 tests/generic/816.out
diff --git a/tests/generic/811 b/tests/generic/811
new file mode 100755
index 0000000..2eeb1d5
--- /dev/null
+++ b/tests/generic/811
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 811
+#
+# Ensure that fallocate steps around reflinked ranges:
+# - Reflink parts of two files together
+# - Fallocate all the other sparse space.
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "falloc"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 5))" -c "pwrite -S 0x61 0 $(( (BLKSZ * 5) + 37))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 5))" -c "reflink $TESTDIR/file1 $BLKSZ $BLKSZ $(( (BLKSZ * 4) + 37))" $TESTDIR/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 5))" -c "reflink $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 5))" -c "reflink $TESTDIR/file1 $BLKSZ $BLKSZ $BLKSZ" $TESTDIR/file4 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 5))" -c "reflink $TESTDIR/file1 $((BLKSZ * 3)) $((BLKSZ * 3)) $BLKSZ" $TESTDIR/file4 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file5
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+md5sum $TESTDIR/file5 | _filter_test_dir
+
+echo "falloc everything"
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 5))" $TESTDIR/file2
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 5))" $TESTDIR/file3
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 5))" $TESTDIR/file4
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 6))" $TESTDIR/file5
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+md5sum $TESTDIR/file5 | _filter_test_dir
+
+checker() {
+ echo '---'
+ for nr in `seq 0 $2`; do
+ echo "Check $1 block $nr: $(_numbers_equal $(_extent_physical $TESTDIR/$1 $((nr * BLKSZ)) $BLKSZ) $(_extent_physical $TESTDIR/file1 $((nr * BLKSZ)) $BLKSZ))"
+ done
+}
+checker file2 4
+checker file3 4
+checker file4 4
+checker file5 5
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/811.out b/tests/generic/811.out
new file mode 100644
index 0000000..e7812c7
--- /dev/null
+++ b/tests/generic/811.out
@@ -0,0 +1,39 @@
+QA output created by 811
+Create the original files
+009b3e150ecd3ef6e8e3ca51cb686cce TEST_DIR/test-811/file1
+c02d88b852eb45fdf6ecb76bcc2a57db TEST_DIR/test-811/file2
+30e9e109eea1bd6bfbd16ea0cf77dbdd TEST_DIR/test-811/file3
+84081fec09f6bac78a7c88cbe9510c8b TEST_DIR/test-811/file4
+009b3e150ecd3ef6e8e3ca51cb686cce TEST_DIR/test-811/file5
+falloc everything
+Checksum all files
+009b3e150ecd3ef6e8e3ca51cb686cce TEST_DIR/test-811/file1
+c02d88b852eb45fdf6ecb76bcc2a57db TEST_DIR/test-811/file2
+30e9e109eea1bd6bfbd16ea0cf77dbdd TEST_DIR/test-811/file3
+84081fec09f6bac78a7c88cbe9510c8b TEST_DIR/test-811/file4
+21e81f9335556ecab699637873c1670c TEST_DIR/test-811/file5
+---
+Check file2 block 0: num #1 does not match #0
+Check file2 block 1:
+Check file2 block 2:
+Check file2 block 3:
+Check file2 block 4:
+---
+Check file3 block 0:
+Check file3 block 1: num #1 does not match #0
+Check file3 block 2: num #1 does not match #0
+Check file3 block 3: num #1 does not match #0
+Check file3 block 4: num #1 does not match #0
+---
+Check file4 block 0: num #1 does not match #0
+Check file4 block 1:
+Check file4 block 2: num #1 does not match #0
+Check file4 block 3:
+Check file4 block 4: num #1 does not match #0
+---
+Check file5 block 0:
+Check file5 block 1:
+Check file5 block 2:
+Check file5 block 3:
+Check file5 block 4:
+Check file5 block 5: num #1 does not match #0
diff --git a/tests/generic/812 b/tests/generic/812
new file mode 100755
index 0000000..7774514
--- /dev/null
+++ b/tests/generic/812
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 812
+#
+# Ensure that collapse range steps around reflinked ranges:
+# - Create three reflink clones of a file
+# - Collapse the start, middle, and end of the reflink range of each
+# of the three files, respectively
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fcollapse"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file4
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file1
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file2
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file3
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file4
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "fcollapse files"
+$XFS_IO_PROG -f -c "fcollapse 0 $BLKSZ" $TESTDIR/file2
+$XFS_IO_PROG -f -c "fcollapse $BLKSZ $BLKSZ" $TESTDIR/file3
+$XFS_IO_PROG -f -c "fcollapse $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file4
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "Check file2 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file2 0) $(_extent_physical $TESTDIR/file1 $BLKSZ))"
+echo "Check file2 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file2 $BLKSZ) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 2))))"
+echo "Check file2 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file2 $((BLKSZ * 2))) -1) (intentional)"
+
+echo "Check file3 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file3 0) $(_extent_physical $TESTDIR/file1 0))"
+echo "Check file3 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file3 $BLKSZ) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 2))))"
+echo "Check file3 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file3 $((BLKSZ * 2))) -1) (intentional)"
+
+echo "Check file4 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file4 0) $(_extent_physical $TESTDIR/file1 0))"
+echo "Check file4 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file4 $BLKSZ) $(_extent_physical $TESTDIR/file1 $BLKSZ))"
+echo "Check file4 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file4 $((BLKSZ * 2))) -1) (intentional)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/812.out b/tests/generic/812.out
new file mode 100644
index 0000000..5cf5f5c
--- /dev/null
+++ b/tests/generic/812.out
@@ -0,0 +1,21 @@
+QA output created by 812
+Create the original files
+db163becd4078f300d75178b5da99c57 TEST_DIR/test-812/file1
+db163becd4078f300d75178b5da99c57 TEST_DIR/test-812/file2
+db163becd4078f300d75178b5da99c57 TEST_DIR/test-812/file3
+db163becd4078f300d75178b5da99c57 TEST_DIR/test-812/file4
+fcollapse files
+Checksum all files
+db163becd4078f300d75178b5da99c57 TEST_DIR/test-812/file1
+60362ff0a5d013a9ea90e999bff61ff7 TEST_DIR/test-812/file2
+2eb5c9479bda10ed1e7366ac0946d1b7 TEST_DIR/test-812/file3
+9f0d31cd374f021314919f30e7784ca2 TEST_DIR/test-812/file4
+Check file2 block 0:
+Check file2 block 1:
+Check file2 block 2: num #1 does not match #0 (intentional)
+Check file3 block 0:
+Check file3 block 1:
+Check file3 block 2: num #1 does not match #0 (intentional)
+Check file4 block 0:
+Check file4 block 1:
+Check file4 block 2: num #1 does not match #0 (intentional)
diff --git a/tests/generic/813 b/tests/generic/813
new file mode 100755
index 0000000..fb679fc
--- /dev/null
+++ b/tests/generic/813
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 813
+#
+# Ensure that punch-hole steps around reflinked ranges:
+# - Create three reflink clones of a file
+# - Punch the start, middle, and end of the reflink range of each
+# of the three files, respectively
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file4
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "fpunch files"
+$XFS_IO_PROG -f -c "fpunch 0 $BLKSZ" $TESTDIR/file2
+$XFS_IO_PROG -f -c "fpunch $BLKSZ $BLKSZ" $TESTDIR/file3
+$XFS_IO_PROG -f -c "fpunch $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file4
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+checker() {
+ echo '---'
+ for nr in `seq 0 $2`; do
+ echo "Check $1 block $nr: $(_numbers_equal $(_extent_physical $TESTDIR/$1 $((nr * BLKSZ)) $BLKSZ) $(_extent_physical $TESTDIR/file1 $((nr * BLKSZ)) $BLKSZ))"
+ done
+}
+checker file2 2
+checker file3 2
+checker file4 2
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/813.out b/tests/generic/813.out
new file mode 100644
index 0000000..238ab2a
--- /dev/null
+++ b/tests/generic/813.out
@@ -0,0 +1,24 @@
+QA output created by 813
+Create the original files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-813/file1
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-813/file2
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-813/file3
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-813/file4
+fpunch files
+Checksum all files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-813/file1
+7d0093769a56b002ee10d87d2c250af0 TEST_DIR/test-813/file2
+0345e4da280cd6b84d2ccfd0b217ed5f TEST_DIR/test-813/file3
+9f0d31cd374f021314919f30e7784ca2 TEST_DIR/test-813/file4
+---
+Check file2 block 0: num #1 does not match #0
+Check file2 block 1:
+Check file2 block 2:
+---
+Check file3 block 0:
+Check file3 block 1: num #1 does not match #0
+Check file3 block 2:
+---
+Check file4 block 0:
+Check file4 block 1:
+Check file4 block 2: num #1 does not match #0
diff --git a/tests/generic/814 b/tests/generic/814
new file mode 100755
index 0000000..67ab61f
--- /dev/null
+++ b/tests/generic/814
@@ -0,0 +1,109 @@
+#! /bin/bash
+# FS QA Test No. 814
+#
+# Ensure that insert range steps around reflinked ranges:
+# - Create three reflink clones of a file
+# - Insert into the start, middle, and end of the reflink range of each
+# of the three files, respectively
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "finsert"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file4
+#$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file1
+#$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file2
+#$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file3
+#$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * 4))" $TESTDIR/file4
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "finsert files"
+$XFS_IO_PROG -f -c "finsert 0 $BLKSZ" $TESTDIR/file2
+$XFS_IO_PROG -f -c "finsert $BLKSZ $BLKSZ" $TESTDIR/file3
+$XFS_IO_PROG -f -c "finsert $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file4
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "Check file2 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file2 0) -1)"
+echo "Check file2 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file2 $((BLKSZ * 1))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 0))))"
+echo "Check file2 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file2 $((BLKSZ * 2))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 1))))"
+echo "Check file2 block 3: $(_numbers_equal $(_extent_physical $TESTDIR/file2 $((BLKSZ * 3))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 2))))"
+
+echo "Check file3 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file3 0) $(_extent_physical $TESTDIR/file1 0))"
+echo "Check file3 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file3 $((BLKSZ * 1))) -1)"
+echo "Check file3 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file3 $((BLKSZ * 2))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 1))))"
+echo "Check file3 block 3: $(_numbers_equal $(_extent_physical $TESTDIR/file3 $((BLKSZ * 3))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 2))))"
+
+echo "Check file4 block 0: $(_numbers_equal $(_extent_physical $TESTDIR/file4 0) $(_extent_physical $TESTDIR/file1 0))"
+echo "Check file4 block 1: $(_numbers_equal $(_extent_physical $TESTDIR/file4 $((BLKSZ * 1))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 1))))"
+echo "Check file4 block 2: $(_numbers_equal $(_extent_physical $TESTDIR/file4 $((BLKSZ * 2))) -1)"
+echo "Check file4 block 3: $(_numbers_equal $(_extent_physical $TESTDIR/file4 $((BLKSZ * 3))) $(_extent_physical $TESTDIR/file1 $((BLKSZ * 2))))"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/814.out b/tests/generic/814.out
new file mode 100644
index 0000000..cfa3653
--- /dev/null
+++ b/tests/generic/814.out
@@ -0,0 +1,24 @@
+QA output created by 814
+Create the original files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-814/file1
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-814/file2
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-814/file3
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-814/file4
+finsert files
+Checksum all files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-814/file1
+f00836e4dd293d4fba1d25d06db3311b TEST_DIR/test-814/file2
+889c4ac987df12e434e5c561897d6b27 TEST_DIR/test-814/file3
+5a0067da56ad62f4c7c7b29436cc3183 TEST_DIR/test-814/file4
+Check file2 block 0:
+Check file2 block 1:
+Check file2 block 2:
+Check file2 block 3:
+Check file3 block 0:
+Check file3 block 1:
+Check file3 block 2:
+Check file3 block 3:
+Check file4 block 0:
+Check file4 block 1:
+Check file4 block 2:
+Check file4 block 3:
diff --git a/tests/generic/815 b/tests/generic/815
new file mode 100755
index 0000000..bf11f01
--- /dev/null
+++ b/tests/generic/815
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 815
+#
+# Ensure that truncating the last block in a reflinked file CoWs appropriately:
+# - Create a file that doesn't end on a block boundary
+# - Create two reflink clones of the file
+# - Shorten one of the clones with truncate
+# - Lengthen the other clone with truncate
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "truncate"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ 37" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+echo "truncate files"
+$XFS_IO_PROG -f -c "truncate $BLKSZ" $TESTDIR/file2
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * 2))" $TESTDIR/file3
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+
+checker() {
+ echo '---'
+ for nr in `seq 0 $2`; do
+ echo "Check $1 block $nr: $(_numbers_equal $(_extent_physical $TESTDIR/$1 $((nr * BLKSZ)) $BLKSZ) $(_extent_physical $TESTDIR/file1 $((nr * BLKSZ)) $BLKSZ))"
+ done
+}
+checker file2 1
+checker file3 1
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/815.out b/tests/generic/815.out
new file mode 100644
index 0000000..34ed6f8
--- /dev/null
+++ b/tests/generic/815.out
@@ -0,0 +1,16 @@
+QA output created by 815
+Create the original files
+9f2cbc628fdc2717059307aba4839b74 TEST_DIR/test-815/file1
+9f2cbc628fdc2717059307aba4839b74 TEST_DIR/test-815/file2
+9f2cbc628fdc2717059307aba4839b74 TEST_DIR/test-815/file3
+truncate files
+Checksum all files
+9f2cbc628fdc2717059307aba4839b74 TEST_DIR/test-815/file1
+21a199c53f422a380e20b162fb6ebe9c TEST_DIR/test-815/file2
+c9eb942a9b1b30bc2ee6a4904514ab98 TEST_DIR/test-815/file3
+---
+Check file2 block 0:
+Check file2 block 1:
+---
+Check file3 block 0:
+Check file3 block 1: num #1 does not match #0
diff --git a/tests/generic/816 b/tests/generic/816
new file mode 100755
index 0000000..19593f4
--- /dev/null
+++ b/tests/generic/816
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 816
+#
+# Ensure that zero-range steps around reflinked ranges:
+# - Create three reflink clones of a file
+# - Zero-range the start, middle, and end of the reflink range of each
+# of the three files, respectively
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fzero"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 $BLKSZ $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file4
+
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+echo "fzero files"
+$XFS_IO_PROG -f -c "fzero 0 $BLKSZ" $TESTDIR/file2
+$XFS_IO_PROG -f -c "fzero $BLKSZ $BLKSZ" $TESTDIR/file3
+$XFS_IO_PROG -f -c "fzero $((BLKSZ * 2)) $BLKSZ" $TESTDIR/file4
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
+echo "Checksum all files"
+md5sum $TESTDIR/file1 | _filter_test_dir
+md5sum $TESTDIR/file2 | _filter_test_dir
+md5sum $TESTDIR/file3 | _filter_test_dir
+md5sum $TESTDIR/file4 | _filter_test_dir
+
+checker() {
+ echo '---'
+ for nr in `seq 0 $2`; do
+ echo "Check $1 block $nr: $(_numbers_equal $(_extent_physical $TESTDIR/$1 $((nr * BLKSZ)) $BLKSZ) $(_extent_physical $TESTDIR/file1 $((nr * BLKSZ)) $BLKSZ))"
+ done
+}
+checker file2 2
+checker file3 2
+checker file4 2
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/816.out b/tests/generic/816.out
new file mode 100644
index 0000000..b884984
--- /dev/null
+++ b/tests/generic/816.out
@@ -0,0 +1,24 @@
+QA output created by 816
+Create the original files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-816/file1
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-816/file2
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-816/file3
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-816/file4
+fzero files
+Checksum all files
+31f6ac4e2c450aca17a337b2cda026fb TEST_DIR/test-816/file1
+7d0093769a56b002ee10d87d2c250af0 TEST_DIR/test-816/file2
+0345e4da280cd6b84d2ccfd0b217ed5f TEST_DIR/test-816/file3
+9f0d31cd374f021314919f30e7784ca2 TEST_DIR/test-816/file4
+---
+Check file2 block 0: num #1 does not match #0
+Check file2 block 1:
+Check file2 block 2:
+---
+Check file3 block 0:
+Check file3 block 1: num #1 does not match #0
+Check file3 block 2:
+---
+Check file4 block 0:
+Check file4 block 1:
+Check file4 block 2: num #1 does not match #0
diff --git a/tests/generic/group b/tests/generic/group
index 9af1ef8..4493ade 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -205,6 +205,12 @@
808 auto quick clone
809 auto quick clone
810 auto quick clone
+811 auto quick clone
+812 auto quick clone
+813 auto quick clone
+814 auto quick clone
+815 auto quick clone
+816 auto quick clone
817 auto quick clone
818 auto quick clone
819 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/11] reflink concurrent operations tests
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (5 preceding siblings ...)
2015-06-30 4:16 ` [PATCH 06/11] reflink fallocate tests Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 08/11] test reflink for accuracy in free block counts Darrick J. Wong
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Make sure that running reflink ops while other IO is ongoing doesn't
break the filesystem.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/821 | 95 ++++++++++++++++++++++++++++++++++++++++++++
tests/generic/821.out | 6 +++
tests/generic/822 | 95 ++++++++++++++++++++++++++++++++++++++++++++
tests/generic/822.out | 6 +++
tests/generic/823 | 93 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/823.out | 6 +++
tests/generic/824 | 94 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/824.out | 6 +++
tests/generic/825 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/825.out | 7 +++
tests/generic/826 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/826.out | 7 +++
tests/generic/827 | 97 ++++++++++++++++++++++++++++++++++++++++++++
tests/generic/827.out | 7 +++
tests/generic/828 | 97 ++++++++++++++++++++++++++++++++++++++++++++
tests/generic/828.out | 7 +++
tests/generic/829 | 83 ++++++++++++++++++++++++++++++++++++++
tests/generic/829.out | 6 +++
tests/generic/group | 9 ++++
19 files changed, 935 insertions(+)
create mode 100755 tests/generic/821
create mode 100644 tests/generic/821.out
create mode 100755 tests/generic/822
create mode 100644 tests/generic/822.out
create mode 100755 tests/generic/823
create mode 100644 tests/generic/823.out
create mode 100755 tests/generic/824
create mode 100644 tests/generic/824.out
create mode 100755 tests/generic/825
create mode 100644 tests/generic/825.out
create mode 100755 tests/generic/826
create mode 100644 tests/generic/826.out
create mode 100755 tests/generic/827
create mode 100644 tests/generic/827.out
create mode 100755 tests/generic/828
create mode 100644 tests/generic/828.out
create mode 100755 tests/generic/829
create mode 100644 tests/generic/829.out
diff --git a/tests/generic/821 b/tests/generic/821
new file mode 100755
index 0000000..b2d4bd9
--- /dev/null
+++ b/tests/generic/821
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 821
+#
+# Test for race between direct I/O and reflink
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+
+# Direct I/O overwriter...
+overwrite() {
+ while [ ! -e $TESTDIR/finished ]; do
+ dd if=/dev/zero of=$TESTDIR/file2 oflag=direct bs=$iosize count=$loops conv=notrunc 2> /dev/null
+ done
+}
+
+echo "Reflink and dio write the target"
+overwrite &
+start=`expr $loops - 1`
+for i in `seq $start -1 0`
+do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file2 >> $seqres.full
+ [ $? -ne 0 ] && exit
+done
+touch $TESTDIR/finished
+wait
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/821.out b/tests/generic/821.out
new file mode 100644
index 0000000..ca6bc53
--- /dev/null
+++ b/tests/generic/821.out
@@ -0,0 +1,6 @@
+QA output created by 821
+Format and mount
+Initialize files
+Reflink and dio write the target
+Check for damage
+Done
diff --git a/tests/generic/822 b/tests/generic/822
new file mode 100755
index 0000000..cf2f914
--- /dev/null
+++ b/tests/generic/822
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 822
+#
+# Test for race between buffered I/O and reflink
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize file"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+
+# Buffered I/O overwriter...
+overwrite() {
+ while [ ! -e $TESTDIR/finished ]; do
+ dd if=/dev/zero of=$TESTDIR/file2 bs=$iosize count=$loops conv=notrunc 2> /dev/null
+ done
+}
+
+echo "reflink while overwriting target"
+overwrite &
+start=`expr $loops - 1`
+for i in `seq $start -1 0`
+do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file2 >> $seqres.full
+ [ $? -ne 0 ] && exit
+done
+touch $TESTDIR/finished
+wait
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/822.out b/tests/generic/822.out
new file mode 100644
index 0000000..4c86f97
--- /dev/null
+++ b/tests/generic/822.out
@@ -0,0 +1,6 @@
+QA output created by 822
+Format and mount
+Initialize file
+reflink while overwriting target
+Check for damage
+Done
diff --git a/tests/generic/823 b/tests/generic/823
new file mode 100755
index 0000000..8b3b560
--- /dev/null
+++ b/tests/generic/823
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 823
+#
+# Test for race between buffered I/O while creating reflink snapshots
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize file"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+
+# Snapshot creator...
+snappy() {
+ n=0
+ while [ ! -e $TESTDIR/finished ]; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/snap_$n || break
+ n=$((n + 1))
+ done
+}
+
+echo "Snapshot a file undergoing buffered rewrite"
+snappy &
+for i in `seq 1 5`; do
+ dd if=/dev/zero of=$TESTDIR/file1 bs=$iosize count=$loops conv=notrunc 2> /dev/null
+done
+touch $TESTDIR/finished
+wait
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/823.out b/tests/generic/823.out
new file mode 100644
index 0000000..ef3e209
--- /dev/null
+++ b/tests/generic/823.out
@@ -0,0 +1,6 @@
+QA output created by 823
+Format and mount
+Initialize file
+Snapshot a file undergoing buffered rewrite
+Check for damage
+Done
diff --git a/tests/generic/824 b/tests/generic/824
new file mode 100755
index 0000000..4c64123
--- /dev/null
+++ b/tests/generic/824
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 824
+#
+# Test for race between direct I/O while creating reflink snapshots
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize file"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+
+# Snapshot creator...
+snappy() {
+ n=0
+ while [ ! -e $TESTDIR/finished ]; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/snap_$n || break
+ n=$((n + 1))
+ done
+}
+
+echo "Snapshot a file while directio rewriting it"
+snappy &
+touch $TESTDIR/running
+for i in `seq 1 5`; do
+ dd if=/dev/zero of=$TESTDIR/file1 oflag=direct bs=$iosize count=$loops conv=notrunc 2> /dev/null
+done
+mv $TESTDIR/running $TESTDIR/finished
+wait
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/824.out b/tests/generic/824.out
new file mode 100644
index 0000000..27c9bc0
--- /dev/null
+++ b/tests/generic/824.out
@@ -0,0 +1,6 @@
+QA output created by 824
+Format and mount
+Initialize file
+Snapshot a file while directio rewriting it
+Check for damage
+Done
diff --git a/tests/generic/825 b/tests/generic/825
new file mode 100755
index 0000000..f1089cf
--- /dev/null
+++ b/tests/generic/825
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 825
+#
+# Test for race between reflink and direct I/O reading the target file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+sync
+
+reader() {
+ while [ ! -e $TESTDIR/finished ]; do
+ dd if=$TESTDIR/file3 iflag=direct 2> /dev/null | od -tx1 -Ax | while read addr rest; do
+ test -n "$rest" && echo "$rest"
+ done | egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)'
+ done
+}
+
+echo "Reflink and dio reread the files!"
+reader &
+for i in `seq 1 2`; do
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file3 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file2 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file3 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+done
+echo "Finished reflinking"
+touch $TESTDIR/finished
+wait
+
+echo "Check fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+# success, all done
+status=0
+exit
diff --git a/tests/generic/825.out b/tests/generic/825.out
new file mode 100644
index 0000000..1e2f36c
--- /dev/null
+++ b/tests/generic/825.out
@@ -0,0 +1,7 @@
+QA output created by 825
+Format and mount
+Initialize files
+Reflink and dio reread the files!
+Finished reflinking
+Check fs
+Done
diff --git a/tests/generic/826 b/tests/generic/826
new file mode 100755
index 0000000..49d75cc
--- /dev/null
+++ b/tests/generic/826
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 826
+#
+# Test for race between reflink and buffered I/O reading the target file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file3
+sync
+
+reader() {
+ while [ ! -e $TESTDIR/finished ]; do
+ cat $TESTDIR/file3 | od -tx1 -Ax | while read addr rest; do
+ test -n "$rest" && echo "$rest"
+ done | egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)'
+ done
+}
+
+echo "Reflink and reread the files!"
+reader &
+for i in `seq 1 2`; do
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file3 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file2 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file3 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+done
+echo "Finished reflinking"
+touch $TESTDIR/finished
+wait
+
+echo "Check fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+# success, all done
+status=0
+exit
diff --git a/tests/generic/826.out b/tests/generic/826.out
new file mode 100644
index 0000000..144f4bc
--- /dev/null
+++ b/tests/generic/826.out
@@ -0,0 +1,7 @@
+QA output created by 826
+Format and mount
+Initialize files
+Reflink and reread the files!
+Finished reflinking
+Check fs
+Done
diff --git a/tests/generic/827 b/tests/generic/827
new file mode 100755
index 0000000..a54410c
--- /dev/null
+++ b/tests/generic/827
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 827
+#
+# Test for race between dedupe and writing the source file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+sync
+
+overwrite() {
+ while [ ! -e $TESTDIR/finished ]; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+ done
+}
+
+echo "Dedupe and rewrite the file!"
+overwrite &
+for i in `seq 1 2`; do
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file2 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+done
+echo "Finished dedupeing"
+touch $TESTDIR/finished
+wait
+
+echo "Check fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+# success, all done
+status=0
+exit
diff --git a/tests/generic/827.out b/tests/generic/827.out
new file mode 100644
index 0000000..1b05f59
--- /dev/null
+++ b/tests/generic/827.out
@@ -0,0 +1,7 @@
+QA output created by 827
+Format and mount
+Initialize files
+Dedupe and rewrite the file!
+Finished dedupeing
+Check fs
+Done
diff --git a/tests/generic/828 b/tests/generic/828
new file mode 100755
index 0000000..1e6dac2
--- /dev/null
+++ b/tests/generic/828
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 828
+#
+# Test for race between dedupe and writing the dest file
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=512
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+sync
+
+overwrite() {
+ while [ ! -e $TESTDIR/finished ]; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file2 >> $seqres.full
+ done
+}
+
+echo "Dedupe and rewrite the file!"
+overwrite &
+for i in `seq 1 2`; do
+ start=`expr $loops - 1`
+ for i in `seq $start -1 0`
+ do
+ $XFS_IO_PROG -f -c "dedupe $TESTDIR/file1 $((i * iosize)) $((i * iosize)) $iosize" $TESTDIR/file2 >> $seqres.full
+ [ $? -ne 0 ] && break
+ done
+done
+echo "Finished dedupeing"
+touch $TESTDIR/finished
+wait
+
+echo "Check fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+# success, all done
+status=0
+exit
diff --git a/tests/generic/828.out b/tests/generic/828.out
new file mode 100644
index 0000000..fb31777
--- /dev/null
+++ b/tests/generic/828.out
@@ -0,0 +1,7 @@
+QA output created by 828
+Format and mount
+Initialize files
+Dedupe and rewrite the file!
+Finished dedupeing
+Check fs
+Done
diff --git a/tests/generic/829 b/tests/generic/829
new file mode 100755
index 0000000..6c081b5
--- /dev/null
+++ b/tests/generic/829
@@ -0,0 +1,83 @@
+#! /bin/bash
+# FS QA Test No. 829
+#
+# Test for race between delete a file while rewriting its reflinked twin
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle, 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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+ wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "reflink"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+loops=4096
+iosize=65536
+
+echo "Initialize files"
+echo > $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+cp --reflink=always $TESTDIR/file1 $TESTDIR/file2
+sync
+
+echo "Delete while rewriting"
+rm -rf $TESTDIR/file1 &
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((loops * iosize))" $TESTDIR/file1 >> $seqres.full
+wait
+
+echo "Check fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Done"
+# success, all done
+status=0
+exit
diff --git a/tests/generic/829.out b/tests/generic/829.out
new file mode 100644
index 0000000..9cee8ba
--- /dev/null
+++ b/tests/generic/829.out
@@ -0,0 +1,6 @@
+QA output created by 829
+Format and mount
+Initialize files
+Delete while rewriting
+Check fs
+Done
diff --git a/tests/generic/group b/tests/generic/group
index 4493ade..a599fb2 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -215,5 +215,14 @@
818 auto quick clone
819 auto quick clone
820 auto quick clone
+821 auto quick clone
+822 auto quick clone
+823 auto quick clone
+824 auto quick clone
+825 auto quick clone
+826 auto quick clone
+827 auto quick clone
+828 auto quick clone
+829 auto quick clone
837 auto quick clone
838 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/11] test reflink for accuracy in free block counts
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (6 preceding siblings ...)
2015-06-30 4:16 ` [PATCH 07/11] reflink concurrent operations tests Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 09/11] test error conditions on reflink Darrick J. Wong
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Check that the free block counts seem to be handled correctly in
the reflink operation and subsequent attempts to rewrite reflinked
copies.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/830 | 88 +++++++++++++++++++++++++
tests/generic/830.out | 5 +
tests/generic/831 | 120 ++++++++++++++++++++++++++++++++++
tests/generic/831.out | 11 +++
tests/generic/832 | 143 +++++++++++++++++++++++++++++++++++++++++
tests/generic/832.out | 11 +++
tests/generic/833 | 142 ++++++++++++++++++++++++++++++++++++++++
tests/generic/833.out | 11 +++
tests/generic/834 | 160 ++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/834.out | 16 +++++
tests/generic/835 | 164 +++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/835.out | 16 +++++
tests/generic/836 | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/836.out | 36 ++++++++++
tests/generic/group | 7 ++
15 files changed, 1102 insertions(+)
create mode 100755 tests/generic/830
create mode 100644 tests/generic/830.out
create mode 100755 tests/generic/831
create mode 100644 tests/generic/831.out
create mode 100755 tests/generic/832
create mode 100644 tests/generic/832.out
create mode 100755 tests/generic/833
create mode 100644 tests/generic/833.out
create mode 100755 tests/generic/834
create mode 100644 tests/generic/834.out
create mode 100755 tests/generic/835
create mode 100644 tests/generic/835.out
create mode 100755 tests/generic/836
create mode 100644 tests/generic/836.out
diff --git a/tests/generic/830 b/tests/generic/830
new file mode 100755
index 0000000..4862603
--- /dev/null
+++ b/tests/generic/830
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 830
+#
+# Ensure that reflinking a file N times doesn't eat a lot of blocks
+# - Create a file and record fs block usage
+# - Create some reflink copies
+# - Compare fs block usage to before
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+NR=7
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Compare free block count"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -gt $MARGIN ]; then
+ echo "Free blocks decreased by more than $((-DIFF))."
+elif [ $DIFF -lt 0 ]; then
+ echo "Free blocks increased by $((-DIFF))?"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/830.out b/tests/generic/830.out
new file mode 100644
index 0000000..e2802dd
--- /dev/null
+++ b/tests/generic/830.out
@@ -0,0 +1,5 @@
+QA output created by 830
+Create the original file blocks
+Create the reflink copies
+Compare free block count
+Looks ok
diff --git a/tests/generic/831 b/tests/generic/831
new file mode 100755
index 0000000..4947261
--- /dev/null
+++ b/tests/generic/831
@@ -0,0 +1,120 @@
+#! /bin/bash
+# FS QA Test No. 831
+#
+# Ensure that deleting all copies of a file reflinked N times releases the blocks
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - Delete some copies of the file
+# - Record fs block usage (2)
+# - Delete all copies of the file
+# - Compare fs block usage to (2), (1), and (0)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=7
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+cp --reflink=always $TESTDIR/file1 $TESTDIR/survivor
+sync
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Delete most of the files"
+rm -rf $TESTDIR/file*
+sync
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+
+echo "Delete all the files"
+rm -rf $TESTDIR/*
+sync
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we not get anything back when we didn't delete everything?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we get all the blocks back when we deleted everything?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS3))
+if [ $DIFF -gt $MARGIN ]; then
+ echo "Free blocks decreased by more than $((-DIFF))."
+elif [ $DIFF -lt 0 ]; then
+ echo "Free blocks increased by $((-DIFF))?"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/831.out b/tests/generic/831.out
new file mode 100644
index 0000000..6f48729
--- /dev/null
+++ b/tests/generic/831.out
@@ -0,0 +1,11 @@
+QA output created by 831
+Create the original file blocks
+Create the reflink copies
+Delete most of the files
+Delete all the files
+Did we eat a ton of blocks?
+Looks ok
+Did we not get anything back when we didn't delete everything?
+Looks ok
+Did we get all the blocks back when we deleted everything?
+Looks ok
diff --git a/tests/generic/832 b/tests/generic/832
new file mode 100755
index 0000000..df116c6
--- /dev/null
+++ b/tests/generic/832
@@ -0,0 +1,143 @@
+#! /bin/bash
+# FS QA Test No. 832
+#
+# Ensure that punching all copies of a file reflinked N times releases the blocks
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - Punch some blocks of the copies
+# - Record fs block usage (2)
+# - Punch all blocks of the copies
+# - Compare fs block usage to (2), (1), and (0)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Punch most of the blocks"
+$XFS_IO_PROG -f -c "fpunch 0 $((BLKS * BLKSZ))" $TESTDIR/file.2
+$XFS_IO_PROG -f -c "fpunch 0 $((BLKS / 2 * BLKSZ))" $TESTDIR/file.3
+$XFS_IO_PROG -f -c "fpunch $((BLKS / 2 * BLKSZ)) $((BLKS / 2 * BLKSZ))" $TESTDIR/file.4
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ && echo "Sections should not match"
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+
+echo "Punch all the files"
+for i in `seq 2 $NR`; do
+ $XFS_IO_PROG -f -c "fpunch 0 $((BLKS * BLKSZ))" $TESTDIR/file.$i
+done
+$XFS_IO_PROG -f -c "fpunch 0 $((BLKS * BLKSZ))" $TESTDIR/file1
+sync
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we not get anything back when we didn't punch everything?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we get all the blocks back when we punch everything?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS3))
+if [ $DIFF -gt $MARGIN ]; then
+ echo "Free blocks decreased by more than $((-DIFF))."
+elif [ $DIFF -lt 0 ]; then
+ echo "Free blocks increased by $((-DIFF))?"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/832.out b/tests/generic/832.out
new file mode 100644
index 0000000..d0c1d82
--- /dev/null
+++ b/tests/generic/832.out
@@ -0,0 +1,11 @@
+QA output created by 832
+Create the original file blocks
+Create the reflink copies
+Punch most of the blocks
+Punch all the files
+Did we eat a ton of blocks?
+Looks ok
+Did we not get anything back when we didn't punch everything?
+Looks ok
+Did we get all the blocks back when we punch everything?
+Looks ok
diff --git a/tests/generic/833 b/tests/generic/833
new file mode 100755
index 0000000..e37bf41
--- /dev/null
+++ b/tests/generic/833
@@ -0,0 +1,142 @@
+#! /bin/bash
+# FS QA Test No. 833
+#
+# Ensure that collapse-range on all copies of a file reflinked N times releases the blocks
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - Collapse-range some blocks of the copies
+# - Record fs block usage (2)
+# - Truncate all blocks of the copies
+# - Compare fs block usage to (2), (1), and (0)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fcollapse"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Collapse most of the blocks"
+$XFS_IO_PROG -f -c "fcollapse 0 $(((BLKS - 1) * BLKSZ))" $TESTDIR/file.2
+$XFS_IO_PROG -f -c "fcollapse 0 $((BLKS / 2 * BLKSZ))" $TESTDIR/file.3
+$XFS_IO_PROG -f -c "fcollapse $((BLKS / 2 * BLKSZ)) $(( ((BLKS / 2) - 1) * BLKSZ))" $TESTDIR/file.4
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ && echo "Sections should not match"
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+
+echo "Collpase range nearly all the files"
+$XFS_IO_PROG -f -c "fcollapse 0 $(( ((BLKS / 2) - 1) * BLKSZ))" $TESTDIR/file.3
+$XFS_IO_PROG -f -c "fcollapse 0 $(( (BLKS / 2) * BLKSZ))" $TESTDIR/file.4
+$XFS_IO_PROG -f -c "fcollapse 0 $(( (BLKS - 1) * BLKSZ))" $TESTDIR/file1
+sync
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we not get anything back when we didn't collapse everything?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we get all the blocks back when we collapse everything?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS3))
+if [ $DIFF -gt $MARGIN ]; then
+ echo "Free blocks decreased by more than $((-DIFF))."
+elif [ $DIFF -lt 0 ]; then
+ echo "Free blocks increased by $((-DIFF))?"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/833.out b/tests/generic/833.out
new file mode 100644
index 0000000..5c72303
--- /dev/null
+++ b/tests/generic/833.out
@@ -0,0 +1,11 @@
+QA output created by 833
+Create the original file blocks
+Create the reflink copies
+Collapse most of the blocks
+Collpase range nearly all the files
+Did we eat a ton of blocks?
+Looks ok
+Did we not get anything back when we didn't collapse everything?
+Looks ok
+Did we get all the blocks back when we collapse everything?
+Looks ok
diff --git a/tests/generic/834 b/tests/generic/834
new file mode 100755
index 0000000..8e8fafd
--- /dev/null
+++ b/tests/generic/834
@@ -0,0 +1,160 @@
+#! /bin/bash
+# FS QA Test No. 834
+#
+# Ensure that CoW on all copies of a file reflinked N times increases block count
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - CoW some blocks of the copies
+# - Record fs block usage (2)
+# - CoW all the rest of the blocks of the copies
+# - Compare fs block usage to (2), (1), and (0)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite some of the blocks"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((BLKS * BLKSZ))" $TESTDIR/file.2 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((BLKS / 2 * BLKSZ))" $TESTDIR/file.3 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -S 0x64 $((BLKS / 2 * BLKSZ)) $((BLKS / 2 * BLKSZ))" $TESTDIR/file.4 > /dev/null
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ && echo "Sections should not match"
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite all the files"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((BLKS * BLKSZ))" $TESTDIR/file.2 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((BLKS * BLKSZ))" $TESTDIR/file.3 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -S 0x64 0 $((BLKS * BLKSZ))" $TESTDIR/file.4 > /dev/null
+sync
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite the original file"
+$XFS_IO_PROG -f -c "pwrite -S 0x65 0 $((BLKS * BLKSZ))" $TESTDIR/file1 > /dev/null
+sync
+FREE_BLOCKS4=$(stat -f $TESTDIR -c '%f')
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks we partially CoWd?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2 - (BLKS * 2) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks when we overwrote all the copies?"
+DIFF=$((FREE_BLOCKS2 - FREE_BLOCKS3 - BLKS ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did overwriting the original file consume no blocks?"
+DIFF=$((FREE_BLOCKS3 - FREE_BLOCKS4))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we use as many blocks overall as we figured on?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS4 - (4 * BLKS) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/834.out b/tests/generic/834.out
new file mode 100644
index 0000000..1758c71
--- /dev/null
+++ b/tests/generic/834.out
@@ -0,0 +1,16 @@
+QA output created by 834
+Create the original file blocks
+Create the reflink copies
+Rewrite some of the blocks
+Rewrite all the files
+Rewrite the original file
+Did we eat a ton of blocks?
+Looks ok
+Did we eat the same number of blocks we partially CoWd?
+Looks ok
+Did we eat the same number of blocks when we overwrote all the copies?
+Looks ok
+Did overwriting the original file consume no blocks?
+Looks ok
+Did we use as many blocks overall as we figured on?
+Looks ok
diff --git a/tests/generic/835 b/tests/generic/835
new file mode 100755
index 0000000..ce07c7d
--- /dev/null
+++ b/tests/generic/835
@@ -0,0 +1,164 @@
+#! /bin/bash
+# FS QA Test No. 835
+#
+# Ensure that CoW on all copies of a file reflinked N times increases block count
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - CoW some blocks of the copies
+# - Record fs block usage (2)
+# - CoW all the rest of the blocks of the copies
+# - Compare fs block usage to (2), (1), and (0)
+#
+# The main difference from 834 is that we use zero range, directio, and
+# mmap to mix things up a bit.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "fzero"
+_require_cp_reflink
+_require_test
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite some of the blocks"
+$XFS_IO_PROG -f -c "fzero 0 $((BLKS * BLKSZ))" $TESTDIR/file.2 > /dev/null
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 0 $((BLKS / 2 * BLKSZ))" $TESTDIR/file.3 > /dev/null
+$XFS_IO_PROG -f -c "mmap -rw 0 $((BLKS * BLKSZ))" -c "mwrite -S 0x64 $((BLKS / 2 * BLKSZ)) $((BLKS / 2 * BLKSZ))" $TESTDIR/file.4 > /dev/null
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ && echo "Sections should not match"
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite all the files"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x62 0 $((BLKS * BLKSZ))" $TESTDIR/file.2 > /dev/null
+$XFS_IO_PROG -f -c "mmap -rw 0 $((BLKS * BLKSZ))" -c "mwrite -S 0x63 0 $((BLKS * BLKSZ))" $TESTDIR/file.3 > /dev/null
+$XFS_IO_PROG -f -c "fzero 0 $((BLKS * BLKSZ))" $TESTDIR/file.4 > /dev/null
+sync
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+
+echo "Rewrite the original file"
+$XFS_IO_PROG -f -c "pwrite -S 0x65 0 $((BLKS * BLKSZ))" $TESTDIR/file1 > /dev/null
+sync
+FREE_BLOCKS4=$(stat -f $TESTDIR -c '%f')
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks we partially CoWd?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2 - (BLKS * 2) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks when we overwrote all the copies?"
+DIFF=$((FREE_BLOCKS2 - FREE_BLOCKS3 - BLKS ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did overwriting the original file consume no blocks?"
+DIFF=$((FREE_BLOCKS3 - FREE_BLOCKS4))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we use as many blocks overall as we figured on?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS4 - (4 * BLKS) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/835.out b/tests/generic/835.out
new file mode 100644
index 0000000..d280e67
--- /dev/null
+++ b/tests/generic/835.out
@@ -0,0 +1,16 @@
+QA output created by 835
+Create the original file blocks
+Create the reflink copies
+Rewrite some of the blocks
+Rewrite all the files
+Rewrite the original file
+Did we eat a ton of blocks?
+Looks ok
+Did we eat the same number of blocks we partially CoWd?
+Looks ok
+Did we eat the same number of blocks when we overwrote all the copies?
+Looks ok
+Did overwriting the original file consume no blocks?
+Looks ok
+Did we use as many blocks overall as we figured on?
+Looks ok
diff --git a/tests/generic/836 b/tests/generic/836
new file mode 100755
index 0000000..2c27f37
--- /dev/null
+++ b/tests/generic/836
@@ -0,0 +1,172 @@
+#! /bin/bash
+# FS QA Test No. 836
+#
+# Ensure that chattr +C on reflinked files actually CoWs the files and
+# removes the inode flag.
+# - Record fs block usage (0)
+# - Create a file and some reflink copies
+# - Record fs block usage (1)
+# - chattr +C the copies
+# - Compare fs block usage to (2), (1), and (0)
+# - Compare the extent lists of the copies
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+if [ $FSTYP = "btrfs" ]; then
+ _notrun "btrfs doesn't handle chattr +C on non-empty files"
+fi
+
+# real QA test starts here
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+_require_test
+_require_attrs
+
+rm -f $seqres.full
+
+TESTDIR=$TEST_DIR/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file blocks"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR/file1 >> $seqres.full
+sync
+
+echo "Create the reflink copies"
+for i in `seq 2 $NR`; do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file.$i
+done
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS1=$(stat -f $TESTDIR -c '%f')
+lsattr -l $TESTDIR/ | _filter_test_dir
+
+echo "chattr +C some of the copies"
+chattr +C $TESTDIR/file.2
+chattr +C $TESTDIR/file.3
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.2 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.3 | tail -n +2) \
+ && echo "Sections should not match"
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ || echo "Sections should match"
+FREE_BLOCKS2=$(stat -f $TESTDIR -c '%f')
+lsattr -l $TESTDIR/ | _filter_test_dir
+
+echo "chattr +C the rest of the files"
+chattr +C $TESTDIR/file.4
+chattr +C $TESTDIR/file1
+sync
+cmp -s <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c "fiemap -v" $TESTDIR/file.4 | tail -n +2) \
+ && echo "Sections should not match"
+FREE_BLOCKS3=$(stat -f $TESTDIR -c '%f')
+lsattr -l $TESTDIR/ | _filter_test_dir
+
+echo "Rewrite the original file"
+$XFS_IO_PROG -f -c "pwrite -S 0x65 0 $((BLKS * BLKSZ))" $TESTDIR/file1 > /dev/null
+sync
+FREE_BLOCKS4=$(stat -f $TESTDIR -c '%f')
+lsattr -l $TESTDIR/ | _filter_test_dir
+#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+
+echo "Did we eat a ton of blocks?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS1))
+if [ $DIFF -lt $BLKS ]; then
+ echo "Reflinking only ate $DIFF blocks, expected $BLKS"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks we partially CoWd?"
+DIFF=$((FREE_BLOCKS1 - FREE_BLOCKS2 - (BLKS * 2) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we eat the same number of blocks when we overwrote all the copies?"
+DIFF=$((FREE_BLOCKS2 - FREE_BLOCKS3 - BLKS ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did overwriting the original file consume no blocks?"
+DIFF=$((FREE_BLOCKS3 - FREE_BLOCKS4))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+
+echo "Did we use as many blocks overall as we figured on?"
+DIFF=$((FREE_BLOCKS0 - FREE_BLOCKS4 - (4 * BLKS) ))
+if [ $DIFF -gt $MARGIN ] || [ $DIFF -lt -$MARGIN ]; then
+ echo "Free blocks changed by $((-DIFF))"
+else
+ echo "Looks ok"
+fi
+lsattr -l $TESTDIR/ | _filter_test_dir
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/836.out b/tests/generic/836.out
new file mode 100644
index 0000000..eeeb498
--- /dev/null
+++ b/tests/generic/836.out
@@ -0,0 +1,36 @@
+QA output created by 836
+Create the original file blocks
+Create the reflink copies
+TEST_DIR/test-836/file1 ---
+TEST_DIR/test-836/file.2 ---
+TEST_DIR/test-836/file.3 ---
+TEST_DIR/test-836/file.4 ---
+chattr +C some of the copies
+TEST_DIR/test-836/file1 ---
+TEST_DIR/test-836/file.2 No_COW
+TEST_DIR/test-836/file.3 No_COW
+TEST_DIR/test-836/file.4 ---
+chattr +C the rest of the files
+TEST_DIR/test-836/file1 No_COW
+TEST_DIR/test-836/file.2 No_COW
+TEST_DIR/test-836/file.3 No_COW
+TEST_DIR/test-836/file.4 No_COW
+Rewrite the original file
+TEST_DIR/test-836/file1 No_COW
+TEST_DIR/test-836/file.2 No_COW
+TEST_DIR/test-836/file.3 No_COW
+TEST_DIR/test-836/file.4 No_COW
+Did we eat a ton of blocks?
+Looks ok
+Did we eat the same number of blocks we partially CoWd?
+Looks ok
+Did we eat the same number of blocks when we overwrote all the copies?
+Looks ok
+Did overwriting the original file consume no blocks?
+Looks ok
+Did we use as many blocks overall as we figured on?
+Looks ok
+TEST_DIR/test-836/file1 No_COW
+TEST_DIR/test-836/file.2 No_COW
+TEST_DIR/test-836/file.3 No_COW
+TEST_DIR/test-836/file.4 No_COW
diff --git a/tests/generic/group b/tests/generic/group
index a599fb2..c0a508d 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -224,5 +224,12 @@
827 auto quick clone
828 auto quick clone
829 auto quick clone
+830 auto quick clone
+831 auto quick clone
+832 auto quick clone
+833 auto quick clone
+834 auto quick clone
+835 auto quick clone
+836 auto quick clone
837 auto quick clone
838 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/11] test error conditions on reflink
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (7 preceding siblings ...)
2015-06-30 4:16 ` [PATCH 08/11] test reflink for accuracy in free block counts Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 10/11] test xfs-specific reflink pieces Darrick J. Wong
2015-06-30 4:16 ` [PATCH 11/11] reflink: test what happens when we hit resource limits Darrick J. Wong
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Check that we can feed bad inputs to reflink and it'll reject them.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/839 | 123 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/839.out | 30 ++++++++++++
tests/generic/group | 1
3 files changed, 154 insertions(+)
create mode 100755 tests/generic/839
create mode 100644 tests/generic/839.out
diff --git a/tests/generic/839 b/tests/generic/839
new file mode 100755
index 0000000..61532df
--- /dev/null
+++ b/tests/generic/839
@@ -0,0 +1,123 @@
+#! /bin/bash
+# FS QA Test No. 839
+#
+# Check that cross-device reflink and dedupe are rejected
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_require_test
+_require_scratch
+_require_scratch_reflink
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "dedupe"
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR1=$TEST_DIR/test-$seq
+rm -rf $TESTDIR1
+mkdir $TESTDIR1
+
+TESTDIR2=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR2
+mkdir $TESTDIR2
+
+echo "Create the original files"
+BLKSZ="$(stat -f $TESTDIR1 -c '%S')"
+BLKS=1000
+MARGIN=50
+SZ=$((BLKSZ * BLKS))
+FREE_BLOCKS0=$(stat -f $TESTDIR1 -c '%f')
+NR=4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR1/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR1/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $SZ" $TESTDIR2/file1 >> $seqres.full
+sync
+
+echo "Try cross-device reflink"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 0 0 $BLKSZ" $TESTDIR2/file1
+echo "Try cross-device dedupe"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR1/file1 0 0 $BLKSZ" $TESTDIR2/file1
+
+echo "Try unaligned reflink"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 37 59 23" $TESTDIR1/file2
+echo "Try unaligned dedupe"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR1/file1 37 59 23" $TESTDIR1/file2
+
+echo "Try overlapping reflink"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 0 0 $BLKSZ" $TESTDIR1/file1
+echo "Try overlapping dedupe"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR1/file2 0 0 $BLKSZ" $TESTDIR1/file2
+
+echo "Try reflink past EOF"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 $(( (BLKS + 1000) * BLKSZ)) 0 $BLKSZ" $TESTDIR1/file1
+echo "Try dedupe past EOF"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR1/file2 $(( (BLKS + 1000) * BLKSZ)) 0 $BLKSZ" $TESTDIR1/file2
+
+chattr +i $TESTDIR1/file1 $TESTDIR1/file2
+echo "Try reflink on immutable files"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 0 0 $BLKSZ" $TESTDIR1/file2 > $seqres.full
+echo "Try dedupe on immutable files"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 $BLKSZ $BLKSZ $BLKSZ" $TESTDIR1/file2 > $seqres.full
+chattr -i $TESTDIR1/file1 $TESTDIR1/file2
+
+echo "Reflink two files"
+$XFS_IO_PROG -f -c "reflink $TESTDIR1/file1 0 0 $BLKSZ" $TESTDIR1/file2 > $seqres.full
+$XFS_IO_PROG -f -c "reflink $TESTDIR2/file1 0 0 $BLKSZ" $TESTDIR2/file2 > $seqres.full
+echo "Dedupe two files"
+$XFS_IO_PROG -f -c "dedupe $TESTDIR1/file1 $BLKSZ $BLKSZ $BLKSZ" $TESTDIR1/file2 > $seqres.full
+$XFS_IO_PROG -f -c "dedupe $TESTDIR2/file1 $BLKSZ $BLKSZ $BLKSZ" $TESTDIR2/file2 > $seqres.full
+
+lsattr -l $TESTDIR1/ | _filter_test_dir
+lsattr -l $TESTDIR2/ | sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/839.out b/tests/generic/839.out
new file mode 100644
index 0000000..91a2425
--- /dev/null
+++ b/tests/generic/839.out
@@ -0,0 +1,30 @@
+QA output created by 839
+Format and mount
+Create the original files
+Try cross-device reflink
+reflink: Invalid cross-device link
+Try cross-device dedupe
+dedupe: Invalid cross-device link
+Try unaligned reflink
+reflink: Invalid argument
+Try unaligned dedupe
+dedupe: Invalid argument
+Try overlapping reflink
+reflink: Invalid argument
+Try overlapping dedupe
+dedupe: Invalid argument
+Try reflink past EOF
+reflink: Invalid argument
+Try dedupe past EOF
+dedupe: Invalid argument
+Try reflink on immutable files
+/mnt/test-839/file2: Permission denied
+Try dedupe on immutable files
+/mnt/test-839/file2: Permission denied
+Reflink two files
+Dedupe two files
+TEST_DIR/test-839/file1 ---
+TEST_DIR/test-839/file2 ---
+SCRATCH_MNT/test-839/file1 ---
+SCRATCH_MNT/test-839/file2 ---
+Check scratch fs
diff --git a/tests/generic/group b/tests/generic/group
index c0a508d..af22ccb 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -233,3 +233,4 @@
836 auto quick clone
837 auto quick clone
838 auto quick clone
+839 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/11] test xfs-specific reflink pieces
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (8 preceding siblings ...)
2015-06-30 4:16 ` [PATCH 09/11] test error conditions on reflink Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
2015-06-30 4:16 ` [PATCH 11/11] reflink: test what happens when we hit resource limits Darrick J. Wong
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Check that growfs and xfs_fsr still work properly on reflinked fses.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/xfs/800 | 77 ++++++++++++++++++++++++++++++++++++
tests/xfs/800.out | 5 ++
tests/xfs/801 | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/801.out | 15 +++++++
tests/xfs/group | 2 +
5 files changed, 213 insertions(+)
create mode 100755 tests/xfs/800
create mode 100644 tests/xfs/800.out
create mode 100755 tests/xfs/801
create mode 100644 tests/xfs/801.out
diff --git a/tests/xfs/800 b/tests/xfs/800
new file mode 100755
index 0000000..62b431a
--- /dev/null
+++ b/tests/xfs/800
@@ -0,0 +1,77 @@
+#! /bin/bash
+# FS QA Test No. 800
+#
+# Tests xfs_growfs on a reflinked filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_scratch_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file and reflink to copy1, copy2"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR/original \
+ >> $seqres.full 2>&1
+cp --reflink $TESTDIR/original $TESTDIR/copy1
+cp --reflink $TESTDIR/copy1 $TESTDIR/copy2
+
+echo "Grow fs"
+$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 | _filter_growfs >> $seqres.full
+
+xfs_info $SCRATCH_MNT >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/800.out b/tests/xfs/800.out
new file mode 100644
index 0000000..280daa5
--- /dev/null
+++ b/tests/xfs/800.out
@@ -0,0 +1,5 @@
+QA output created by 800
+Format and mount
+Create the original file and reflink to copy1, copy2
+Grow fs
+Check scratch fs
diff --git a/tests/xfs/801 b/tests/xfs/801
new file mode 100755
index 0000000..5a75e5f
--- /dev/null
+++ b/tests/xfs/801
@@ -0,0 +1,114 @@
+#! /bin/bash
+# FS QA Test No. 801
+#
+# Ensure that xfs_fsr un-reflinks files while defragmenting
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_scratch_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file and reflink to copy1, copy2"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 66000' $TESTDIR/original \
+ >> $seqres.full 2>&1
+cp --reflink $TESTDIR/original $TESTDIR/copy1
+cp --reflink $TESTDIR/copy1 $TESTDIR/copy2
+cp --reflink $TESTDIR/copy2 $TESTDIR/copy3
+
+echo "CoW the reflink copies"
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 4096' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 0 4096' $TESTDIR/copy2 >> $seqres.full
+sync
+
+echo "Defragment"
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 >> $seqres.full
+lsattr -l $TESTDIR/ | sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
+xfs_fsr -v -d $TESTDIR/original >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy1 >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy2 >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy3 >> $seqres.full
+
+echo "Check fiemap"
+lsattr -l $TESTDIR/ | sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+ || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+ && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+ && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+ && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+ && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+ <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+ && echo "Sections shouldn't match"
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/801.out b/tests/xfs/801.out
new file mode 100644
index 0000000..74e7757
--- /dev/null
+++ b/tests/xfs/801.out
@@ -0,0 +1,15 @@
+QA output created by 801
+Format and mount
+Create the original file and reflink to copy1, copy2
+CoW the reflink copies
+Defragment
+SCRATCH_MNT/test-801/original ---
+SCRATCH_MNT/test-801/copy1 ---
+SCRATCH_MNT/test-801/copy2 ---
+SCRATCH_MNT/test-801/copy3 ---
+Check fiemap
+SCRATCH_MNT/test-801/original ---
+SCRATCH_MNT/test-801/copy1 No_COW
+SCRATCH_MNT/test-801/copy2 No_COW
+SCRATCH_MNT/test-801/copy3 ---
+Check scratch fs
diff --git a/tests/xfs/group b/tests/xfs/group
index c12b90a..db0694e 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -193,3 +193,5 @@
304 auto quick quota
305 auto quota
700 fuzzers
+800 auto quick clone
+801 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 11/11] reflink: test what happens when we hit resource limits
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (9 preceding siblings ...)
2015-06-30 4:16 ` [PATCH 10/11] test xfs-specific reflink pieces Darrick J. Wong
@ 2015-06-30 4:16 ` Darrick J. Wong
10 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-06-30 4:16 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/840 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/840.out | 0
tests/generic/841 | 87 ++++++++++++++++++++++++++++++++++++++++
tests/generic/841.out | 5 ++
tests/generic/group | 2 +
5 files changed, 201 insertions(+)
create mode 100755 tests/generic/840
create mode 100644 tests/generic/840.out
create mode 100755 tests/generic/841
create mode 100644 tests/generic/841.out
diff --git a/tests/generic/840 b/tests/generic/840
new file mode 100755
index 0000000..498e3a2
--- /dev/null
+++ b/tests/generic/840
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 840
+#
+# Try to hit the maximum reference count (eek!)
+#
+# This test runs extremely slowly, so it's not automatically run anywhere.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_require_test
+_require_scratch
+_require_scratch_reflink
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+# Well let's hope the maximum reflink count is (less than (ha!)) 2^32...
+
+echo "Create a one block file"
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $BLKSZ" $TESTDIR/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $BLKSZ" $TESTDIR/file2 >> $seqres.full
+
+$XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 0 $BLKSZ" $TESTDIR/file2 >> $seqres.full
+
+nr=32
+fnr=18
+for i in $(seq 0 $fnr); do
+ echo " ++ Reflink size $i, $(( (2 ** i) * BLKSZ)) bytes" | tee -a $seqres.full
+ $XFS_IO_PROG -f -c "reflink $TESTDIR/file1 0 $(( (2 ** i) * BLKSZ)) $(( (2 ** i) * BLKSZ ))" $TESTDIR/file1 >> $seqres.full || break
+done
+
+nrf=$((nr - fnr))
+echo "Clone $((2 ** nrf)) files"
+for i in $(seq 0 $((2 ** nrf)) ); do
+ cp --reflink=always $TESTDIR/file1 $TESTDIR/file1-$i
+done
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+$XFS_DB_PROG -c 'agf 0' -c 'addr rlroot' -c p $SCRATCH_DEV
+_check_scratch_fs
+
+echo "Remove big file and recheck"
+_scratch_mount >> $seqres.full 2>&1
+#rm -rf $TESTDIR/file1
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+echo "Remove all files and recheck"
+_scratch_mount >> $seqres.full 2>&1
+#rm -rf $TESTDIR/file2
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/840.out b/tests/generic/840.out
new file mode 100644
index 0000000..e69de29
diff --git a/tests/generic/841 b/tests/generic/841
new file mode 100755
index 0000000..3bf025c
--- /dev/null
+++ b/tests/generic/841
@@ -0,0 +1,87 @@
+#! /bin/bash
+# FS QA Test No. 841
+#
+# Try to run out of space while cloning?
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, 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.* $TESTDIR1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_require_test
+_require_scratch
+_require_scratch_reflink
+_require_test_reflink
+_supported_os Linux
+
+_require_xfs_io_command "reflink"
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+BLKSZ="$(stat -f $TESTDIR -c '%S')"
+NR_FREE="$(stat -f -c '%f' $TESTDIR)"
+echo "Create a big file"
+touch $TESTDIR/file0 $TESTDIR/file1
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((BLKSZ * NR_FREE))" $TESTDIR/bigfile >> $seqres.full 2>&1
+sz="$(stat -c '%s' $TESTDIR/bigfile)"
+sync
+
+blks="$((sz / BLKSZ))"
+echo "Try to reflink"
+seq 0 $blks | while read lblk; do
+ fname="$TESTDIR/file$((lblk % 2))"
+ out="$($XFS_IO_PROG -f -c "reflink $TESTDIR/bigfile $((lblk * BLKSZ)) $((lblk * BLKSZ)) $BLKSZ" $fname 2>&1)"
+ echo "$out" >> $seqres.full
+ test "$out" = "reflink: No space left on device" && break
+done
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/841.out b/tests/generic/841.out
new file mode 100644
index 0000000..33c46fd
--- /dev/null
+++ b/tests/generic/841.out
@@ -0,0 +1,5 @@
+QA output created by 841
+Format and mount
+Create a big file
+Try to reflink
+Check scratch fs
diff --git a/tests/generic/group b/tests/generic/group
index af22ccb..b4cb2b7 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -234,3 +234,5 @@
837 auto quick clone
838 auto quick clone
839 auto quick clone
+840
+841 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-06-30 4:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 4:15 [RFC 00/11] xfstests: test the btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-06-30 4:15 ` [PATCH 01/11] fuzz XFS and ext4 filesystems Darrick J. Wong
2015-06-30 4:15 ` [PATCH 02/11] move btrfs reflink tests to generic Darrick J. Wong
2015-06-30 4:15 ` [PATCH 03/11] generic/32[6-8]: support xfs in addition to btrfs Darrick J. Wong
2015-06-30 4:15 ` [PATCH 04/11] basic tests of the reflink and dedupe ioctls Darrick J. Wong
2015-06-30 4:15 ` [PATCH 05/11] test CoW behaviors of reflinked files Darrick J. Wong
2015-06-30 4:16 ` [PATCH 06/11] reflink fallocate tests Darrick J. Wong
2015-06-30 4:16 ` [PATCH 07/11] reflink concurrent operations tests Darrick J. Wong
2015-06-30 4:16 ` [PATCH 08/11] test reflink for accuracy in free block counts Darrick J. Wong
2015-06-30 4:16 ` [PATCH 09/11] test error conditions on reflink Darrick J. Wong
2015-06-30 4:16 ` [PATCH 10/11] test xfs-specific reflink pieces Darrick J. Wong
2015-06-30 4:16 ` [PATCH 11/11] reflink: test what happens when we hit resource limits Darrick J. Wong
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).