mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add support for user/group dnode accounting & quota
This patch tracks dnode usage for each user/group in the DMU_USER/GROUPUSED_OBJECT ZAPs. ZAP entries dedicated to dnode accounting have the key prefixed with "obj-" followed by the UID/GID in string format (as done for the block accounting). A new SPA feature has been added for dnode accounting as well as a new ZPL version. The SPA feature must be enabled in the pool before upgrading the zfs filesystem. During the zfs version upgrade, a "quotacheck" will be executed by marking all dnode as dirty. ZoL-bug-id: https://github.com/zfsonlinux/zfs/issues/3500 Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com> Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
This commit is contained in:
committed by
Brian Behlendorf
parent
af322debaa
commit
1de321e626
@@ -944,7 +944,9 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
||||
}
|
||||
|
||||
if (uqtype != ZFS_PROP_USERQUOTA &&
|
||||
uqtype != ZFS_PROP_GROUPQUOTA) {
|
||||
uqtype != ZFS_PROP_GROUPQUOTA &&
|
||||
uqtype != ZFS_PROP_USEROBJQUOTA &&
|
||||
uqtype != ZFS_PROP_GROUPOBJQUOTA) {
|
||||
zfs_error_aux(hdl,
|
||||
dgettext(TEXT_DOMAIN, "'%s' is readonly"),
|
||||
propname);
|
||||
@@ -2741,8 +2743,12 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
|
||||
return (EINVAL);
|
||||
*typep = type;
|
||||
|
||||
isuser = (type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_USERUSED);
|
||||
isgroup = (type == ZFS_PROP_GROUPQUOTA || type == ZFS_PROP_GROUPUSED);
|
||||
isuser = (type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_USERUSED ||
|
||||
type == ZFS_PROP_USEROBJQUOTA ||
|
||||
type == ZFS_PROP_USEROBJUSED);
|
||||
isgroup = (type == ZFS_PROP_GROUPQUOTA || type == ZFS_PROP_GROUPUSED ||
|
||||
type == ZFS_PROP_GROUPOBJQUOTA ||
|
||||
type == ZFS_PROP_GROUPOBJUSED);
|
||||
|
||||
cp = strchr(propname, '@') + 1;
|
||||
|
||||
@@ -2875,7 +2881,8 @@ zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname,
|
||||
(void) snprintf(propbuf, proplen, "%llu",
|
||||
(u_longlong_t)propvalue);
|
||||
} else if (propvalue == 0 &&
|
||||
(type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_GROUPQUOTA)) {
|
||||
(type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_GROUPQUOTA ||
|
||||
type == ZFS_PROP_USEROBJQUOTA || type == ZFS_PROP_GROUPOBJQUOTA)) {
|
||||
(void) strlcpy(propbuf, "none", proplen);
|
||||
} else {
|
||||
zfs_nicenum(propvalue, propbuf, proplen);
|
||||
@@ -4333,6 +4340,13 @@ zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
|
||||
if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) {
|
||||
char errbuf[1024];
|
||||
|
||||
if ((errno == ENOTSUP &&
|
||||
(type == ZFS_PROP_USEROBJUSED ||
|
||||
type == ZFS_PROP_GROUPOBJUSED ||
|
||||
type == ZFS_PROP_USEROBJQUOTA ||
|
||||
type == ZFS_PROP_GROUPOBJQUOTA)))
|
||||
break;
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf),
|
||||
dgettext(TEXT_DOMAIN,
|
||||
"cannot get used/quota for %s"), zc.zc_name);
|
||||
|
||||
Reference in New Issue
Block a user