Hi All,
Below is the design for 'GlusterFS User and Group Quotas', please provide your feedback on the same.
Developers:
Vijaikumar.M and Manikandan.S
Introduction:
User and Group quotas is to limit the amount of disk space for a
specified user/group ID.
This documents provides some details about how the accounting (marker xlator) can be done
for user and group quotas
Design:
We have three different approaches, each has pros and cons
Approach-1)
T1 - For each file/dir 'file_x', create a contribution extended attribute say 'trusted.glusterfs.quota.<uid>-contri'
T2 - In a lookup/write operation read the actual size from the stat-buf, add the delta size to the contribution xattr
T3 - Create a file .glusterfs/quota/users/<uid>.
Update size extended attribute say 'trusted.glusterfs.quota.size' by adding the delta size calculated in T2
Same for group quotas a size xattr is updated under .glusterfs/quota/groups/<gid>.
cons:
If the brick crashes after executing T2 and before T3. Now accounting information is in-correct.
To recover and correct the accounting information, entire file-systems needs to be crawled to fix the trusted.glusterfs.quota.size
value by summing up the contribution of all files with UID. But is a slow process.
Approach-2)
T1 - For each file/dir 'file_x', create a contribution extended attribute say 'trusted.glusterfs.quota.<uid>-contri'
T2 - create a directory '.glusterfs/quota/users/<uid>'
create a hardlink for file file_x under this directories
T3 - In a lookup/write operation, set dirty flag 'trusted.glusterfs.quota.dirty' for directory '.glusterfs/quota/users/<uid>'
T4 - Read the actual size of a file from the stat-buf, add the delta size to the contribution xattr
T5 - update size extended attribute say for directory '.glusterfs/quota/users/<uid>'
T6 - unset the dirty flag
Same for group quotas a size xattr is updated under .glusterfs/quota/groups/<gid>.
Problem of approach 1 of crawling entire brick is solved by only crawling the directory which is set dirty.
cons:
Need to make sure that the hard-link for a file is consistent when having another hardlinks
under .glusterfs/quota/users/<uid> and .glusterfs/quota/groups/<gid>
Approach-3)
T1 - For each file/dir 'file_x', update a contribution entry in the SQL-LITE DB (Create a DB file under .glusterfs/quota/)
T2 - In a lookup/write operation read the actual size from the statbuf, add the update the size in the USER-QUOTA schema in the DB
T3 - In a lookup/write operation, set dirty flag 'trusted.glusterfs.quota.dirty' for directory '.glusterfs/quota/users/<uid>'
Atomicity problem found in approach 1 and 2 is solved by using DB transactions.
Note: need to test the consistency of the SQL-LITE DB.
We feel approach-3 is more simpler and efficient way of implementing user/group quotas.
Thanks,
Vijay
_______________________________________________ Gluster-devel mailing list Gluster-devel@xxxxxxxxxxx http://www.gluster.org/mailman/listinfo/gluster-devel