HomeFreeBSD

vfs_vnops.c: Use va_bytes >= va_size hint to avoid SEEK_DATA/SEEKHOLE

Description

vfs_vnops.c: Use va_bytes >= va_size hint to avoid SEEK_DATA/SEEKHOLE

vn_generic_copy_file_range() tries to maintain holes
in file ranges being copied, using SEEK_DATA/SEEK_HOLE
where possible.

Unfortunately SEEK_DATA/SEEK_HOLE operations can take
a long time under certain circumstances.
Although it is not currently possible to know if a file has
unallocated data regions, the case where va_bytes >= va_size
is a strong hint that there are no unallocated data regions.
This hint does not work well for file systems doing compression,
but since it is only a hint, it is still useful.

For the case of va_bytes >= va_size, avoid doing SEEK_DATA/SEEK_HOLE.

(cherry picked from commit 89f1dcb3eb468e4cbaebd1ccde9a643d85f1282e)

Details

Provenance
rmacklemAuthored on Mar 15 2024, 12:35 AM
Parents
rGf13afa7f5478: cdevpriv(9): document devfs_foreach_cdevpriv()
Branches
Unknown
Tags
Unknown