Skip to content
Snippets Groups Projects
  • Colin Walters's avatar
    d18f026e
    fdio: Merge systemd code to use copy_file_range(), use FICLONE · d18f026e
    Colin Walters authored
    FICLONE is the new alias for the formerly btrfs-specific ioctl; XFS
    has experimental patches to support it.
    
    Further, we should use copy_file_range() for the case where we're only doing a
    limited copy. Both NFS and XFS (with reflink enabled) understand it.
    
    Part of the reason I'm doing this is so that ostree's `/etc` merge will start
    using XFS reflinks. But another major reason is to take the next step after and
    copy this code into GLib as well, so that all of the general GLib users will
    benefit; e.g. Nautilus will transparently do server copy offloads with NFS home
    directories.
    
    See also this coreutils thread about `copy_file_range()`:
    <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24399>. I don't care about file
    holes for our use cases, so it's fine.
    
    Other changes while I'm here:
     - Tweak the sendfile() case to match the newly inlined logic for cfr
     - Add a TEMP_FAILURE_RETRY() around the read()
    d18f026e
    History
    fdio: Merge systemd code to use copy_file_range(), use FICLONE
    Colin Walters authored
    FICLONE is the new alias for the formerly btrfs-specific ioctl; XFS
    has experimental patches to support it.
    
    Further, we should use copy_file_range() for the case where we're only doing a
    limited copy. Both NFS and XFS (with reflink enabled) understand it.
    
    Part of the reason I'm doing this is so that ostree's `/etc` merge will start
    using XFS reflinks. But another major reason is to take the next step after and
    copy this code into GLib as well, so that all of the general GLib users will
    benefit; e.g. Nautilus will transparently do server copy offloads with NFS home
    directories.
    
    See also this coreutils thread about `copy_file_range()`:
    <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24399>. I don't care about file
    holes for our use cases, so it's fine.
    
    Other changes while I'm here:
     - Tweak the sendfile() case to match the newly inlined logic for cfr
     - Add a TEMP_FAILURE_RETRY() around the read()