juicefs
juicefs copied to clipboard
support cp --reflink
cp --reflink
is used to create a clone of file without copying the data, similar to copy_file_range, but using ioctl().
Here is output from strace cp --reflink a b
open("a", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=10615232, ...}) = 0
open("b", O_WRONLY|O_TRUNC) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EOPNOTSUPP (Operation not supported)
cp --reflink might be more complex, it can support directory level fast cp.
It's mainly a feature of btrfs, zfs and xfs(recent version).
Or more precisely, a directory level snapshot (read only could be enough)
But even the support of file level "cp --reflink" is also much better than cp in object storage ;-)