From 51600217be80dc9e1b1ad8bf20b7e5a95d31ec1c Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sat, 28 Nov 2009 05:34:41 +0000 Subject: afr: fix logic to break out of diff/checksum loop When checksum fop returns error, mark for terminating the loop at the end of the iteration (when all checksum calls of that iteration return) and not immediately Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 320 (Improve self-heal performance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320 --- xlators/cluster/afr/src/afr-self-heal-algorithm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-algorithm.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index b6fba9d1f..73a878247 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -698,16 +698,12 @@ sh_diff_checksum_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, strerror (op_errno)); sh->op_failed = 1; - - sh_diff_loop_return (rw_frame, this, loop_state); - - return 0; + } else { + memcpy ((void *) sh_priv->checksum + loop_state->child_index * MD5_DIGEST_LEN, + strong_checksum, + MD5_DIGEST_LEN); } - memcpy ((void *) sh_priv->checksum + loop_state->child_index * MD5_DIGEST_LEN, - strong_checksum, - MD5_DIGEST_LEN); - call_count = afr_frame_return (rw_frame); if (call_count == 0) { @@ -732,7 +728,7 @@ sh_diff_checksum_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, } } - if (write_needed) { + if (write_needed && !sh->op_failed) { sh_diff_read (rw_frame, this, loop_state); } else { sh->offset += sh_priv->block_size; -- cgit