mirror of
https://github.com/boostorg/filesystem.git
synced 2026-01-23 05:32:09 +00:00
Use Linux fallocate system call to preallocate storage for the target file in copy_file backends based on sendfile and copy_file_range. These backends are only used when the file size is known beforehand, and preallocating storage allows to reduce filesystem fragmentation and get an early error if there's not enough free space on the target filesystem. Preallocation is only done as an optimization/hint. On filesystems that do not support it we continue the data copying process as before. This is why we aren't using posix_fallocate, because glibc contains an emulation path that is used when the filesystem doesn't support the functionality. We don't want this emulation, as it would effectively double the amount of written data.
514 B
514 B