-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project Quota on ZFS #6290
Project Quota on ZFS #6290
Conversation
@Nasf-Fan, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @ahrens and @tuxoko to be potential reviewers. |
@Nasf-Fan the patched failed zfstests as follows:
|
Link to the console log containing the backtraces from the kmemleak builder. |
287acff
to
8437909
Compare
@behlendorf http://build.zfsonlinux.org/builders/Ubuntu%2014.04%20x86_64%20%28TEST%29/builds/6212 Thanks! |
cmd/zpool/zpool_main.c
Outdated
@@ -6995,6 +6995,7 @@ zpool_do_upgrade(int argc, char **argv) | |||
(void) printf(gettext(" 27 Improved snapshot creation " | |||
"performance\n")); | |||
(void) printf(gettext(" 28 Multiple vdev replacements\n")); | |||
(void) printf(gettext(" 29 Project quota\n")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use feature flags instead of adding a version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
include/sys/dmu_objset.h
Outdated
sizeof (zil_header_t) - sizeof (uint64_t)*2]; | ||
dnode_phys_t os_userused_dnode; | ||
dnode_phys_t os_groupused_dnode; | ||
char os_pad1[OBJSET_PHYS_SIZE -OBJSET_PHYS_SIZE_V2 - | ||
sizeof (dnode_phys_t)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why put the padding here rather than at the end of the struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
include/sys/dmu_objset.h
Outdated
char os_pad1[OBJSET_PHYS_SIZE -OBJSET_PHYS_SIZE_V2 - | ||
sizeof (dnode_phys_t)]; | ||
/* | ||
* With os_projectused_dnode_phy introduced, the total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the _phy
here is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
module/zfs/dmu_objset.c
Outdated
|
||
ASSERT(ds == NULL || MUTEX_HELD(&ds->ds_opening_lock)); | ||
|
||
if (spa_version(spa) < SPA_VERSION_USERSPACE) | ||
size = OBJSET_PHYS_SIZE_V1; | ||
else if (spa_version(spa) < SPA_VERSION_PROJECT_QUOTA) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need to be changed to be based on the feature flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
module/zfs/dmu_objset.c
Outdated
@@ -410,11 +424,11 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, | |||
} | |||
|
|||
/* Increase the blocksize if we are permitted. */ | |||
if (spa_version(spa) >= SPA_VERSION_USERSPACE && | |||
arc_buf_size(os->os_phys_buf) < sizeof (objset_phys_t)) { | |||
if (size > OBJSET_PHYS_SIZE_V1 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when is this check needed? I would have thought that arc_buf_size() >= OBJSET_PHYS_SIZE_V1
is always true, so the 2nd check size > arc_buf_size()
is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
module/zfs/dmu_objset.c
Outdated
SPA_FEATURE_USEROBJ_ACCOUNTING] = B_TRUE; | ||
if (dmu_objset_userobjused_enabled(os)) | ||
dmu_objset_ds(os)->ds_feature_activation_needed[ | ||
SPA_FEATURE_USEROBJ_ACCOUNTING] = B_TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be worth bothering with this. If you're going to automatically do this whenever a fs is mounted, effectively it will work as you described in the manpage - it gets activated immediately and never deactivated. So we might make that technically true as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
module/zfs/zfeature_common.c
Outdated
@@ -318,4 +318,15 @@ zpool_feature_init(void) | |||
ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET, | |||
userobj_accounting_deps); | |||
} | |||
{ | |||
static const spa_feature_t project_quota_deps[] = { | |||
SPA_FEATURE_EXTENSIBLE_DATASET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this use EXTENSIBLE_DATASET?
Saw that you're doing PER_DATASET which requires this.
@@ -87,6 +88,8 @@ typedef enum zpl_attr { | |||
#define SA_UID_OFFSET 24 | |||
#define SA_GID_OFFSET 32 | |||
#define SA_PARENT_OFFSET 40 | |||
#define SA_FLAGS_OFFSET 48 | |||
#define SA_PROJID_OFFSET 128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this is actually a constant, because SA_ZPL_RDEV
is conditionally present before it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I will define two OFFSET based on whether SA_ZPL_RDEV exists or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you instead put the PROJID before RDEV?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, but maybe more affect on the existing files for upgrade case, is it OK? Then can I move it more close to UID/GID, such as just after flags attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a good idea to keep all the mandatory attrs together (i.e. MODE through LINKS).
If you're asking about zfs_sa_upgrade(), I don't see how it matters if you switch the order of RDEV and PROJID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will move the "project ID" attr just ahead of the "rdev".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this still needs to be addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follows current user/group quota framework, I have no better idea yet
I think you're saying that you can't follow my suggestion of putting PROJID before RDEV. How does that conflict with the "current user/group quota framework"?
But it looks like you've made the change I suggested, so maybe I've misunderstood? You've put PROJID between LINKS and RDEV. Is its OFFSET still 128 (I don't think so, but I don't see how your code could work if SA_PROJID_OFFSET is inaccurate).
I think we should be aware that there can be exactly one "optional, but fixed location" attribute, and it is PROJID. If another feature wants to do something similar to what you've done, they won't be able to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already put the PROJID just after the LINKS and before the RDEV. The new offset is really 128 as following:
MODE 0
SIZE 8
GEN 16
UID 24
GID 32
PARENT 40
FALGS 48
ATIME 56
MTIME 72
CTIME 88
CRTIME 104
LINKS 120
PROJID 128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not entirely clear on this. I see that in the zfs_sa_upgrade()
case PROJID will be placed after LINKS since sa_replace_all_by_template()
preserves the passed order. However, I don't see where this ordering is made the preferred default layout for new filesystems. Can you point me to the code which ensures this is true.
include/sys/zfs_znode.h
Outdated
@@ -65,6 +65,8 @@ extern "C" { | |||
#define ZFS_REPARSE 0x0000080000000000ull | |||
#define ZFS_OFFLINE 0x0000100000000000ull | |||
#define ZFS_SPARSE 0x0000200000000000ull | |||
#define ZFS_PROJINHERIT 0x0000400000000000ull | |||
#define ZFS_PROJID 0x0000800000000000ull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since these are new on disk flags, we should also reserve them upstream in illumos so that other projects are less likely to use them for something different. That said, can you explain (possibly in a comment here) what these mean exactly? How is ZFS_PROJID different from the presence of SA_ZPL_PROJID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will add comment for the new flags.
module/zfs/zfs_vnops.c
Outdated
@@ -3563,6 +3652,17 @@ zfs_rename(struct inode *sdip, char *snm, struct inode *tdip, char *tnm, | |||
} | |||
|
|||
/* | |||
* If we are using project inheritance, we only allow renames | |||
* into our tree when the project IDs are the same; otherwise | |||
* tree quota mechanism would be circumvented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the tree quota mechanism?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the ZFS_PROJINHERIT flag in set on the directory object, then we hope that all the children under the directory will belong to the same project, means the same project ID. Based on that if we want to support tree quota, for example, assume we want to limite the space used by the directory, then we can give an unique project ID to the directory and set ZFS_PROJINHERIT flag on it. And then the project quota mechanism will guarantee that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment implies that we don't just "hope" all the children will have the same project, we enforce that they do. Is that a universal requirement - if ZFS_PROJINHERIT is set on a directory, all its descendants must have the same project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether it is "requirement", but it is useful. In fact, some other filesystem, such as EXT4, has already support "tree quota" like that. Means if the ZFS_PROJINHERIT flag is set on the directory, then all its descendants will inherit its project ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're saying that today there is no "tree quota" in ZFS, but we might want to support it someday. When/if we support "tree quota", we will need to enforce that if PROJINHERIT is set, all descendants have the same project.
To make that easier to determine, would we also enforce that if PROJINHERIT is set, all descendant directories also have PROJINHERIT set? That way if we are renaming a directory, if the new parent dir has PROJINHERIT, the dir that we're renaming must have the same PROJID and also have PROJINHERIT set (to ensure that all its descendants also have that projid).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, the current implementation is just as you expected. Means if the directory has PROJINHERIT set, then its descendant directories will inherit not only the project ID, but also the PROJINHERIT flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. In that case can you reword this comment, since this restriction (of PROJINHERIT being also force-inherited) applies all the time, not just for the (non-existent) tree quota. It seems like the PROJINHERIT flag is potentially useful even in the absence of tree quota, since it allows you to force a directory and everything below it to be assigned to the same project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@Nasf-Fan yes actually, I've resubmitted that test. |
@ahrens @behlendorf |
module/zfs/zfs_vnops.c
Outdated
attrzp->z_projid = projid; | ||
SA_ADD_BULK_ATTR(xattr_bulk, xattr_count, | ||
SA_ZPL_PROJID(zfsvfs), NULL, &attrzp->z_projid, | ||
sizeof (attrzp->z_projid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you ensure that this lands at SA_PROJID_OFFSET
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question!
I need more handle here: if the object has no PROJID flag, then it should be existing file that is not upgraded yet, so we need to handle it as zfs_sa_upgrade() does. Does it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but probably something like that (reformatting the whole SA) would work. You'd need to handle other optional attributes that aren't in the legacy layout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
module/zfs/zfs_vnops.c
Outdated
zp->z_projid = projid; | ||
SA_ADD_BULK_ATTR(bulk, count, | ||
SA_ZPL_PROJID(zfsvfs), NULL, &zp->z_projid, | ||
sizeof (zp->z_projid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you ensure that this lands at SA_PROJID_OFFSET
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has been resolved via sa_add_projid
@@ -87,6 +88,8 @@ typedef enum zpl_attr { | |||
#define SA_UID_OFFSET 24 | |||
#define SA_GID_OFFSET 32 | |||
#define SA_PARENT_OFFSET 40 | |||
#define SA_FLAGS_OFFSET 48 | |||
#define SA_PROJID_OFFSET 128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a good idea to keep all the mandatory attrs together (i.e. MODE through LINKS).
If you're asking about zfs_sa_upgrade(), I don't see how it matters if you switch the order of RDEV and PROJID.
d65bd78
to
347d3ae
Compare
16e8d2f
to
0fe0590
Compare
As you can see, there are still some build/test failures in my latest commit (1 errored, 8 failing, and 15 successful checks). I do not think all of them are caused by my changes. I have checked some other recent patches, similar build/test failures. I suspect that there are some common build/test issues on current ZOL community branch. Is there any ZOL master test/build results that can be used for the comparison? then I can clearly know whether any test failures are special in my patch and need to be further investigated. Thanks! |
1792dc0
to
ca5e2d6
Compare
@Nasf-Fan sorry about the recent rash of unrelated test failures. We expect to have largely under control in the next day or so. Then if you rebase on master you should get a cleaner test run. Thanks for your patience! |
Understood. Thanks! |
dee2d24
to
d55e523
Compare
ztest failed on CentOS 7 x86_64 and CentOS 7 x86_64 Mainline, but I do not think it is project quota patch caused such trouble. @behlendorf , would you please to help to re-trigger the two tests? Thanks! |
c1c78eb
to
157bd55
Compare
Codecov Report
@@ Coverage Diff @@
## master #6290 +/- ##
==========================================
+ Coverage 76.13% 76.53% +0.39%
==========================================
Files 324 327 +3
Lines 103013 103765 +752
==========================================
+ Hits 78432 79418 +986
+ Misses 24581 24347 -234
Continue to review full report at Codecov.
|
http://build.zfsonlinux.org/builders/Ubuntu%2017.10%20x86_64%20%28TEST%29/builds/188 |
@Nasf-Fan resubmitted Ubuntu 17.10, that's a known failure almost certainly due to a flaw in the test case. |
Thanks @behlendorf ! |
Looks good to me. I confirmed directory-based xattr issues are fixed. I think we can clean up documentation and UI issues in follow-up patches. If I could suggest one change prior to merging, I'd like diff --git a/cmd/zfs/zfs_project.c b/cmd/zfs/zfs_project.c
index 99b4e1a..2510a42 100644
--- a/cmd/zfs/zfs_project.c
+++ b/cmd/zfs/zfs_project.c
@@ -277,9 +277,12 @@ zfs_project_handle(const char *name, zfs_project_control_t *zpc)
zpc->zpc_ignore_noent = B_FALSE;
if (zpc->zpc_op == ZFS_PROJECT_OP_SET ||
zpc->zpc_op == ZFS_PROJECT_OP_CLEAR ||
- !S_ISDIR(st.st_mode) || zpc->zpc_dironly) {
+ zpc->zpc_op == ZFS_PROJECT_OP_LIST) {
ret = zfs_project_handle_one(name, zpc);
- if (ret || !zpc->zpc_recursive)
+ if (ret ||
+ (!S_ISDIR(st.st_mode) || zpc->zpc_dironly) ||
+ (!zpc->zpc_recursive &&
+ (zpc->zpc_op != ZFS_PROJECT_OP_LIST)))
return (ret);
} |
157bd55
to
29f8613
Compare
Update the patch as nedbass suggested and resolve merge conflict issues. |
@Nasf-Fan with your latest change, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked as expected for me in my local testing. If you can address the few nits I mentioned and the issue @nedbass found then this should be good to go. Thanks!
@@ -199,6 +204,9 @@ static zfs_command_t command_table[] = { | |||
{ "upgrade", zfs_do_upgrade, HELP_UPGRADE }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for readability let's add a blank line after upgrade
and before userspace
.
man/man8/zfs.8
Outdated
Clear project inherit flag and/or ID on the file(s) or directories. | ||
.Bl -tag -width "-k" | ||
.It Fl k | ||
Keep the porject ID unchanged. If not specified, the project ID will be reset as zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/porject/project
cmd/zfs/zfs_main.c
Outdated
* | ||
* 2) zfs project -C [-k] [-r] <file|directory ...> | ||
* Clear project inherit flag and/or ID on the file(s) or directories. | ||
* -k: Keep the porject ID unchanged. If not specified, the project ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/porject/project
man/man8/zfs.8
Outdated
.Cm project | ||
.Op Fl p Ar id | ||
.Oo Fl r Ns Oc | ||
.Oo Fl s Ns Oc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: For flags which aren't mutually exclusive, or require additional arguments, they should be grouped together.
.Oo Fl rs Ns Oc
man/man8/zfs.8
Outdated
.Cm project | ||
.Fl C | ||
.Oo Fl k Ns Oc | ||
.Oo Fl r Ns Oc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: For flags which aren't mutually exclusive, or require additional arguments, they should be grouped together. You'll want to get this instance and the ones below.
Oo Fl kr Ns Oc
man/man8/zfs.8
Outdated
@@ -905,6 +935,50 @@ The root user, or a user who has been granted the | |||
privilege with | |||
.Nm zfs Cm allow , | |||
can access all groups' usage. | |||
.It Sy projectused Ns @ Ns Em project | |||
The amount of space consumed by the specified project in this dataset. Project is identified via the project identifier (ID) that is object-based numeral attribute. An object can inherit the project ID from its parent object (if the parent has the flag of inherit project ID that can be set and changed via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please wrap all new lines at 80 character like the rest of the man page.
man/man8/zfs.8
Outdated
List project identifier (ID) and inherit flag of file(s) or directories. | ||
.Bl -tag -width "-d" | ||
.It Fl d | ||
Show the directory its own project ID and inherit flag, not its children's. It will overwrite the former specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/Show the directory its own project ID and inherit flag, not its children's./Show the directory project ID and inherit flag, not its childrens./
man/man8/zfs.8
Outdated
.It Fl 0 | ||
Print file name with a trailing NUL instead of newline (by default), like "find -print0". | ||
.It Fl d | ||
Check the directory its own project ID and inherit flag, not its children's. It will overwrite the former specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/Check the directory its own project ID and inherit flag, not its children's/Check the directory project ID and inherit flag, not its childrens
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Signed-off-by: Fan Yong <fan.yong@intel.com> Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c
ce46a31
to
1fa7455
Compare
Addressed the latest issues mentioned by behlendorf and nedbass. |
Thanks @behlendorf and all the patch viewers! |
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290 vpsFree.cz Porting Notes dnodes physically contain ZIO_OBJSET_MAC_LEN cause of 0.8.0
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290 vpsFree.cz Porting Notes dnodes physically contain ZIO_OBJSET_MAC_LEN cause of 0.8.0
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290 vpsFree.cz Porting Notes dnodes physically contain ZIO_OBJSET_MAC_LEN cause of 0.8.0
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290
Project quota is a new ZFS system space/object usage accounting and enforcement mechanism. Similar as user/group quota, project quota is another dimension of system quota. It bases on the new object attribute - project ID. Project ID is a numerical value to indicate to which project an object belongs. An object only can belong to one project though you (the object owner or privileged user) can change the object project ID via 'chattr -p' or 'zfs project [-s] -p' explicitly. The object also can inherit the project ID from its parent when created if the parent has the project inherit flag (that can be set via 'chattr +P' or 'zfs project -s [-p]'). By accounting the spaces/objects belong to the same project, we can know how many spaces/objects used by the project. And if we set the upper limit then we can control the spaces/objects that are consumed by such project. It is useful when multiple groups and users cooperate for the same project, or a user/group needs to participate in multiple projects. Support the following commands and functionalities: zfs set projectquota@project zfs set projectobjquota@project zfs get projectquota@project zfs get projectobjquota@project zfs get projectused@project zfs get projectobjused@project zfs projectspace zfs allow projectquota zfs allow projectobjquota zfs allow projectused zfs allow projectobjused zfs unallow projectquota zfs unallow projectobjquota zfs unallow projectused zfs unallow projectobjused chattr +/-P chattr -p project_id lsattr -p This patch also supports tree quota based on the project quota via "zfs project" commands set as following: zfs project [-d|-r] <file|directory ...> zfs project -C [-k] [-r] <file|directory ...> zfs project -c [-0] [-d|-r] [-p id] <file|directory ...> zfs project [-p id] [-r] [-s] <file|directory ...> For "df [-i] $DIR" command, if we set INHERIT (project ID) flag on the $DIR, then the proejct [obj]quota and [obj]used values for the $DIR's project ID will be shown as the total/free (avail) resource. Keep the same behavior as EXT4/XFS does. Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by Ned Bass <bass6@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fan Yong <fan.yong@intel.com> TEST_ZIMPORT_POOLS="zol-0.6.1 zol-0.6.2 master" Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c Closes openzfs#6290
Project quota is a new ZFS system space/object usage accounting
and enforcement mechanism. Similar as user/group quota, project
quota is another dimension of system quota. It bases on the new
object attribute - project ID.
Project ID is a numerical value to indicate to which project an
object belongs. An object only can belong to one project though
you (the object owner or privileged user) can change the object
project ID that can be set/modified via 'chattr -p' explicitly,
or inherited from its parent object when created if such parent
has the project inherit flag (via 'chattr +P').
By accounting the spaces/objects belong to the same project, we
can know how many spaces/objects used by the project. And if we
set the upper limit then we can control the spaces/objects that
are consumed by such project. It is useful when multiple groups
and users cooperate for the same project, or when an user/group
needs to participate in multiple projects.
Support the following commands and functionalities:
zfs set projectquota@project
zfs set projectobjquota@project
zfs get projectquota@project
zfs get projectobjquota@project
zfs get projectused@project
zfs get projectobjused@project
zfs projectspace
zfs allow projectquota
zfs allow projectobjquota
zfs allow projectused
zfs allow projectobjused
zfs unallow projectquota
zfs unallow projectobjquota
zfs unallow projectused
zfs unallow projectobjused
chattr +/-P
chattr -p project_id
lsattr -p
Signed-off-by: Fan Yong fan.yong@intel.com
Change-Id: Ib4f0544602e03fb61fd46a849d7ba51a6005693c
Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.