From 91c7ad753884c81b46f05f200b9d9dc00eec5132 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 13 Dec 2011 15:54:49 +0530 Subject: 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 Reviewed-on: http://review.gluster.com/783 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-transaction.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 89fbd9ec754..6ae493f1cf5 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) -- cgit