• Nirbheek Chauhan's avatar
    GFile: Add Btrfs clone ioctl support · 5eba9784
    Nirbheek Chauhan authored
    The attached patch adds support for the btrfs "clone" ioctl which
    makes Copy-on-Write reflinks, resulting in cheap O(1) copies when
    source/destination are on the same filesystem. The ioctl itself is
    quite straightforward, and GNU coreutils has had support since 7.5
    (--reflink=auto --sparse=auto).
    
    The ioctl only operates on regular files and symlinks, and always
    follows symlinks; checks have been added accordingly.
    
    This patch would be very useful for everyone who uses btrfs
    filesystems (Meego folks for instance). On systems that don't have
    btrfs, or if the the source is not on a btrfs filesystem, the ioctl
    returns EINVAL, and the fallback code is triggered. Hence this will
    cause no problems for non-btrfs users.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626497
    5eba9784
gfile.c 245 KB