From 0426a4047fa910daa0e8902ca8ccbb3d982645d8 Mon Sep 17 00:00:00 2001 From: Todd Seidelmann <18294602+seidelma@users.noreply.github.com> Date: Sat, 3 Aug 2024 16:28:16 -0700 Subject: [PATCH] Implement defaultuserquota/defaultgroupquota on FreeBSD Signed-off-by: Todd Seidelmann --- include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 2 ++ module/os/freebsd/zfs/zfs_vfsops.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index 7f0f24325d59..daa39ee8dc36 100644 --- a/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -113,6 +113,8 @@ struct zfsvfs { uint64_t z_groupobjquota_obj; uint64_t z_projectquota_obj; uint64_t z_projectobjquota_obj; + uint64_t z_defaultuserquota_obj; + uint64_t z_defaultgroupquota_obj; uint64_t z_replay_eof; /* New end of file - replay only */ sa_attr_type_t *z_attr_table; /* SA attr mapping->id */ #define ZFS_OBJ_MTX_SZ 64 diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c index a972c720dfdb..6f191693e40e 100644 --- a/module/os/freebsd/zfs/zfs_vfsops.c +++ b/module/os/freebsd/zfs/zfs_vfsops.c @@ -924,6 +924,22 @@ zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) else if (error != 0) return (error); + error = zap_lookup(os, MASTER_NODE_OBJ, + zfs_prop_to_name(ZFS_PROP_DEFAULTUSERQUOTA), + 8, 1, &zfsvfs->z_defaultuserquota_obj); + if (error == ENOENT) + zfsvfs->z_defaultuserquota_obj = 0; + else if (error != 0) + return (error); + + error = zap_lookup(os, MASTER_NODE_OBJ, + zfs_prop_to_name(ZFS_PROP_DEFAULTGROUPQUOTA), + 8, 1, &zfsvfs->z_defaultgroupquota_obj); + if (error == ENOENT) + zfsvfs->z_defaultgroupquota_obj = 0; + else if (error != 0) + return (error); + error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_FUID_TABLES, 8, 1, &zfsvfs->z_fuid_obj); if (error == ENOENT)