Whamcloud - gitweb
LU-8130 osc: convert osc_quota hash to xarray 38/32038/76
authorJames Simmons <jsimmons@infradead.org>
Mon, 28 Aug 2023 14:03:03 +0000 (10:03 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 6 Sep 2023 06:15:49 +0000 (06:15 +0000)
commitac8c28f959d87c1ae852d9daccce3c2a3f7a6f39
tree275cd1e2427e599de4627ecb133fd271e0e81345
parent75dd69dd6ecac38267a8fbf475945b2a2f293ba9
LU-8130 osc: convert osc_quota hash to xarray

The cl_quota_hash originally had 3 hashes, one for each type of quota
(USR, GRP, PRJ) that just stored on the client whether a particular
quota ID was over its limit. This was overkill since cl_quota_hash
only needs one bit to check if a particular ID has exceeded quota
with IO from this client, and there will usually be only a few IDs
that are actually exceeding their limit where a client is involved.
Instead, use the quota ID as the index into an Xarray, and store
a value with the quota TYPE(s) that are over the limit for that ID.
We only need to test the presence/absence of an ID and a quota type
without the need to store any additional values (the clients do not
track the actual quota usage or limits).
To test if a quota is exceeded for particular ID is a two-step
process. First check if there is any entry for the particular ID,
and if it exists then check which quota type (USR, GRP, PRJ) is
over the limit for that ID value.  The same is done when setting
a particular quota ID/TYPE is over its limit - first lookup the
ID and then add the TYPE flag to the value if not already set.
The Xarray implementation does offer using "marks" (up to 3 bits
per index) but in this case there is no other value that needs to
be stored into the Xarray other than one bit for any exceeded type,
so they are not used here.

Change-Id: I9355ed2a7158f0d5cc0d600ad51ea1a1434f3e98
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/32038
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
libcfs/include/libcfs/linux/xarray.h
lustre/include/lustre_osc.h
lustre/include/obd.h
lustre/osc/osc_dev.c
lustre/osc/osc_internal.h
lustre/osc/osc_quota.c