* [PATCH 01/11] test-scripts: test migration scripts
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
@ 2015-12-19 9:10 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 02/11] tests: don't leave cruft behind on the TEST_MNT Darrick J. Wong
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:10 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Add two scripts: "nextid" finds the next available test ID number in a
group, and "mvtest" relocates a test, fixes the golden output, and
moves the group entry for that test.
v2: sorting group files should preserve group order; nextid should use
the same algorithm as new; move both tools to tools/.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tools/mvtest | 55 +++++++++++++++++++++++++++
tools/nextid | 1
tools/sort-group | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 168 insertions(+)
create mode 100755 tools/mvtest
create mode 120000 tools/nextid
create mode 100755 tools/sort-group
diff --git a/tools/mvtest b/tools/mvtest
new file mode 100755
index 0000000..af601d6
--- /dev/null
+++ b/tools/mvtest
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Renumber a test
+dir="$(dirname "$0")"
+
+if [ -z "$1" ] || [ "$1" = "--help" ]; then
+ echo "Usage: $0 path_to_test new_path_to_test"
+ exit 1
+fi
+
+src="$1"
+dest="$2"
+
+die() {
+ echo "$@"
+ exit 1
+}
+
+append() {
+ out="$1"
+ shift
+ echo "$@" >> "${out}"
+}
+
+test "${src}" != "${dest}" || die "Test \"${src}\" is the same as dest."
+test -e "tests/${src}" || die "Test \"${src}\" does not exist."
+test ! -e "tests/${dest}" || die "Test \"${src}\" already exists."
+
+sid="$(basename "${src}")"
+did="$(basename "${dest}")"
+
+sgroup="$(basename "$(dirname "tests/${src}")")"
+dgroup="$(basename "$(dirname "tests/${dest}")")"
+
+sgroupfile="tests/${sgroup}/group"
+dgroupfile="tests/${sgroup}/group"
+
+git mv "tests/${src}" "tests/${dest}"
+git mv "tests/${src}.out" "tests/${dest}.out"
+sed -e "s/^# FS QA Test No. ${sid}$/# FS QA Test No. ${did}/g" -i "tests/${dest}"
+sed -e "s/^QA output created by ${sid}$/QA output created by ${did}/g" -i "tests/${dest}.out"
+sed -e "s/test-${sid}/test-${did}/g" -i "tests/${dest}.out"
+
+grpline="$(grep "^${sid} " "${sgroupfile}")"
+newgrpline="$(echo "${grpline}" | sed -e "s/^${sid} /${did} /g")"
+
+sed -e "/^${sid}.*$/d" -i "${sgroupfile}"
+cp "${dgroupfile}" "${dgroupfile}.new"
+append "${dgroupfile}.new" "${newgrpline}"
+"${dir}/sort-group.py" "${dgroupfile}.new"
+mv "${dgroupfile}.new" "${dgroupfile}"
+
+echo "Moved \"${src}\" to \"${dest}\"."
+
+exit 0
diff --git a/tools/nextid b/tools/nextid
new file mode 120000
index 0000000..5c31d60
--- /dev/null
+++ b/tools/nextid
@@ -0,0 +1 @@
+sort-group
\ No newline at end of file
diff --git a/tools/sort-group b/tools/sort-group
new file mode 100755
index 0000000..84944ed
--- /dev/null
+++ b/tools/sort-group
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+import sys
+
+# Sort a group list, carefully preserving comments.
+
+def xfstest_key(key):
+ '''Extract the numeric part of a test name if possible.'''
+ k = 0
+
+ assert type(key) == str
+
+ # No test number at all...
+ if not key[0].isdigit():
+ return key
+
+ # ...otherwise extract as much number as we can.
+ for digit in key:
+ if digit.isdigit():
+ k = k * 10 + int(digit)
+ else:
+ return k
+ return k
+
+def read_group(fd):
+ '''Read the group list, carefully attaching comments to the next test.'''
+ tests = {}
+ comments = None
+
+ for line in fd:
+ sline = line.strip()
+ tokens = sline.split()
+ if len(tokens) == 0 or tokens[0] == '#':
+ if comments == None:
+ comments = []
+ comments.append(sline)
+ else:
+ tests[tokens[0]] = (comments, tokens[1:])
+ comments = None
+ return tests
+
+def sort_keys(keys):
+ '''Separate keys into integer and non-integer tests.'''
+ int_keys = []
+ int_xkeys = []
+ str_keys = []
+
+ # Sort keys into integer(ish) tests and other
+ for key in keys:
+ xkey = xfstest_key(key)
+ if type(xkey) == int:
+ int_keys.append(key)
+ int_xkeys.append(xkey)
+ else:
+ str_keys.append(key)
+ return (int_keys, int_xkeys, str_keys)
+
+def write_sorted(tests, fd):
+ def dump_xkey(xkey):
+ (comments, tokens) = tests[key]
+ if comments:
+ for c in comments:
+ fd.write('%s\n' % c)
+ fd.write('%s %s\n' % (key, ' '.join(tokens)))
+ '''Print tests (and comments) in number order.'''
+
+ (int_keys, ignored, str_keys) = sort_keys(tests.keys())
+ for key in sorted(int_keys, key = xfstest_key):
+ dump_xkey(key)
+ for key in sorted(str_keys):
+ dump_xkey(key)
+
+def sort_main():
+ if '--help' in sys.argv[1:]:
+ print('Usage: %s groupfiles' % sys.argv[0])
+ sys.exit(0)
+
+ for arg in sys.argv[1:]:
+ with open(arg, 'r+') as fd:
+ x = read_group(fd)
+ fd.seek(0, 0)
+ write_sorted(x, fd)
+
+def nextid_main():
+ if '--help' in sys.argv[1:]:
+ print('Usage: %s group[/startid] ' % sys.argv[0])
+ sys.exit(0)
+
+ if len(sys.argv) != 2:
+ print('Specify exactly one group name.')
+ sys.exit(1)
+
+ c = sys.argv[1].split('/')
+ if len(c) > 1:
+ startid = int(c[1])
+ else:
+ startid = 1
+ group = c[0]
+
+ with open('tests/%s/group' % group, 'r') as fd:
+ x = read_group(fd)
+ xkeys = {int(x) for x in sort_keys(x.keys())[1]}
+
+ xid = startid
+ while xid in xkeys:
+ xid += 1
+ print('%s/%d' % (group, xid))
+
+if __name__ == '__main__':
+ if 'nextid' in sys.argv[0]:
+ nextid_main()
+ else:
+ sort_main()
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/11] tests: don't leave cruft behind on the TEST_MNT
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-12-19 9:10 ` [PATCH 01/11] test-scripts: test migration scripts Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 03/11] generic/15[78]: fix error messages in the golden output Darrick J. Wong
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Don't leave cruft behind on the test device's filesystem, so as to
avoid filling it with debris.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/110 | 2 +-
tests/generic/111 | 2 +-
tests/generic/115 | 2 +-
tests/generic/159 | 2 +-
tests/generic/160 | 2 +-
tests/xfs/129 | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/generic/110 b/tests/generic/110
index 468d859..fffadbc 100755
--- a/tests/generic/110
+++ b/tests/generic/110
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- rm -f $tmp.*
+ rm -f $tmp.* "$TESTDIR"
}
# get standard environment, filters and checks
diff --git a/tests/generic/111 b/tests/generic/111
index 1797233..98077d8 100755
--- a/tests/generic/111
+++ b/tests/generic/111
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- rm -f $tmp.*
+ rm -f $tmp.* "$TESTDIR"
}
# get standard environment, filters and checks
diff --git a/tests/generic/115 b/tests/generic/115
index b5c64ec..6c8d92d 100755
--- a/tests/generic/115
+++ b/tests/generic/115
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- rm -f $tmp.*
+ rm -f $tmp.* "$TESTDIR"
}
# get standard environment, filters and checks
diff --git a/tests/generic/159 b/tests/generic/159
index 7944267..369663d 100755
--- a/tests/generic/159
+++ b/tests/generic/159
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- # rm -rf "$tmp".* "$TESTDIR1"
+ rm -rf "$tmp".* "$TESTDIR1"
}
# get standard environment, filters and checks
diff --git a/tests/generic/160 b/tests/generic/160
index e8c43df..4dfee12 100755
--- a/tests/generic/160
+++ b/tests/generic/160
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- # rm -rf "$tmp".* "$TESTDIR1"
+ rm -rf "$tmp".* "$TESTDIR1"
}
# get standard environment, filters and checks
diff --git a/tests/xfs/129 b/tests/xfs/129
index 6279d69..6fb9bac 100755
--- a/tests/xfs/129
+++ b/tests/xfs/129
@@ -35,7 +35,7 @@ _cleanup()
{
cd /
umount "$SCRATCH_MNT" > /dev/null 2>&1
- rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE"
+ rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE" "$TEST_DIR/image"
}
# get standard environment, filters and checks
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/11] generic/15[78]: fix error messages in the golden output
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-12-19 9:10 ` [PATCH 01/11] test-scripts: test migration scripts Darrick J. Wong
2015-12-19 9:11 ` [PATCH 02/11] tests: don't leave cruft behind on the TEST_MNT Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 04/11] xfs/128: allow larger margin for disk space usage Darrick J. Wong
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Fix the error messages in the golden output for generic/15[78], which
examine the responses to invalid inputs as returned by the
clone/clone_range/extent_same ioctls. Also fix a filtering omission.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/157 | 18 +++++++++++++-----
tests/generic/157.out | 6 +++---
tests/generic/158 | 18 +++++++++++++-----
tests/generic/158.out | 8 ++++----
4 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/tests/generic/157 b/tests/generic/157
index a43fb0d..f68ff52 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -75,10 +75,18 @@ mkdir "$TESTDIR1/dir1"
seq 1 $((2 * BLKSZ / 250)) | while read f; do
touch "$TESTDIR1/dir1/$f"
done
-mknod "$TESTDIR1/dev1" b 8 0
+mknod "$TESTDIR1/dev1" c 1 3
mkfifo "$TESTDIR1/fifo1"
sync
+_filter_enotty() {
+ sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
+}
+
+_filter_einval() {
+ sed -e 's/Invalid argument/Bad file descriptor/g'
+}
+
echo "Try cross-device reflink"
_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
@@ -98,16 +106,16 @@ echo "Try to reflink a device"
_reflink_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ
echo "Try to reflink to a dir"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ
+_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir
echo "Try to reflink to a device"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ
+_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_enotty
echo "Try to reflink to a fifo"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n
+_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_enotty
echo "Try to reflink an append-only file"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a
+_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a 2>&1 | _filter_einval
echo "Reflink two files"
_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ >> "$seqres.full"
diff --git a/tests/generic/157.out b/tests/generic/157.out
index 177e7f8..ac3c440 100644
--- a/tests/generic/157.out
+++ b/tests/generic/157.out
@@ -14,11 +14,11 @@ XFS_IOC_CLONE_RANGE: Is a directory
Try to reflink a device
XFS_IOC_CLONE_RANGE: Invalid argument
Try to reflink to a dir
-/mnt/test-157/dir1: Is a directory
+TEST_DIR/test-157/dir1: Is a directory
Try to reflink to a device
-XFS_IOC_CLONE_RANGE: Operation not supported
+XFS_IOC_CLONE_RANGE: Invalid argument
Try to reflink to a fifo
-XFS_IOC_CLONE_RANGE: Operation not supported
+XFS_IOC_CLONE_RANGE: Invalid argument
Try to reflink an append-only file
XFS_IOC_CLONE_RANGE: Bad file descriptor
Reflink two files
diff --git a/tests/generic/158 b/tests/generic/158
index a499b21..749b186 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -76,10 +76,18 @@ mkdir "$TESTDIR1/dir1"
seq 1 $((2 * BLKSZ / 250)) | while read f; do
touch "$TESTDIR1/dir1/$f"
done
-mknod "$TESTDIR1/dev1" b 8 0
+mknod "$TESTDIR1/dev1" c 1 3
mkfifo "$TESTDIR1/fifo1"
sync
+_filter_enotty() {
+ sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
+}
+
+_filter_eperm() {
+ sed -e 's/Permission denied/Invalid argument/g'
+}
+
echo "Try cross-device dedupe"
_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
@@ -96,16 +104,16 @@ echo "Try to dedupe a dir"
_dedupe_range "$TESTDIR1/dir1" 0 "$TESTDIR1/file2" 0 $BLKSZ
echo "Try to dedupe a device"
-_dedupe_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ
+_dedupe_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ 2>&1 | _filter_enotty
echo "Try to dedupe to a dir"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ
+_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir
echo "Try to dedupe to a device"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ
+_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_eperm
echo "Try to dedupe to a fifo"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n
+_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_eperm
echo "Try to dedupe an append-only file"
_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a >> "$seqres.full"
diff --git a/tests/generic/158.out b/tests/generic/158.out
index 36a3f1f..dff3692 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -12,13 +12,13 @@ dedupe: Invalid argument
Try to dedupe a dir
XFS_IOC_FILE_EXTENT_SAME: Is a directory
Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Permission denied
+XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try to dedupe to a dir
-/mnt/test-158/dir1: Is a directory
+TEST_DIR/test-158/dir1: Is a directory
Try to dedupe to a device
-dedupe: Permission denied
+dedupe: Invalid argument
Try to dedupe to a fifo
-dedupe: Permission denied
+dedupe: Invalid argument
Try to dedupe an append-only file
Dedupe two files
Check scratch fs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/11] xfs/128: allow larger margin for disk space usage
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (2 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 03/11] generic/15[78]: fix error messages in the golden output Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 05/11] xfs/129: require loop Darrick J. Wong
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
The free blocks count can vary from our calculations by up to 8% on a
1k-block filesystem, so permit that.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/xfs/128 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/xfs/128 b/tests/xfs/128
index 49652cb..f461c1a 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -59,7 +59,7 @@ FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
echo "Create the original file and reflink to file2, file3"
BLKS=2000
-MARGIN=100
+MARGIN=160
BLKSZ=65536
REAL_BLKSZ="$(stat -f $TESTDIR -c '%S')"
BLKSZ_FACTOR=$((BLKSZ / REAL_BLKSZ))
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/11] xfs/129: require loop
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (3 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 04/11] xfs/128: allow larger margin for disk space usage Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 06/11] reflink: more tests Darrick J. Wong
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Missed a _require_loop for xfs/129.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/xfs/129 | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/xfs/129 b/tests/xfs/129
index 6fb9bac..c8c47a2 100755
--- a/tests/xfs/129
+++ b/tests/xfs/129
@@ -46,6 +46,7 @@ _cleanup()
# real QA test starts here
_supported_os Linux
_supported_fs xfs
+_require_loop
_require_scratch_reflink
rm -f "$seqres.full"
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/11] reflink: more tests
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (4 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 05/11] xfs/129: require loop Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-21 6:31 ` Dave Chinner
2015-12-19 9:11 ` [PATCH 07/11] reflink: test ENOSPC when expanding btrees during reflink operations Darrick J. Wong
` (4 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, linux-btrfs, fstests, xfs
Add more tests for unaligned copy-on-write things, and explicitly
test the ability to pass "len == 0" to mean reflink/dedupe all
the way to the end of the file".
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/820 | 77 ++++++++++++++++++++++++++++++++
tests/generic/820.out | 8 +++
tests/generic/847 | 96 ++++++++++++++++++++++++++++++++++++++++
tests/generic/847.out | 11 +++++
tests/generic/848 | 96 ++++++++++++++++++++++++++++++++++++++++
tests/generic/848.out | 11 +++++
tests/generic/849 | 80 ++++++++++++++++++++++++++++++++++
tests/generic/849.out | 6 +++
tests/generic/850 | 117 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/850.out | 17 +++++++
tests/generic/group | 5 ++
11 files changed, 524 insertions(+)
create mode 100755 tests/generic/820
create mode 100644 tests/generic/820.out
create mode 100755 tests/generic/847
create mode 100644 tests/generic/847.out
create mode 100755 tests/generic/848
create mode 100644 tests/generic/848.out
create mode 100755 tests/generic/849
create mode 100644 tests/generic/849.out
create mode 100755 tests/generic/850
create mode 100644 tests/generic/850.out
diff --git a/tests/generic/820 b/tests/generic/820
new file mode 100755
index 0000000..e475f71
--- /dev/null
+++ b/tests/generic/820
@@ -0,0 +1,77 @@
+#! /bin/bash
+# FS QA Test No. 820
+#
+# Ensure that punch-hole doesn't clobber CoW.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+_require_xfs_io_command "fpunch"
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+NR=512
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+
+echo "Write and punch"
+_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "fpunch $BLKSZ $((BLKSZ * 254))" "$TESTDIR/file2"
+_test_remount
+
+echo "Compare results"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/820.out b/tests/generic/820.out
new file mode 100644
index 0000000..527617d
--- /dev/null
+++ b/tests/generic/820.out
@@ -0,0 +1,8 @@
+QA output created by 820
+Create the original files
+bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file1
+bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file2
+Write and punch
+Compare results
+bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file1
+95cfd19ce56010430dc2057413d7efc5 TEST_DIR/test-820/file2
diff --git a/tests/generic/847 b/tests/generic/847
new file mode 100755
index 0000000..ee8b53b
--- /dev/null
+++ b/tests/generic/847
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 847
+#
+# Ensure that unaligned punch-hole steps around reflinked ranges:
+# - Create a reflink clone of a file
+# - Perform an unaligned punch in the middle of the file.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+_require_xfs_io_command "fpunch"
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "fpunch files"
+"$XFS_IO_PROG" -f -c "fpunch $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+_test_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/847.out b/tests/generic/847.out
new file mode 100644
index 0000000..8139857
--- /dev/null
+++ b/tests/generic/847.out
@@ -0,0 +1,11 @@
+QA output created by 847
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file2
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2.chk
+fpunch files
+Compare files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file1
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2.chk
+Compare against check files
diff --git a/tests/generic/848 b/tests/generic/848
new file mode 100755
index 0000000..cb848fb
--- /dev/null
+++ b/tests/generic/848
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 848
+#
+# Ensure that unaligned zero-range steps around reflinked ranges:
+# - Create a reflink clone of a file
+# - Perform an unaligned zero-range in the middle of the file.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+_require_xfs_io_command "fzero"
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "fzero files"
+"$XFS_IO_PROG" -f -c "fzero $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+_test_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/848.out b/tests/generic/848.out
new file mode 100644
index 0000000..94c674b
--- /dev/null
+++ b/tests/generic/848.out
@@ -0,0 +1,11 @@
+QA output created by 848
+Create the original files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file1
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file2
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2.chk
+fzero files
+Compare files
+998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file1
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2
+8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2.chk
+Compare against check files
diff --git a/tests/generic/849 b/tests/generic/849
new file mode 100755
index 0000000..76f1e70
--- /dev/null
+++ b/tests/generic/849
@@ -0,0 +1,80 @@
+#! /bin/bash
+# FS QA Test No. 849
+#
+# Test the convention that reflink with length == 0 means "to the end of fileA"
+# - Create a file.
+# - Try to reflink "zero" bytes.
+# - Check that the reflink happened.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 2)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 255)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/849.out b/tests/generic/849.out
new file mode 100644
index 0000000..159305a
--- /dev/null
+++ b/tests/generic/849.out
@@ -0,0 +1,6 @@
+QA output created by 849
+Create the original files
+f4820540fc0ac02750739896fe028d56 TEST_DIR/test-849/file1
+dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2
+dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2.chk
+Compare against check files
diff --git a/tests/generic/850 b/tests/generic/850
new file mode 100755
index 0000000..954d41d
--- /dev/null
+++ b/tests/generic/850
@@ -0,0 +1,117 @@
+#! /bin/bash
+# FS QA Test No. 850
+#
+# Test the convention that reflink with length == 0 means "to the end of fileA"
+# - Create a file.
+# - Try to reflink "zero" bytes (which means reflink to EOF).
+# - Check that the reflink happened.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "Make the original file almost dedup-able"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "Make the original file dedup-able"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/850.out b/tests/generic/850.out
new file mode 100644
index 0000000..126187e
--- /dev/null
+++ b/tests/generic/850.out
@@ -0,0 +1,17 @@
+QA output created by 850
+Create the original files
+f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1
+69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-850/file2
+69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-850/file2.chk
+Compare against check files
+Make the original file almost dedup-able
+f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1
+158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-850/file2
+158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-850/file2.chk
+Compare against check files
+Make the original file dedup-able
+f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1
+113c7055ffe3d24d2dec27e82ab55abd TEST_DIR/test-850/file2
+113c7055ffe3d24d2dec27e82ab55abd TEST_DIR/test-850/file2.chk
+file1 and file2 should match
+Compare against check files
diff --git a/tests/generic/group b/tests/generic/group
index 355603f..bf33541 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -257,3 +257,8 @@
323 auto aio stress
324 auto fsr quick
325 auto quick data log
+820 auto quick clone
+847 auto quick clone
+848 auto quick clone
+849 auto quick clone
+850 auto quick clone
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 06/11] reflink: more tests
2015-12-19 9:11 ` [PATCH 06/11] reflink: more tests Darrick J. Wong
@ 2015-12-21 6:31 ` Dave Chinner
2016-01-04 19:47 ` Darrick J. Wong
0 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2015-12-21 6:31 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
On Sat, Dec 19, 2015 at 01:11:31AM -0800, Darrick J. Wong wrote:
> Add more tests for unaligned copy-on-write things, and explicitly
> test the ability to pass "len == 0" to mean reflink/dedupe all
> the way to the end of the file".
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
.....
> +_cleanup()
> +{
> + cd /
> + rm -rf "$tmp".* "$TESTDIR"
> +}
.....
> +
> +TESTDIR="$TEST_DIR/test-$seq"
> +rm -rf "$TESTDIR"
> +mkdir "$TESTDIR"
This use of TESTDIR is highly confusing. When I see TESTDIR I think
that it's the mount point of the test device, not potentially some
directory on the scratch device.
I see that this occurs through lots of tests, not just these new
ones. Can you do a pass across the tests with, say, sed and rename
all these to something less confusing? e.g. "testdir", in lower
case, makes it clear that it's a local variable, not the global test
device mount point.... (i.e. test local variables are lower case,
exported test harnes variables are upper case ;)
Separate patch/pull req is fine.
Cheers,
dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 06/11] reflink: more tests
2015-12-21 6:31 ` Dave Chinner
@ 2016-01-04 19:47 ` Darrick J. Wong
0 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2016-01-04 19:47 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-ext4, fstests, linux-btrfs, xfs
On Mon, Dec 21, 2015 at 05:31:11PM +1100, Dave Chinner wrote:
> On Sat, Dec 19, 2015 at 01:11:31AM -0800, Darrick J. Wong wrote:
> > Add more tests for unaligned copy-on-write things, and explicitly
> > test the ability to pass "len == 0" to mean reflink/dedupe all
> > the way to the end of the file".
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> .....
> > +_cleanup()
> > +{
> > + cd /
> > + rm -rf "$tmp".* "$TESTDIR"
> > +}
> .....
> > +
> > +TESTDIR="$TEST_DIR/test-$seq"
> > +rm -rf "$TESTDIR"
> > +mkdir "$TESTDIR"
>
> This use of TESTDIR is highly confusing. When I see TESTDIR I think
> that it's the mount point of the test device, not potentially some
> directory on the scratch device.
>
> I see that this occurs through lots of tests, not just these new
> ones. Can you do a pass across the tests with, say, sed and rename
> all these to something less confusing? e.g. "testdir", in lower
> case, makes it clear that it's a local variable, not the global test
> device mount point.... (i.e. test local variables are lower case,
> exported test harnes variables are upper case ;)
>
> Separate patch/pull req is fine.
No problem. Will give it a spin on the test harness before sending.
(Yikes, it's a 272K patch...)
--D
>
> Cheers,
>
> dave.
> --
> Dave Chinner
> david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 07/11] reflink: test ENOSPC when expanding btrees during reflink operations
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (5 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 06/11] reflink: more tests Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 08/11] reflink: more CoW tests for reflink and dedupe Darrick J. Wong
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, linux-btrfs, fstests, xfs
See what happens when we ENOSPC while growing a btree on behalf of
some reflink operation.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/xfs/805 | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/805.out | 8 +++++
tests/xfs/806 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/806.out | 7 ++++
tests/xfs/group | 2 +
5 files changed, 188 insertions(+)
create mode 100755 tests/xfs/805
create mode 100644 tests/xfs/805.out
create mode 100755 tests/xfs/806
create mode 100644 tests/xfs/806.out
diff --git a/tests/xfs/805 b/tests/xfs/805
new file mode 100755
index 0000000..17a7743
--- /dev/null
+++ b/tests/xfs/805
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 806
+#
+# Try to ENOSPC while expanding the refcntbt by CoWing every block
+# of a file that eats the whole AG.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs -d agsize=$((32 * 1048576)) > "$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')"
+
+echo "Create the original files"
+SZ=$((48 * 1048576))
+NR=$((SZ / BLKSZ))
+_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+_scratch_remount
+
+echo "CoW every other block"
+_pwrite_byte 0x62 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+#filefrag -v "$TESTDIR/file1" "$TESTDIR/file2"
+
+echo "Check scratch fs"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/805.out b/tests/xfs/805.out
new file mode 100644
index 0000000..d36ab27
--- /dev/null
+++ b/tests/xfs/805.out
@@ -0,0 +1,8 @@
+QA output created by 805
+Format and mount
+Create the original files
+CoW every other block
+Compare files
+673c759fb131ccf3336c4f8c549a497e /opt/test-805/file1
+dc802351f6717547cbf4c951b294f952 /opt/test-805/file2
+Check scratch fs
diff --git a/tests/xfs/806 b/tests/xfs/806
new file mode 100755
index 0000000..5e96b8a
--- /dev/null
+++ b/tests/xfs/806
@@ -0,0 +1,89 @@
+#! /bin/bash
+# FS QA Test No. 806
+#
+# Try to ENOSPC while expanding the refcntbt by CoWing every other block
+# of a file that eats the whole AG.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+BLKSZ="$(stat -f -c '%S' "$TESTDIR")"
+
+echo "Create the original files"
+SZ=$((48 * 1048576))
+NR=$((SZ / BLKSZ))
+_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $SZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "CoW every other block"
+seq 1 2 $NR | while read f; do
+ _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+ _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 must not match"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "Check scratch fs"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/806.out b/tests/xfs/806.out
new file mode 100644
index 0000000..be89ea0
--- /dev/null
+++ b/tests/xfs/806.out
@@ -0,0 +1,7 @@
+QA output created by 806
+Format and mount
+Create the original files
+Compare files
+CoW every other block
+Compare files
+Check scratch fs
diff --git a/tests/xfs/group b/tests/xfs/group
index 9884329..b654005 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -226,3 +226,5 @@
303 auto quick quota
304 auto quick quota
305 auto quota
+805 auto quick clone
+806 auto quick clone
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/11] reflink: more CoW tests for reflink and dedupe
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (6 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 07/11] reflink: test ENOSPC when expanding btrees during reflink operations Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:11 ` [PATCH 09/11] reflink: test CoW with blocksize < pagesize Darrick J. Wong
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, linux-btrfs, fstests, xfs
These tests examine the behavior of advanced and tricky copy on write
situations.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/851 | 101 ++++++++++++++++++++++++++++++++++
tests/generic/851.out | 15 +++++
tests/generic/852 | 101 ++++++++++++++++++++++++++++++++++
tests/generic/852.out | 15 +++++
tests/generic/853 | 146 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/853.out | 15 +++++
tests/generic/854 | 146 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/854.out | 15 +++++
tests/generic/855 | 96 ++++++++++++++++++++++++++++++++
tests/generic/855.out | 13 ++++
tests/generic/856 | 96 ++++++++++++++++++++++++++++++++
tests/generic/856.out | 13 ++++
tests/generic/857 | 96 ++++++++++++++++++++++++++++++++
tests/generic/857.out | 13 ++++
tests/generic/858 | 96 ++++++++++++++++++++++++++++++++
tests/generic/858.out | 13 ++++
tests/generic/859 | 101 ++++++++++++++++++++++++++++++++++
tests/generic/859.out | 13 ++++
tests/generic/860 | 101 ++++++++++++++++++++++++++++++++++
tests/generic/860.out | 13 ++++
tests/generic/861 | 96 ++++++++++++++++++++++++++++++++
tests/generic/861.out | 13 ++++
tests/generic/862 | 96 ++++++++++++++++++++++++++++++++
tests/generic/862.out | 13 ++++
tests/generic/863 | 125 ++++++++++++++++++++++++++++++++++++++++++
tests/generic/863.out | 13 ++++
tests/generic/864 | 125 ++++++++++++++++++++++++++++++++++++++++++
tests/generic/864.out | 13 ++++
tests/generic/865 | 86 +++++++++++++++++++++++++++++
tests/generic/865.out | 9 +++
tests/generic/866 | 86 +++++++++++++++++++++++++++++
tests/generic/866.out | 13 ++++
tests/generic/867 | 86 +++++++++++++++++++++++++++++
tests/generic/867.out | 13 ++++
tests/generic/group | 17 ++++++
35 files changed, 2022 insertions(+)
create mode 100755 tests/generic/851
create mode 100644 tests/generic/851.out
create mode 100755 tests/generic/852
create mode 100644 tests/generic/852.out
create mode 100755 tests/generic/853
create mode 100644 tests/generic/853.out
create mode 100755 tests/generic/854
create mode 100644 tests/generic/854.out
create mode 100755 tests/generic/855
create mode 100644 tests/generic/855.out
create mode 100755 tests/generic/856
create mode 100644 tests/generic/856.out
create mode 100755 tests/generic/857
create mode 100644 tests/generic/857.out
create mode 100755 tests/generic/858
create mode 100644 tests/generic/858.out
create mode 100755 tests/generic/859
create mode 100644 tests/generic/859.out
create mode 100755 tests/generic/860
create mode 100644 tests/generic/860.out
create mode 100755 tests/generic/861
create mode 100644 tests/generic/861.out
create mode 100755 tests/generic/862
create mode 100644 tests/generic/862.out
create mode 100755 tests/generic/863
create mode 100644 tests/generic/863.out
create mode 100755 tests/generic/864
create mode 100644 tests/generic/864.out
create mode 100755 tests/generic/865
create mode 100644 tests/generic/865.out
create mode 100755 tests/generic/866
create mode 100644 tests/generic/866.out
create mode 100755 tests/generic/867
create mode 100644 tests/generic/867.out
diff --git a/tests/generic/851 b/tests/generic/851
new file mode 100755
index 0000000..62db9a4
--- /dev/null
+++ b/tests/generic/851
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 851
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents.
+# - Create two files
+# - Reflink the odd blocks of the first file into a third file.
+# - Reflink the even blocks of the second file into the third file.
+# - directio CoW across the halfway mark.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+seq 1 2 $NR | while read f; do
+ _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/851.out b/tests/generic/851.out
new file mode 100644
index 0000000..8ca4a05
--- /dev/null
+++ b/tests/generic/851.out
@@ -0,0 +1,15 @@
+QA output created by 851
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-851/file1
+b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-851/file2
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-851/file3
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-851/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-851/file1
+b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-851/file2
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-851/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-851/file3.chk
+Check for damage
diff --git a/tests/generic/852 b/tests/generic/852
new file mode 100755
index 0000000..c48ec16
--- /dev/null
+++ b/tests/generic/852
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 852
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents.
+# - Create two files
+# - Reflink the odd blocks of the first file into a third file.
+# - Reflink the even blocks of the second file into the third file.
+# - CoW across the halfway mark.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+seq 1 2 $NR | while read f; do
+ _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW across the transition"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/852.out b/tests/generic/852.out
new file mode 100644
index 0000000..02b5854
--- /dev/null
+++ b/tests/generic/852.out
@@ -0,0 +1,15 @@
+QA output created by 852
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-852/file1
+b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-852/file2
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-852/file3
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-852/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-852/file1
+b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-852/file2
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-852/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-852/file3.chk
+Check for damage
diff --git a/tests/generic/853 b/tests/generic/853
new file mode 100755
index 0000000..433c1ee
--- /dev/null
+++ b/tests/generic/853
@@ -0,0 +1,146 @@
+#! /bin/bash
+# FS QA Test No. 853
+#
+# Ensuring that copy on write in buffered mode works when free space
+# is heavily fragmented.
+# - Create two files
+# - Reflink the odd blocks of the first file into a third file.
+# - Reflink the even blocks of the second file into the third file.
+# - Try to fragment the free space by allocating a huge file and
+# punching out every other block.
+# - CoW across the halfway mark.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
+
+rm -f "$seqres.full"
+
+_fragment_freesp()
+{
+ file="$1"
+
+ # consume nearly all available space (leave ~1MB)
+ avail=`_get_available_space $SCRATCH_MNT`
+ echo "$avail bytes left"
+ filesize=$((avail - 1048576))
+ $XFS_IO_PROG -fc "truncate $filesize" "$file"
+
+ chunks=20
+ chunksizemb=$((filesize / chunks / 1048576))
+ seq 1 $chunks | while read f; do
+ echo "$((f * chunksizemb)) file size $f / 20"
+ $XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+ done
+
+ chunks=100
+ chunksizemb=$((filesize / chunks / 1048576))
+ seq 80 $chunks | while read f; do
+ echo "$((f * chunksizemb)) file size $f / $chunks"
+ $XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+ done
+
+ filesizemb=$((filesize / 1048576))
+ $XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
+
+ # Try again anyway
+ avail=`_get_available_space $SCRATCH_MNT`
+ $XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
+
+ # Punch out whatever we need
+ seq 1 $((NR * 4)) | while read f; do
+ $XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
+ done
+}
+
+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 files"
+BLKSZ=65536
+NR=1024
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+seq 1 2 $NR | while read f; do
+ _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW with multiple extents?"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/853.out b/tests/generic/853.out
new file mode 100644
index 0000000..06622de
--- /dev/null
+++ b/tests/generic/853.out
@@ -0,0 +1,15 @@
+QA output created by 853
+Format and mount
+Create the original files
+Compare files
+6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-853/file1
+35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-853/file2
+8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-853/file3
+8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-853/file3.chk
+CoW with multiple extents?
+Compare files
+6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-853/file1
+35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-853/file2
+1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-853/file3
+1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-853/file3.chk
+Check for damage
diff --git a/tests/generic/854 b/tests/generic/854
new file mode 100755
index 0000000..9776388
--- /dev/null
+++ b/tests/generic/854
@@ -0,0 +1,146 @@
+#! /bin/bash
+# FS QA Test No. 854
+#
+# Ensuring that copy on write in directio mode works when free space
+# is heavily fragmented.
+# - Create two files
+# - Reflink the odd blocks of the first file into a third file.
+# - Reflink the even blocks of the second file into the third file.
+# - Try to fragment the free space by allocating a huge file and
+# punching out every other block.
+# - CoW across the halfway mark.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
+
+rm -f "$seqres.full"
+
+_fragment_freesp()
+{
+ file="$1"
+
+ # consume nearly all available space (leave ~1MB)
+ avail=`_get_available_space $SCRATCH_MNT`
+ echo "$avail bytes left"
+ filesize=$((avail - 1048576))
+ $XFS_IO_PROG -fc "truncate $filesize" "$file"
+
+ chunks=20
+ chunksizemb=$((filesize / chunks / 1048576))
+ seq 1 $chunks | while read f; do
+ echo "$((f * chunksizemb)) file size $f / 20"
+ $XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+ done
+
+ chunks=100
+ chunksizemb=$((filesize / chunks / 1048576))
+ seq 80 $chunks | while read f; do
+ echo "$((f * chunksizemb)) file size $f / $chunks"
+ $XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+ done
+
+ filesizemb=$((filesize / 1048576))
+ $XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
+
+ # Try again anyway
+ avail=`_get_available_space $SCRATCH_MNT`
+ $XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
+
+ # Punch out whatever we need
+ seq 1 $((NR * 4)) | while read f; do
+ $XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
+ done
+}
+
+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 files"
+BLKSZ=65536
+NR=1024
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+seq 1 2 $NR | while read f; do
+ _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW with multiple extents?"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/854.out b/tests/generic/854.out
new file mode 100644
index 0000000..a96c8c4
--- /dev/null
+++ b/tests/generic/854.out
@@ -0,0 +1,15 @@
+QA output created by 854
+Format and mount
+Create the original files
+Compare files
+6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-854/file1
+35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-854/file2
+8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-854/file3
+8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-854/file3.chk
+CoW with multiple extents?
+Compare files
+6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-854/file1
+35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-854/file2
+1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-854/file3
+1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-854/file3.chk
+Check for damage
diff --git a/tests/generic/855 b/tests/generic/855
new file mode 100755
index 0000000..017be2e
--- /dev/null
+++ b/tests/generic/855
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 855
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create a file and fallocate a second file.
+# - Reflink the odd blocks of the first file into the second file.
+# - directio CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/855.out b/tests/generic/855.out
new file mode 100644
index 0000000..ca3aaab
--- /dev/null
+++ b/tests/generic/855.out
@@ -0,0 +1,13 @@
+QA output created by 855
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-855/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-855/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-855/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-855/file1
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-855/file3
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-855/file3.chk
+Check for damage
diff --git a/tests/generic/856 b/tests/generic/856
new file mode 100755
index 0000000..dfaa491
--- /dev/null
+++ b/tests/generic/856
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 856
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create a file and fallocate a second file.
+# - Reflink the odd blocks of the first file into the second file.
+# - CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW across the transition"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/856.out b/tests/generic/856.out
new file mode 100644
index 0000000..41675db
--- /dev/null
+++ b/tests/generic/856.out
@@ -0,0 +1,13 @@
+QA output created by 856
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-856/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-856/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-856/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-856/file1
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-856/file3
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-856/file3.chk
+Check for damage
diff --git a/tests/generic/857 b/tests/generic/857
new file mode 100755
index 0000000..ddf7c50
--- /dev/null
+++ b/tests/generic/857
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 857
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+# - Create a file and truncate a second file.
+# - Reflink the odd blocks of the first file into the second file.
+# - directio CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/857.out b/tests/generic/857.out
new file mode 100644
index 0000000..b82e365
--- /dev/null
+++ b/tests/generic/857.out
@@ -0,0 +1,13 @@
+QA output created by 857
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-857/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-857/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-857/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-857/file1
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-857/file3
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-857/file3.chk
+Check for damage
diff --git a/tests/generic/858 b/tests/generic/858
new file mode 100755
index 0000000..0a341d0
--- /dev/null
+++ b/tests/generic/858
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 858
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+# - Create a file and truncate a second file.
+# - Reflink the odd blocks of the first file into the second file.
+# - CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW across the transition"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/858.out b/tests/generic/858.out
new file mode 100644
index 0000000..171fb4b
--- /dev/null
+++ b/tests/generic/858.out
@@ -0,0 +1,13 @@
+QA output created by 858
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-858/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-858/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-858/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-858/file1
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-858/file3
+09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-858/file3.chk
+Check for damage
diff --git a/tests/generic/859 b/tests/generic/859
new file mode 100755
index 0000000..0929c2a
--- /dev/null
+++ b/tests/generic/859
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 859
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+# - Create a file.
+# - Reflink the odd blocks of the first file into the second file.
+# - Buffered write the even blocks of the second file.
+# - directio CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+seq 1 2 $NR | while read f; do
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/859.out b/tests/generic/859.out
new file mode 100644
index 0000000..120da3c
--- /dev/null
+++ b/tests/generic/859.out
@@ -0,0 +1,13 @@
+QA output created by 859
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-859/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-859/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-859/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-859/file1
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-859/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-859/file3.chk
+Check for damage
diff --git a/tests/generic/860 b/tests/generic/860
new file mode 100755
index 0000000..432f5ad
--- /dev/null
+++ b/tests/generic/860
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 860
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+# - Create a file.
+# - Reflink the odd blocks of the first file into the second file.
+# - Buffered write the even blocks of the second file.
+# - CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW across the transition"
+seq 1 2 $NR | while read f; do
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/860.out b/tests/generic/860.out
new file mode 100644
index 0000000..69b3a96
--- /dev/null
+++ b/tests/generic/860.out
@@ -0,0 +1,13 @@
+QA output created by 860
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-860/file1
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-860/file3
+fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-860/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-860/file1
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-860/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-860/file3.chk
+Check for damage
diff --git a/tests/generic/861 b/tests/generic/861
new file mode 100755
index 0000000..c011ab7
--- /dev/null
+++ b/tests/generic/861
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 861
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create two files.
+# - Reflink the odd blocks of the first file into the second file.
+# - directio CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/861.out b/tests/generic/861.out
new file mode 100644
index 0000000..70154ae
--- /dev/null
+++ b/tests/generic/861.out
@@ -0,0 +1,13 @@
+QA output created by 861
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-861/file1
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-861/file3
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-861/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-861/file1
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-861/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-861/file3.chk
+Check for damage
diff --git a/tests/generic/862 b/tests/generic/862
new file mode 100755
index 0000000..034dfb1
--- /dev/null
+++ b/tests/generic/862
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 862
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create two files.
+# - Reflink the odd blocks of the first file into the second file.
+# - CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW across the transition"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/862.out b/tests/generic/862.out
new file mode 100644
index 0000000..ad1dc8e
--- /dev/null
+++ b/tests/generic/862.out
@@ -0,0 +1,13 @@
+QA output created by 862
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-862/file1
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-862/file3
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-862/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-862/file1
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-862/file3
+55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-862/file3.chk
+Check for damage
diff --git a/tests/generic/863 b/tests/generic/863
new file mode 100755
index 0000000..4aa2a42
--- /dev/null
+++ b/tests/generic/863
@@ -0,0 +1,125 @@
+#! /bin/bash
+# FS QA Test No. 863
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create a file with the following repeating sequence of blocks:
+# 1. reflinked
+# 2. unwritten
+# 3. hole
+# 4. regular block
+# 5. delalloc
+# - directio CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+# 0 blocks are reflinked
+seq 0 5 $NR | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+# 1 blocks are unwritten
+seq 1 5 $NR | while read f; do
+ $XFS_IO_PROG -f -c "falloc $((BLKSZ * f)) $BLKSZ" "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+# 2 blocks are holes
+seq 2 5 $NR | while read f; do
+ _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+# 3 blocks are regular
+seq 3 5 $NR | while read f; do
+ _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+# 4 blocks are delalloc (do later)
+seq 4 5 $NR | while read f; do
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+# now cow
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/863.out b/tests/generic/863.out
new file mode 100644
index 0000000..7cd4b2e
--- /dev/null
+++ b/tests/generic/863.out
@@ -0,0 +1,13 @@
+QA output created by 863
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-863/file1
+6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-863/file3
+6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-863/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-863/file1
+36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-863/file3
+36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-863/file3.chk
+Check for damage
diff --git a/tests/generic/864 b/tests/generic/864
new file mode 100755
index 0000000..899cf90
--- /dev/null
+++ b/tests/generic/864
@@ -0,0 +1,125 @@
+#! /bin/bash
+# FS QA Test No. 864
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+# - Create a file with the following repeating sequence of blocks:
+# 1. reflinked
+# 2. unwritten
+# 3. hole
+# 4. regular block
+# 5. delalloc
+# - CoW across the halfway mark, starting with the unwritten extent.
+# - 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+# 0 blocks are reflinked
+seq 0 5 $NR | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+# 1 blocks are unwritten
+seq 1 5 $NR | while read f; do
+ $XFS_IO_PROG -f -c "falloc $((BLKSZ * f)) $BLKSZ" "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+# 2 blocks are holes
+seq 2 5 $NR | while read f; do
+ _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+# 3 blocks are regular
+seq 3 5 $NR | while read f; do
+ _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+sync
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "directio CoW across the transition"
+# 4 blocks are delalloc (do later)
+seq 4 5 $NR | while read f; do
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+ _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+# now cow
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/864.out b/tests/generic/864.out
new file mode 100644
index 0000000..b62ab33
--- /dev/null
+++ b/tests/generic/864.out
@@ -0,0 +1,13 @@
+QA output created by 864
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-864/file1
+6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-864/file3
+6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-864/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-864/file1
+36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-864/file3
+36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-864/file3.chk
+Check for damage
diff --git a/tests/generic/865 b/tests/generic/865
new file mode 100755
index 0000000..1527971
--- /dev/null
+++ b/tests/generic/865
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 865
+#
+# See what happens if we dirty a lot of pages via CoW and immediately
+# unlink the 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+BLKSZ=65536
+NR=64
+_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 2 $((NR-1)) | while read f; do
+ _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file3" | _filter_scratch
+md5sum "$TESTDIR/file3.chk" | _filter_scratch
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
+rm "$TESTDIR/file3"
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/865.out b/tests/generic/865.out
new file mode 100644
index 0000000..c4837a1
--- /dev/null
+++ b/tests/generic/865.out
@@ -0,0 +1,9 @@
+QA output created by 865
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-865/file1
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-865/file3
+d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-865/file3.chk
+CoW and unmount
+Check for damage
diff --git a/tests/generic/866 b/tests/generic/866
new file mode 100755
index 0000000..3ebfb91
--- /dev/null
+++ b/tests/generic/866
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 866
+#
+# See what happens if we CoW across not-block-aligned EOF.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_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
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) 17" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) 17" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/866.out b/tests/generic/866.out
new file mode 100644
index 0000000..7782c58
--- /dev/null
+++ b/tests/generic/866.out
@@ -0,0 +1,13 @@
+QA output created by 866
+Format and mount
+Create the original files
+Compare files
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-866/file1
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-866/file2
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-866/file2.chk
+CoW and unmount
+Compare files
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-866/file1
+7cd112044b63b2c979f45e7c1e7cc85f SCRATCH_MNT/test-866/file2
+7cd112044b63b2c979f45e7c1e7cc85f SCRATCH_MNT/test-866/file2.chk
+Check for damage
diff --git a/tests/generic/867 b/tests/generic/867
new file mode 100755
index 0000000..87f220c
--- /dev/null
+++ b/tests/generic/867
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 867
+#
+# See what happens if we DIO CoW across not-block-aligned EOF.
+#
+#-----------------------------------------------------------------------
+# 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_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
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $BLKSZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/867.out b/tests/generic/867.out
new file mode 100644
index 0000000..9489e93
--- /dev/null
+++ b/tests/generic/867.out
@@ -0,0 +1,13 @@
+QA output created by 867
+Format and mount
+Create the original files
+Compare files
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-867/file1
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-867/file2
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-867/file2.chk
+CoW and unmount
+Compare files
+75f550706b7d54e6ae59a8220b532285 SCRATCH_MNT/test-867/file1
+227f44bb2dcf251ebf0217edaeb1e365 SCRATCH_MNT/test-867/file2
+227f44bb2dcf251ebf0217edaeb1e365 SCRATCH_MNT/test-867/file2.chk
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index bf33541..ea4901b 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -262,3 +262,20 @@
848 auto quick clone
849 auto quick clone
850 auto quick clone
+851 auto quick clone
+852 auto quick clone
+853 auto quick clone
+854 auto quick clone
+855 auto quick clone
+856 auto quick clone
+857 auto quick clone
+858 auto quick clone
+859 auto quick clone
+860 auto quick clone
+861 auto quick clone
+862 auto quick clone
+863 auto quick clone
+864 auto quick clone
+865 auto quick clone
+866 auto quick clone
+867 auto quick clone
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/11] reflink: test CoW with blocksize < pagesize
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (7 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 08/11] reflink: more CoW tests for reflink and dedupe Darrick J. Wong
@ 2015-12-19 9:11 ` Darrick J. Wong
2015-12-19 9:12 ` [PATCH 10/11] reflink: test a big CoW operation Darrick J. Wong
2015-12-19 9:12 ` [PATCH 11/11] generic: create a dedupe group Darrick J. Wong
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:11 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Test CoW operations when blocksize < pagesize and the only reflink
block is in the middle of the page.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/reflink | 30 +++++++++
tests/generic/868 | 102 +++++++++++++++++++++++++++++++
tests/generic/868.out | 7 ++
tests/generic/869 | 102 +++++++++++++++++++++++++++++++
tests/generic/869.out | 7 ++
tests/generic/870 | 103 +++++++++++++++++++++++++++++++
tests/generic/870.out | 7 ++
tests/generic/871 | 103 +++++++++++++++++++++++++++++++
tests/generic/871.out | 7 ++
tests/generic/872 | 97 +++++++++++++++++++++++++++++
tests/generic/872.out | 7 ++
tests/generic/873 | 97 +++++++++++++++++++++++++++++
tests/generic/873.out | 7 ++
tests/generic/874 | 103 +++++++++++++++++++++++++++++++
tests/generic/874.out | 7 ++
tests/generic/875 | 103 +++++++++++++++++++++++++++++++
tests/generic/875.out | 7 ++
tests/generic/876 | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/876.out | 83 +++++++++++++++++++++++++
tests/generic/877 | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/877.out | 83 +++++++++++++++++++++++++
tests/generic/group | 10 +++
22 files changed, 1398 insertions(+)
create mode 100755 tests/generic/868
create mode 100644 tests/generic/868.out
create mode 100755 tests/generic/869
create mode 100644 tests/generic/869.out
create mode 100755 tests/generic/870
create mode 100644 tests/generic/870.out
create mode 100755 tests/generic/871
create mode 100644 tests/generic/871.out
create mode 100755 tests/generic/872
create mode 100644 tests/generic/872.out
create mode 100755 tests/generic/873
create mode 100644 tests/generic/873.out
create mode 100755 tests/generic/874
create mode 100644 tests/generic/874.out
create mode 100755 tests/generic/875
create mode 100644 tests/generic/875.out
create mode 100755 tests/generic/876
create mode 100644 tests/generic/876.out
create mode 100755 tests/generic/877
create mode 100644 tests/generic/877.out
diff --git a/common/reflink b/common/reflink
index eab7f66..de8e56d 100644
--- a/common/reflink
+++ b/common/reflink
@@ -183,3 +183,33 @@ _dedupe_range() {
"$XFS_IO_PROG" $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
}
+
+# Create fs of certain blocksize on scratch device
+# _scratch_mkfs_blocksized blocksize
+_scratch_mkfs_blocksized()
+{
+ blocksize=$1
+
+ re='^[0-9]+$'
+ if ! [[ $blocksize =~ $re ]] ; then
+ _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
+ fi
+
+ case $FSTYP in
+ xfs)
+ # don't override MKFS_OPTIONS that set a block size.
+ echo $MKFS_OPTIONS |egrep -q "b?size="
+ if [ $? -eq 0 ]; then
+ _scratch_mkfs_xfs
+ else
+ _scratch_mkfs_xfs -b size=$blocksize
+ fi
+ ;;
+ ext2|ext3|ext4|ocfs2)
+ ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+ ;;
+ *)
+ _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
+ ;;
+ esac
+}
diff --git a/tests/generic/868 b/tests/generic/868
new file mode 100755
index 0000000..0de4f75
--- /dev/null
+++ b/tests/generic/868
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 868
+#
+# See what happens if we CoW blocks 2-4 of a page's worth of blocks when the
+# second block is a regular block.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/868.out b/tests/generic/868.out
new file mode 100644
index 0000000..d4a4e42
--- /dev/null
+++ b/tests/generic/868.out
@@ -0,0 +1,7 @@
+QA output created by 868
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/869 b/tests/generic/869
new file mode 100755
index 0000000..b64407c
--- /dev/null
+++ b/tests/generic/869
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 869
+#
+# See what happens if we DIO CoW blocks 2-4 of a page's worth of blocks when
+# the second block is a regular block.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/869.out b/tests/generic/869.out
new file mode 100644
index 0000000..612da46
--- /dev/null
+++ b/tests/generic/869.out
@@ -0,0 +1,7 @@
+QA output created by 869
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/870 b/tests/generic/870
new file mode 100755
index 0000000..3efb2d3
--- /dev/null
+++ b/tests/generic/870
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 870
+#
+# See what happens if we CoW blocks 2-4 of a page's worth of blocks when the
+# second block is a unwritten block.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/870.out b/tests/generic/870.out
new file mode 100644
index 0000000..d67b27c
--- /dev/null
+++ b/tests/generic/870.out
@@ -0,0 +1,7 @@
+QA output created by 870
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/871 b/tests/generic/871
new file mode 100755
index 0000000..f0cc148
--- /dev/null
+++ b/tests/generic/871
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 871
+#
+# See what happens if we DIO CoW blocks 2-4 of a page's worth of blocks when
+# the second block is a unwritten block.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/871.out b/tests/generic/871.out
new file mode 100644
index 0000000..b2e20a4
--- /dev/null
+++ b/tests/generic/871.out
@@ -0,0 +1,7 @@
+QA output created by 871
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/872 b/tests/generic/872
new file mode 100755
index 0000000..9ba0d71
--- /dev/null
+++ b/tests/generic/872
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 872
+#
+# See what happens if we CoW blocks 2-4 of a page's worth of blocks when the
+# second block is a hole.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/872.out b/tests/generic/872.out
new file mode 100644
index 0000000..40eff65
--- /dev/null
+++ b/tests/generic/872.out
@@ -0,0 +1,7 @@
+QA output created by 872
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/873 b/tests/generic/873
new file mode 100755
index 0000000..589d12b
--- /dev/null
+++ b/tests/generic/873
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 873
+#
+# See what happens if we DIO CoW blocks 2-4 of a page's worth of blocks when
+# the second block is a unwritten block.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/873.out b/tests/generic/873.out
new file mode 100644
index 0000000..c6a5399
--- /dev/null
+++ b/tests/generic/873.out
@@ -0,0 +1,7 @@
+QA output created by 873
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/874 b/tests/generic/874
new file mode 100755
index 0000000..e89b910
--- /dev/null
+++ b/tests/generic/874
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 874
+#
+# See what happens if we CoW blocks 2-4 of a page's worth of blocks when the
+# second block is delalloc.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/874.out b/tests/generic/874.out
new file mode 100644
index 0000000..0ded3bf
--- /dev/null
+++ b/tests/generic/874.out
@@ -0,0 +1,7 @@
+QA output created by 874
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/875 b/tests/generic/875
new file mode 100755
index 0000000..d7ac31c
--- /dev/null
+++ b/tests/generic/875
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 875
+#
+# See what happens if we DIO CoW blocks 2-4 of a page's worth of blocks when
+# the second block is delalloc.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "CoW and unmount"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/875.out b/tests/generic/875.out
new file mode 100644
index 0000000..968fe4b
--- /dev/null
+++ b/tests/generic/875.out
@@ -0,0 +1,7 @@
+QA output created by 875
+Format and mount
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/876 b/tests/generic/876
new file mode 100755
index 0000000..c38690e
--- /dev/null
+++ b/tests/generic/876
@@ -0,0 +1,163 @@
+#! /bin/bash
+# FS QA Test No. 876
+#
+# See what happens if we CoW blocks 2-4 of a page's worth of blocks when the
+# surrounding blocks vary between unwritten/regular/delalloc/hole.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+runtest() {
+ echo "runtest $1 $2"
+ b2=$1
+ b4=$2
+ dir=$3
+
+ echo "Create the original files"
+ mkdir -p "$dir"
+ _pwrite_byte 0x61 0 $PAGESZ "$dir/file1" >> "$seqres.full"
+
+ "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2" >> "$seqres.full"
+ "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2.chk" >> "$seqres.full"
+
+ case "$b2" in
+ "regular")
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "unwritten")
+ "$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x00 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "hole")
+ ;;
+ esac
+
+
+
+ case "$b4" in
+ "regular")
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "unwritten")
+ "$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "hole")
+ ;;
+ esac
+
+ _reflink_range "$dir/file1" $BLKSZ "$dir/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ _scratch_remount
+
+ echo "Compare files"
+ ! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
+ cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+
+ echo "CoW and unmount"
+ if [ "$b2" = "delalloc" ]; then
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ fi
+
+ if [ "$b4" = "delalloc" ]; then
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ fi
+
+ "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$dir/file2" >> "$seqres.full"
+ "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$dir/file2.chk" >> "$seqres.full"
+ _scratch_remount
+
+ echo "Compare files"
+ ! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
+ cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+}
+
+runtest regular delalloc "$TESTDIR/r-d"
+runtest regular unwritten "$TESTDIR/r-u"
+runtest regular hole "$TESTDIR/r-h"
+runtest regular regular "$TESTDIR/r-r"
+
+runtest hole delalloc "$TESTDIR/h-d"
+runtest hole unwritten "$TESTDIR/h-u"
+runtest hole hole "$TESTDIR/h-h"
+runtest hole regular "$TESTDIR/h-r"
+
+runtest unwritten delalloc "$TESTDIR/u-d"
+runtest unwritten unwritten "$TESTDIR/u-u"
+runtest unwritten hole "$TESTDIR/u-h"
+runtest unwritten regular "$TESTDIR/u-r"
+
+runtest delalloc delalloc "$TESTDIR/d-d"
+runtest delalloc unwritten "$TESTDIR/d-u"
+runtest delalloc hole "$TESTDIR/d-h"
+runtest delalloc regular "$TESTDIR/d-r"
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/876.out b/tests/generic/876.out
new file mode 100644
index 0000000..b93781d
--- /dev/null
+++ b/tests/generic/876.out
@@ -0,0 +1,83 @@
+QA output created by 876
+Format and mount
+runtest regular delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/877 b/tests/generic/877
new file mode 100755
index 0000000..dc063f9
--- /dev/null
+++ b/tests/generic/877
@@ -0,0 +1,163 @@
+#! /bin/bash
+# FS QA Test No. 877
+#
+# See what happens if we DIO CoW blocks 2-4 of a page's worth of blocks when
+# the surrounding blocks vary between unwritten/regular/delalloc/hole.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+PAGESZ=$(getconf PAGE_SIZE)
+BLKSZ=$((PAGESZ / 4))
+
+echo "Format and mount"
+_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+TESTDIR="$SCRATCH_MNT/test-$seq"
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
+test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+
+runtest() {
+ echo "runtest $1 $2"
+ b2=$1
+ b4=$2
+ dir=$3
+
+ echo "Create the original files"
+ mkdir -p "$dir"
+ _pwrite_byte 0x61 0 $PAGESZ "$dir/file1" >> "$seqres.full"
+
+ "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2" >> "$seqres.full"
+ "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2.chk" >> "$seqres.full"
+
+ case "$b2" in
+ "regular")
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "unwritten")
+ "$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x00 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "hole")
+ ;;
+ esac
+
+
+
+ case "$b4" in
+ "regular")
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "unwritten")
+ "$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ ;;
+ "hole")
+ ;;
+ esac
+
+ _reflink_range "$dir/file1" $BLKSZ "$dir/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ _scratch_remount
+
+ echo "Compare files"
+ ! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
+ cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+
+ echo "CoW and unmount"
+ if [ "$b2" = "delalloc" ]; then
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ fi
+
+ if [ "$b4" = "delalloc" ]; then
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
+ _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+ fi
+
+ "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$dir/file2" >> "$seqres.full"
+ "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$dir/file2.chk" >> "$seqres.full"
+ _scratch_remount
+
+ echo "Compare files"
+ ! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
+ cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+}
+
+runtest regular delalloc "$TESTDIR/r-d"
+runtest regular unwritten "$TESTDIR/r-u"
+runtest regular hole "$TESTDIR/r-h"
+runtest regular regular "$TESTDIR/r-r"
+
+runtest hole delalloc "$TESTDIR/h-d"
+runtest hole unwritten "$TESTDIR/h-u"
+runtest hole hole "$TESTDIR/h-h"
+runtest hole regular "$TESTDIR/h-r"
+
+runtest unwritten delalloc "$TESTDIR/u-d"
+runtest unwritten unwritten "$TESTDIR/u-u"
+runtest unwritten hole "$TESTDIR/u-h"
+runtest unwritten regular "$TESTDIR/u-r"
+
+runtest delalloc delalloc "$TESTDIR/d-d"
+runtest delalloc unwritten "$TESTDIR/d-u"
+runtest delalloc hole "$TESTDIR/d-h"
+runtest delalloc regular "$TESTDIR/d-r"
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/877.out b/tests/generic/877.out
new file mode 100644
index 0000000..b97ef2f
--- /dev/null
+++ b/tests/generic/877.out
@@ -0,0 +1,83 @@
+QA output created by 877
+Format and mount
+runtest regular delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest regular regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest hole regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest unwritten regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc delalloc
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc unwritten
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc hole
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+runtest delalloc regular
+Create the original files
+Compare files
+CoW and unmount
+Compare files
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index ea4901b..f3e3e2c 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -279,3 +279,13 @@
865 auto quick clone
866 auto quick clone
867 auto quick clone
+868 auto quick clone
+869 auto quick clone
+870 auto quick clone
+871 auto quick clone
+872 auto quick clone
+873 auto quick clone
+874 auto quick clone
+875 auto quick clone
+876 auto quick clone
+877 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/11] reflink: test a big CoW operation
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (8 preceding siblings ...)
2015-12-19 9:11 ` [PATCH 09/11] reflink: test CoW with blocksize < pagesize Darrick J. Wong
@ 2015-12-19 9:12 ` Darrick J. Wong
2015-12-19 9:12 ` [PATCH 11/11] generic: create a dedupe group Darrick J. Wong
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:12 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Test what happens when we send largeish buffers to CoW all at once.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/878 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/878.out | 13 ++++++
tests/generic/879 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/879.out | 13 ++++++
tests/generic/group | 2 +
5 files changed, 226 insertions(+)
create mode 100755 tests/generic/878
create mode 100644 tests/generic/878.out
create mode 100755 tests/generic/879
create mode 100644 tests/generic/879.out
diff --git a/tests/generic/878 b/tests/generic/878
new file mode 100755
index 0000000..342a94e
--- /dev/null
+++ b/tests/generic/878
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 878
+#
+# Reflink two large files and CoW them in big chunks.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_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=65536
+NR=6400
+BSZ=1280
+
+FREE_BLOCKS=$(stat -f -c '%a' "$TESTDIR")
+REAL_BLKSZ=$(stat -f -c '%S' "$TESTDIR")
+SPACE_NEEDED=$(((BLKSZ * NR * 3) * 5 / 4))
+SPACE_AVAIL=$((FREE_BLOCKS * REAL_BLKSZ))
+test $SPACE_NEEDED -gt $SPACE_AVAIL && _notrun "Not enough space. $SPACE_AVAIL < $SPACE_NEEDED"
+
+echo "Create the original files"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/878.out b/tests/generic/878.out
new file mode 100644
index 0000000..0da5baa
--- /dev/null
+++ b/tests/generic/878.out
@@ -0,0 +1,13 @@
+QA output created by 878
+Format and mount
+Create the original files
+Compare files
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-878/file1
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-878/file2
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-878/file2.chk
+CoW and unmount
+Compare files
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-878/file1
+c835fd53fa27b72511b250d51595c053 SCRATCH_MNT/test-878/file2
+c835fd53fa27b72511b250d51595c053 SCRATCH_MNT/test-878/file2.chk
+Check for damage
diff --git a/tests/generic/879 b/tests/generic/879
new file mode 100755
index 0000000..83be543
--- /dev/null
+++ b/tests/generic/879
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 879
+#
+# Reflink two large files and DIO CoW them in big chunks.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check 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
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_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=65536
+NR=6400
+BSZ=1280
+
+FREE_BLOCKS=$(stat -f -c '%a' "$TESTDIR")
+REAL_BLKSZ=$(stat -f -c '%S' "$TESTDIR")
+SPACE_NEEDED=$(((BLKSZ * NR * 3) * 5 / 4))
+SPACE_AVAIL=$((FREE_BLOCKS * REAL_BLKSZ))
+test $SPACE_NEEDED -gt $SPACE_AVAIL && _notrun "Not enough space. $SPACE_AVAIL < $SPACE_NEEDED"
+
+echo "Create the original files"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file1" >> "$seqres.full"
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "CoW and unmount"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+_scratch_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_scratch
+md5sum "$TESTDIR/file2" | _filter_scratch
+md5sum "$TESTDIR/file2.chk" | _filter_scratch
+
+echo "Check for damage"
+umount "$SCRATCH_MNT"
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/879.out b/tests/generic/879.out
new file mode 100644
index 0000000..fc1363a
--- /dev/null
+++ b/tests/generic/879.out
@@ -0,0 +1,13 @@
+QA output created by 879
+Format and mount
+Create the original files
+Compare files
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-879/file1
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-879/file2
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-879/file2.chk
+CoW and unmount
+Compare files
+01768a16d33c9bd21dc67a7fac006ee1 SCRATCH_MNT/test-879/file1
+c835fd53fa27b72511b250d51595c053 SCRATCH_MNT/test-879/file2
+c835fd53fa27b72511b250d51595c053 SCRATCH_MNT/test-879/file2.chk
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index f3e3e2c..68853b4 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -289,3 +289,5 @@
875 auto quick clone
876 auto quick clone
877 auto quick clone
+878 auto quick clone
+879 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/11] generic: create a dedupe group
2015-12-19 9:10 [PATCH v4 00/11] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
` (9 preceding siblings ...)
2015-12-19 9:12 ` [PATCH 10/11] reflink: test a big CoW operation Darrick J. Wong
@ 2015-12-19 9:12 ` Darrick J. Wong
10 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2015-12-19 9:12 UTC (permalink / raw)
To: david, darrick.wong; +Cc: linux-ext4, fstests, linux-btrfs, xfs
Create a group for just the deduplication tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/generic/group | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/generic/group b/tests/generic/group
index 68853b4..2c18bce 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -123,8 +123,8 @@
118 auto quick clone
119 auto quick clone
120 other auto quick
-121 auto quick clone
-122 auto quick clone
+121 auto quick clone dedupe
+122 auto quick clone dedupe
123 perms auto quick
124 pattern auto quick
125 other auto
@@ -138,8 +138,8 @@
133 rw auto
134 auto quick clone
135 metadata auto quick
-136 auto quick clone
-137 auto quick clone
+136 auto quick clone dedupe
+137 auto quick clone dedupe
138 auto quick clone
139 auto quick clone
140 auto quick clone
@@ -160,12 +160,12 @@
155 auto quick clone
156 auto quick clone
157 auto quick clone
-158 auto quick clone
+158 auto quick clone dedupe
159 auto quick clone
-160 auto quick clone
+160 auto quick clone dedupe
161 auto quick clone
-162 auto quick clone
-163 auto quick clone
+162 auto quick clone dedupe
+163 auto quick clone dedupe
164 auto quick clone
165 auto quick clone
166 auto quick clone
@@ -261,7 +261,7 @@
847 auto quick clone
848 auto quick clone
849 auto quick clone
-850 auto quick clone
+850 auto quick clone dedupe
851 auto quick clone
852 auto quick clone
853 auto quick clone
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread