]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vfs_vnops.c: Fix blksize for ZFS
authorRick Macklem <rmacklem@FreeBSD.org>
Thu, 17 Nov 2022 01:37:22 +0000 (17:37 -0800)
committerRick Macklem <rmacklem@FreeBSD.org>
Thu, 17 Nov 2022 01:37:22 +0000 (17:37 -0800)
commit4ee16246f97825e893e0a4a4499d1bbe5bc07b6a
tree9d910fe186c1ac2fbfaf9df02c767c9058cbc27f
parent5d42ef55dec1a8bef758b84905a9b953f86efd8d
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
sys/kern/vfs_vnops.c