diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-03-12 13:32:54 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-03-12 11:17:35 -0800 |
commit | 029062c103cb1bd0736bb4fb8606c3be53d0ad7f (patch) | |
tree | a5bbf7e2e9b071e7e19afa9b2b80cf66003f70a2 | |
parent | 772cc8faee274cb983c0ae40de99f022c2b82af2 (diff) |
features/quota: Minor quota fixes due to xattrop FOP which results in quota not to work properly on the client side.v3.0.3rc2v3.0.3
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 711 (Wrong disk usage displayed in quota)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=711
-rw-r--r-- | xlators/features/quota/src/quota.c | 60 |
1 files changed, 11 insertions, 49 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 191d560ef42..a5c3188ac15 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -55,7 +55,6 @@ struct quota_priv { uint64_t disk_usage_limit; /* Used for Disk usage quota */ uint64_t current_disk_usage; /* Keep the current usage value */ - uint64_t last_synced_disk_usage; /* Disk usage when the last sync happened */ uint32_t min_free_disk_limit; /* user specified limit, in %*/ uint32_t current_free_disk; /* current free disk space available, in % */ @@ -873,66 +872,29 @@ gf_quota_get_disk_usage (xlator_t *this) return ; } -int32_t -quota_xattrop_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - dict_t *dict) -{ - struct quota_priv *priv = NULL; - data_t *data = NULL; - - priv = this->private; - - data = dict_get (dict, "trusted.glusterfs-quota-du"); - - if (op_ret >=0 && priv->disk_usage_limit) { - LOCK (&priv->lock); - { - priv->current_disk_usage = data_to_uint64 (data); - priv->last_synced_disk_usage = priv->current_disk_usage; - } - UNLOCK (&priv->lock); - - dict_unref (dict); - } - - - STACK_DESTROY (frame->root); - STACK_UNWIND (frame, op_ret, op_errno, dict); - return 0; -} - void gf_quota_cache_sync (xlator_t *this) { struct quota_priv *priv = NULL; call_frame_t *frame = NULL; - dict_t **array = NULL; - int32_t value = 0; + dict_t *dict = get_new_dict (); + - int ret = -1; priv = this->private; frame = create_frame (this, this->ctx->pool); - value = (priv->current_disk_usage) - (priv->last_synced_disk_usage); - array[0] = get_new_dict(); - ret = dict_set_int32 (array[0], "trusted.glusterfs-quota-du", value); - - dict_ref (array[0]); - - STACK_WIND (frame, - quota_xattrop_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->xattrop, - &(priv->root_loc), - GF_XATTROP_ADD_ARRAY, - array[0]); + dict_set (dict, "trusted.glusterfs-quota-du", + data_from_uint64 (priv->current_disk_usage)); + + dict_ref (dict); + STACK_WIND_COOKIE (frame, quota_setxattr_cbk, + (void *) (dict_t *) dict, + this->children->xlator, + this->children->xlator->fops->setxattr, + &(priv->root_loc), dict, 0); } |