_notrun "This test requires a cp with --reflink support."
}
+# Can we reflink between arbitrary file sets?
+# i.e. if we reflink a->b and c->d, can we later share
+# blocks between b & c?
+_require_arbitrary_fileset_reflink()
+{
+ test "$FSTYP" = "ocfs2" && \
+ _notrun "reflink between arbitrary file groups not supported in $FSTYP"
+}
+
# Given 2 files, verify that they have the same mapping but different
# inodes - i.e. an undisturbed reflink
# Silent if so, make noise if not
_require_scratch_explicit_shared_extents()
{
_require_scratch
- _require_fiemap
+ _require_xfs_io_command "fiemap"
_require_scratch_reflink
_require_xfs_io_command "reflink"
local nr_extents
file1="$1"
file2="$2"
- cp --reflink=always -p "$file1" "$file2"
+ cp --reflink=always -p -f "$file1" "$file2"
}
# Reflink some file1 into file2
$XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
}
+# Unify xfs_io dedupe ioctl error message prefix
+_filter_dedupe_error()
+{
+ sed -e 's/^dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g'
+}
+
# Create a file of interleaved unwritten and reflinked blocks
_weave_reflink_unwritten() {
blksz=$1