[Bug 3979] Use reflink for fast cross filesystem copy and rename

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue Jul 14 22:43:45 AEST 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3979

--- Comment #3 from Darren Moffat <darren.moffat at oracle.com> ---
Reflink isn't a macro it is defined in <unistd.h> as:

#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
extern int reflink(const char *, const char *, int);
extern int reflinkat(int, const char *, int, const char *, int, int);

A proper patch would have reflink detection hooked into configure and
use a guard something like HAVE_REFLINK.


relink might not be in Illumos or FreeBSD, it was added to Solaris
11.4.  You can get a fairly recent Solaris 11.4 CBE release see:
https://blogs.oracle.com/solaris/whats-new-in-the-oracle-solaris-11481-cbe-release

reflink is available on Linux kernels as well:
https://lwn.net/Articles/331808/

reflink is atomic like link(2) is - at least on Solaris and ZFS.


Based on what you have said about copy-data, reflink isn't a good fit
for it after all.  reflink can only copy the whole file. My apologies
for sending a patch I thought I had tested that couldn't possibly have
worked.

There is a possible speed up in copy-data by using sendfile(2).

Maybe the only way to use reflink() for fast copy is via a new
extension because the client would need to send just the file names.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list