Skip to content

Commit 4174951

Browse files
committed
FreeBSD: Return 1 for _PC_MIN_HOLE_SIZE
The actual minimum hole size on ZFS is variable, but we always report SPA_MINBLOCKSIZE, which is 512. This may lead applications to believe that they can reliably create holes at 512-byte boundaries and waste resources trying to punch holes that ZFS ends up filling anyway. It is better to return 1 instead, as explained in pathconf(3): A special value of 1 is returned if the file system does not specify the minimum hole size but still reports holes. Signed-off-by: Dag-Erling Smørgrav <[email protected]>
1 parent f65321e commit 4174951

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

module/os/freebsd/zfs/zfs_ctldir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ zfsctl_common_pathconf(struct vop_pathconf_args *ap)
760760
return (0);
761761

762762
case _PC_MIN_HOLE_SIZE:
763-
*ap->a_retval = (int)SPA_MINBLOCKSIZE;
763+
*ap->a_retval = 1;
764764
return (0);
765765

766766
case _PC_ACL_EXTENDED:

module/os/freebsd/zfs/zfs_vnops_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4122,7 +4122,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
41224122
*valp = 64;
41234123
return (0);
41244124
case _PC_MIN_HOLE_SIZE:
4125-
*valp = (int)SPA_MINBLOCKSIZE;
4125+
*valp = 1;
41264126
return (0);
41274127
case _PC_ACL_EXTENDED:
41284128
#if 0 /* POSIX ACLs are not implemented for ZFS on FreeBSD yet. */

0 commit comments

Comments
 (0)