Skip to content

Commit b900b11

Browse files
committed
zfs_vnops_os.c: Add support for the _PC_CLONE_BLKSIZE name
FreeBSD now has a pathconf name called _PC_CLONE_BLKSIZE which is the block size supported for block cloning for the file system. Since ZFS's block size varies per file, return the largest size possible, or zero if block cloning is not supported. Signed-off-by: Rick Macklem <[email protected]>
1 parent f65321e commit b900b11

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

module/os/freebsd/zfs/zfs_vnops_os.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5727,6 +5727,9 @@ zfs_freebsd_pathconf(struct vop_pathconf_args *ap)
57275727
{
57285728
ulong_t val;
57295729
int error;
5730+
#ifdef _PC_CLONE_BLKSIZE
5731+
zfsvfs_t *zfsvfs;
5732+
#endif
57305733

57315734
error = zfs_pathconf(ap->a_vp, ap->a_name, &val,
57325735
curthread->td_ucred, NULL);
@@ -5772,6 +5775,17 @@ zfs_freebsd_pathconf(struct vop_pathconf_args *ap)
57725775
case _PC_HAS_HIDDENSYSTEM:
57735776
*ap->a_retval = 1;
57745777
return (0);
5778+
#endif
5779+
#ifdef _PC_CLONE_BLKSIZE
5780+
case _PC_CLONE_BLKSIZE:
5781+
zfsvfs = (zfsvfs_t *)ap->a_vp->v_mount->mnt_data;
5782+
if (zfs_bclone_enabled &&
5783+
spa_feature_is_enabled(dmu_objset_spa(zfsvfs->z_os),
5784+
SPA_FEATURE_BLOCK_CLONING))
5785+
*ap->a_retval = zfs_max_recordsize;
5786+
else
5787+
*ap->a_retval = 0;
5788+
return (0);
57755789
#endif
57765790
default:
57775791
return (vop_stdpathconf(ap));

0 commit comments

Comments
 (0)