summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-04-11 07:13:40 +0000
committerAnand Avati <avati@gluster.com>2011-04-11 08:07:52 -0700
commitf0ef00478f1f2722d349606924d0d3479eb5da80 (patch)
treec44478339d4192cde3b0a5cb0c9a30921c3468e3
parent3a709be6850e50915c9e188cc308d7bfa5f781e5 (diff)
features/quota: Adding the option "timeout" to quota.
This option tells the quota translator when to perform the next aggregation. Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2473 (Support for volume and directory level quota) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473
-rw-r--r--xlators/features/quota/src/quota.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c2
2 files changed, 23 insertions, 1 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 6fac7572f61..80d4181e5d0 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -2588,6 +2588,26 @@ quota_parse_options (quota_priv_t *priv, xlator_t *this, dict_t *options)
"no \"limit-set\" option provided");
}
+ ret = dict_get_str (options, "timeout", &str);
+ if (str) {
+ ret = gf_string2bytesize (str, &value);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_INFO,
+ "Invalid quota timout value.");
+ ret = -1;
+ goto err;
+ } else {
+ priv->timeout = (int64_t) value;
+ gf_log (this->name, GF_LOG_INFO,
+ "quota timeout value = %"PRId64,
+ priv->timeout);
+ }
+ } else {
+ gf_log (this->name, GF_LOG_INFO, "timeout option not provided, "
+ "taking default as 0");
+ priv->timeout = 0;
+ }
+
list_for_each_entry (quota_lim, &priv->limit_head, limit_list) {
gf_log (this->name, GF_LOG_INFO, "%s:%"PRId64, quota_lim->path,
quota_lim->value);
@@ -2696,5 +2716,7 @@ struct xlator_cbks cbks = {
struct volume_options options[] = {
{.key = {"limit-set"}},
+ {.key = {"timeout"}
+ },
{.key = {NULL}}
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 5844c7c7e8c..0d05ec5b52a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -168,7 +168,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{"features.quota", "features/quota", "quota", "off", NO_DOC},
{"features.quota", "features/marker", "quota", "off", NO_DOC},
{"features.limit-usage", "features/quota", "limit-set", NULL, NO_DOC},
-
+ {"features.quota-timeout", "features/quota", "timeout", "0", NO_DOC},
{NULL, }
};