Skip to content

gfile: Support copy_file_range() for file copies

Philip Withnall requested to merge pwithnall/glib:2863-copy-file-range into main

While it can’t be used in all situations, it is a little bit faster than splice() in some situations, basically if the file system supports copy on write. In other situations it’s no slower than splice().

See man copy_file_range for the situations where it doesn’t work. In all of these situations, it will return an error, and the GLib code will fall through and try the existing splice() copy code instead.

From my testing of time gio copy A B with a 9GB file, the splice() code path takes 22s, and the copy_file_range() code path takes 20s.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Fixes: #2863 (closed)

Closes #2863 (closed)

Merge request reports