On 2015-10-16 08:21, Christoph Hellwig wrote:
On Fri, Oct 16, 2015 at 07:46:41AM -0400, Austin S Hemmelgarn wrote:
quoted
I should have been specific, what I meant was that some people will assume
that it actually creates a physical, on-disk byte-for-byte copy of the data.
There are many people out there (and sadly I have to deal with some at work)
who are absolutely terrified of the concept of data deduplication, and will
likely refuse to use this syscall for _anything_ if it reflinks by default
on filesystems that support it.
If they use a file system that supports COW or dedup they are toast
already. It's not the system call that does the 'dedup', it's the file
system or storage device, that's where they need to set their
preferences.
BTRFS is COW and supports deduplication, it does _absolutely zero_
reflinking and/or deduplication unless you explicitly tell it to do so.
Likewise, ZFS is COW and supports deduplication, it also does
_absolutely zero_ reflinking and/or deduplication unless you tell it to
(note that in-band deduplication is off by default on ZFS). AFAIK, XFS
will not automatically reflink instead of copying either (and if it does
decide to do it automatically, that will just be something else to add
to the list of why I will never use it on any of my systems). OCFS2
supports reflinks (although not many people know this, and I think it
implements them slightly differently from BTRFS/ZFS/XFS) and yet again,
does _absolutely zero_ reflinking unless you tell it to. Based on this,
it is in no way the filesystem that does the deduplication and
reflinking, it only handles the implementation and provides the option
to the user to do it.
Certain parts of userspace do try to reflink things instead of copying
(for example, coreutils recently started doing so in mv and has had the
option to do so with cp for a while now), but a properly designed
general purpose filesystem does not and should not do this without the
user telling it to do so.