mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 10:44:09 +03:00
FreeBSD: Implement hole-punching support
This adds supports for hole-punching facilities in the FreeBSD kernel starting from __FreeBSD_version 1400032. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ka Ho Ng <khng@FreeBSD.org> Sponsored-by: The FreeBSD Foundation Closes #12458
This commit is contained in:
committed by
Brian Behlendorf
parent
70bf547a98
commit
f3bbeb970e
@@ -1476,12 +1476,16 @@ zfs_free_range(znode_t *zp, uint64_t off, uint64_t len)
|
||||
error = dmu_free_long_range(zfsvfs->z_os, zp->z_id, off, len);
|
||||
|
||||
if (error == 0) {
|
||||
#if __FreeBSD_version >= 1400032
|
||||
vnode_pager_purge_range(ZTOV(zp), off, off + len);
|
||||
#else
|
||||
/*
|
||||
* In FreeBSD we cannot free block in the middle of a file,
|
||||
* but only at the end of a file, so this code path should
|
||||
* never happen.
|
||||
* Before __FreeBSD_version 1400032 we cannot free block in the
|
||||
* middle of a file, but only at the end of a file, so this code
|
||||
* path should never happen.
|
||||
*/
|
||||
vnode_pager_setsize(ZTOV(zp), off);
|
||||
#endif
|
||||
}
|
||||
|
||||
zfs_rangelock_exit(lr);
|
||||
|
||||
Reference in New Issue
Block a user