diff options
author | Vijay Bellur <vbellur@redhat.com> | 2013-08-10 07:42:07 -0700 |
---|---|---|
committer | Gerrit Code Review <review@dev.gluster.org> | 2013-08-10 07:42:07 -0700 |
commit | d543bfa17ccacedd1825713574fa70801006f796 (patch) | |
tree | e45da1089f56d8a1b955be2ec1734eb786d60912 | |
parent | 3d736cae2d9c10fed440a0fdf4a2e5625d0e17dc (diff) | |
parent | 8a3331903613d54d92c0191c238bf17cb33e0e6c (diff) |
Merge "features/quota: Add support for statedump" into quota
-rw-r--r-- | xlators/features/quota/src/quota.c | 40 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.h | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index b96a1129..640ade19 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -12,6 +12,7 @@ #include "quota.h" #include "common-utils.h" #include "defaults.h" +#include "statedump.h" int32_t quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, @@ -450,6 +451,11 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, UNLOCK (&ctx->lock); if (need_validate) { + LOCK (&priv->lock); + { + priv->validation_count++; + } + UNLOCK (&priv->lock); goto validate; } @@ -3481,6 +3487,37 @@ out: return ret; } +int32_t +quota_priv_dump (xlator_t *this) +{ + quota_priv_t *priv = NULL; + int32_t ret = -1; + + + GF_ASSERT (this); + + priv = this->private; + + gf_proc_dump_add_section ("xlators.features.quota.priv", this->name); + + ret = TRY_LOCK (&priv->lock); + if (ret) + goto out; + else { + gf_proc_dump_write("soft-timeout", "%d", priv->soft_timeout); + gf_proc_dump_write("hard-timeout", "%d", priv->hard_timeout); + gf_proc_dump_write("log-timeout", "%d", priv->log_timeout); + gf_proc_dump_write("quota-on", "%d", priv->is_quota_on); + gf_proc_dump_write("statfs", "%d", priv->consider_statfs); + gf_proc_dump_write("volume-uuid", "%s", priv->volume_uuid); + gf_proc_dump_write("validation-count", "%ld", + priv->validation_count); + } + UNLOCK (&priv->lock); + +out: + return 0; +} void fini (xlator_t *this) @@ -3523,6 +3560,9 @@ struct xlator_cbks cbks = { .forget = quota_forget }; +struct xlator_dumpops dumpops = { + .priv = quota_priv_dump, +}; struct volume_options options[] = { {.key = {"limit-set"}}, {.key = {"deem-statfs"}, diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h index 3a7a47f2..11022895 100644 --- a/xlators/features/quota/src/quota.h +++ b/xlators/features/quota/src/quota.h @@ -181,6 +181,7 @@ struct quota_priv { rpcsvc_t *rpcsvc; inode_table_t *itable; char *volume_uuid; + uint64_t validation_count; }; typedef struct quota_priv quota_priv_t; |