HomeFreeBSD

Clip the "len" argument to vn_generic_copy_file_range() at a

Description

Clip the "len" argument to vn_generic_copy_file_range() at a
hole size boundary.

By clipping the len argument of vn_generic_copy_file_range() to end at
an exact multiple of hole size, holes are more likely to be maintained
during the copy.
A hole can still straddle the boundary at the end of the
copy range, resulting in a block being allocated in the
output file as it is being grown in size, but this will reduce the
likelyhood of this happening.

While here, also modify setting of blksize to better handle the
case where _PC_MIN_HOLE_SIZE is returned as 1.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D26570

Details

Provenance
rmacklemAuthored on
Reviewer
asomers
Differential Revision
D26570: clip the len being copied by copy_file_range() to an exact multiple of hole size
Parents
rS366301: MFS r365996:
Branches
Unknown
Tags
Unknown