diff options
author | Ka Ho Ng <[email protected]> | 2021-08-04 23:57:48 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-08-30 13:33:30 -0700 |
commit | f3bbeb970e03cfc8e7b2d90702e3f471668b3ef8 (patch) | |
tree | 4167549e8cd4a0be6b1af1a88d1fd7bb33d83ee9 /module/os/freebsd/zfs/zfs_znode.c | |
parent | 70bf547a98ab17262c5b9908b2c8b814d518ac18 (diff) |
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 <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Ka Ho Ng <[email protected]>
Sponsored-by: The FreeBSD Foundation
Closes #12458
Diffstat (limited to 'module/os/freebsd/zfs/zfs_znode.c')
-rw-r--r-- | module/os/freebsd/zfs/zfs_znode.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c index 6a59c0eae..9b48dcda1 100644 --- a/module/os/freebsd/zfs/zfs_znode.c +++ b/module/os/freebsd/zfs/zfs_znode.c @@ -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); |