summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-12-13 15:54:49 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-13 03:40:09 -0800
commit91c7ad753884c81b46f05f200b9d9dc00eec5132 (patch)
treecf960ba74f9cad1e181191be83dd06caa698d340 /xlators/cluster/afr/src/afr-transaction.c
parent1d38ec6ce40279d7e8ef2b5a9bd59a2d289eca23 (diff)
cluster/afr: Double the call count if transaction is for rename
In rename the changelog modification needs to happen both on old parent-dir and new parent-dir, so 2 stack winds are done per brick. Change-Id: I43f34661e397c4288162213944529e18b7724b1d BUG: 766603 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/783 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 89fbd9ec7..6ae493f1c 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -450,9 +450,22 @@ afr_changelog_pre_op_call_count (afr_transaction_type type,
GF_ASSERT (locked_nodes);
call_count = afr_locked_children_count (locked_nodes, child_count);
- if (type == AFR_ENTRY_RENAME_TRANSACTION) {
+ if (type == AFR_ENTRY_RENAME_TRANSACTION)
+ call_count *= 2;
+
+ return call_count;
+}
+
+int
+afr_changelog_post_op_call_count (afr_transaction_type type,
+ unsigned char *pre_op,
+ unsigned int child_count)
+{
+ int call_count = 0;
+
+ call_count = afr_pre_op_done_children_count (pre_op, child_count);
+ if (type == AFR_ENTRY_RENAME_TRANSACTION)
call_count *= 2;
- }
return call_count;
}
@@ -490,8 +503,9 @@ afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
xattr[i] = dict_new ();
}
- call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
- priv->child_count);
+ call_count = afr_changelog_post_op_call_count (local->transaction.type,
+ local->transaction.pre_op,
+ priv->child_count);
local->call_count = call_count;
if (local->fd)