summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota-helper.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-06-14 23:54:16 +0000
committerAnand Avati <avati@gluster.com>2011-06-16 22:00:51 -0700
commita87555181d47522e985325c67b7d17c49dbd38de (patch)
tree16e7848551e64c1aa8b2038fabe2da4c3bd98dd7 /xlators/features/marker/src/marker-quota-helper.c
parent01d67311c83ae272f3ee3632c1e8f13ccebaca81 (diff)
features/marker-quota: fixes in rename path.
- remove xattrs from newpath after rename is complete. - hold inodelk on both parents (if they are different) before doing rename and gather contribution values of oldpath and newpath to their parents while still holding the locks. Use these contribution values to reduce parent sizes. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2697 (Quota: add-brick creates the size go awkward, though it was perfect earlier) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2697
Diffstat (limited to 'xlators/features/marker/src/marker-quota-helper.c')
-rw-r--r--xlators/features/marker/src/marker-quota-helper.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c
index fba2cdd3f..9a7310e8a 100644
--- a/xlators/features/marker/src/marker-quota-helper.c
+++ b/xlators/features/marker/src/marker-quota-helper.c
@@ -373,3 +373,38 @@ quota_local_unref (xlator_t *this, quota_local_t *local)
out:
return 0;
}
+
+
+inode_contribution_t *
+get_contribution_from_loc (xlator_t *this, loc_t *loc)
+{
+ int32_t ret = 0;
+ quota_inode_ctx_t *ctx = NULL;
+ inode_contribution_t *contribution = NULL;
+
+ ret = quota_inode_ctx_get (loc->inode, this, &ctx);
+ if (ret < 0) {
+ gf_log_callingfn (this->name, GF_LOG_WARNING,
+ "cannot get marker-quota context from inode "
+ "(ino: %"PRId64", gfid:%s, path:%s)",
+ loc->inode->ino,
+ uuid_utoa (loc->inode->gfid),
+ loc->path);
+ goto err;
+ }
+
+ contribution = get_contribution_node (loc->parent, ctx);
+ if (contribution == NULL) {
+ gf_log_callingfn (this->name, GF_LOG_WARNING,
+ "inode (ino:%"PRId64", gfid:%s, path:%s ) has"
+ " no contribution towards parent (ino:%"PRId64
+ ", gfid:%s)", loc->inode->ino,
+ uuid_utoa (loc->inode->gfid),
+ loc->path, loc->parent->ino,
+ uuid_utoa (loc->parent->gfid));
+ goto err;
+ }
+
+err:
+ return contribution;
+}