]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
copy_file_range(2): improve copying of a large hole to EOF
authorRick Macklem <rmacklem@FreeBSD.org>
Sun, 2 May 2021 23:04:27 +0000 (16:04 -0700)
committerRick Macklem <rmacklem@FreeBSD.org>
Sun, 16 May 2021 23:48:06 +0000 (16:48 -0700)
commitcd192185662ef90f52614ea17cb739f5047d5e0c
tree061741ac44aa0c55356a18314e6d28fb07358476
parent3f5f4078b371b919f1a0d6096d91a7c103a23b7d
copy_file_range(2): improve copying of a large hole to EOF

PR#255523 reported that a file copy for a file with a large hole
to EOF on ZFS ran slowly over NFSv4.2.
The problem was that vn_generic_copy_file_range() would
loop around reading the hole's data and then see it is all
0s. It was coded this way since UFS always allocates a data
block near the end of the file, such that a hole to EOF never exists.

This patch modifies vn_generic_copy_file_range() to check for a
ENXIO returned from VOP_IOCTL(..FIOSEEKDATA..) and handle that
case as a hole to EOF. asomers@ confirms that it works for his
ZFS test case.

PR: 255523

(cherry picked from commit 4f592683c356379c5bac56b52807ed4ad54ee647)
sys/kern/vfs_vnops.c