summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota/src/quota.h
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2013-07-31 12:26:51 +0530
committerVijay Bellur <vbellur@redhat.com>2013-08-07 12:59:50 +0530
commit47d58c392998e05d7ef20b17c0089c17d7921e5e (patch)
tree8fb869c5eecf7bca7f87e3faa0d926078a34289b /xlators/features/quota/src/quota.h
parentdcbd9152a67b06ddaff012a9042b50dc7b76cd0d (diff)
features/quota: Read the limit from the xattrs
Old approach: This is based on the path. So, the config file stored as limit-set key value pair in the volfile was the source of truth for any directory to be enforced the quota limit. So, we were storing it in a list and everypath is compared with the list. This hinders scaling with the order of kilos of quota directories. This approach is different from the XFS where the below method of inode based limit is employed this adds the admins to learn new stuff. New approach: This is based on the inode. After the path is set with the quota limit. The limit sticks with the inode. So, we need not to store the paths in the xlator context/options, instead get the xattrs in the lookup. Set the hard and soft limits of context from there. The additional change in the glusterd to set the xattrs when limit-usage command issued will be submitted as a separate patch. This patch also does: * Move the logging from the quotad to quota-enforcer. * Save the soft limit in the context. * Some clean up in quota-enforcer Change-Id: I2840f9377a4a1f76630741550873fe74758fa100 Signed-off-by: Varun Shastry <vshastry@redhat.com>
Diffstat (limited to 'xlators/features/quota/src/quota.h')
-rw-r--r--xlators/features/quota/src/quota.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h
index 2ba339aa..86842140 100644
--- a/xlators/features/quota/src/quota.h
+++ b/xlators/features/quota/src/quota.h
@@ -26,6 +26,7 @@
#define VAL_LENGTH 8
#define READDIR_BUF 4096
#define QUOTA_UPDATE_USAGE_KEY "quota-update-usage"
+#define QUOTA_LIMIT_KEY "trusted.glusterfs.quota.limit-set"
#define QUOTA_WIND_IF_DISABLED(quota_on, frame, this, fop, params ...) \
do { \
@@ -119,10 +120,12 @@ typedef struct quota_dentry quota_dentry_t;
struct quota_inode_ctx {
int64_t size;
- int64_t limit;
+ int64_t hard_lim;
+ int64_t soft_lim;
struct iatt buf;
struct list_head parents;
struct timeval tv;
+ struct timeval prev_log;
gf_lock_t lock;
};
typedef struct quota_inode_ctx quota_inode_ctx_t;
@@ -139,7 +142,6 @@ struct quota_local {
int32_t op_ret;
int32_t op_errno;
int64_t size;
- int64_t limit;
char just_validated;
inode_t *inode;
call_stub_t *stub;
@@ -162,11 +164,12 @@ struct qd_vols_conf {
typedef struct qd_vols_conf qd_vols_conf_t;
struct quota_priv {
- int64_t timeout;
double default_soft_lim;
+ uint32_t log_timeout;
+ uint32_t soft_timeout;
+ uint32_t hard_timeout;
gf_boolean_t quota_on;
gf_boolean_t consider_statfs;
- struct list_head limit_head;
qd_vols_conf_t **qd_vols_conf;
gf_lock_t lock;
};