HomeFreeBSD

vfs_vnops.c: Fix blksize for ZFS

Description

vfs_vnops.c: Fix blksize for ZFS

Since ZFS reports _PC_MIN_HOLE_SIZE as 512 (although it
appears that an unwritten region must be at least f_iosize
to remain unallocated), vn_generic_copy_file_range()
uses 4096 for the copy blksize for ZFS, reulting in slow copies.

For most other file systems, _PC_MIN_HOLE_SIZE and f_iosize
are the same value, so this patch modifies the code to
use f_iosize for most cases. It also documents in comments
why the blksize is being set a certain way, so that the code
does not appear to be doing "magic math".

Reported by: allanjude
Reviewed by: allanjude, asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37076

Details

Provenance
rmacklemAuthored on Nov 17 2022, 1:37 AM
Reviewer
allanjude
Differential Revision
D37076: Fix blksize selection in vn_generic_copy_file_range() for ZFS
Parents
rG5d42ef55dec1: zfs: workaround panic on rootfs mount
Branches
Unknown
Tags
Unknown