summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-11-12 08:40:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-13 02:13:46 -0800
commit53fd5927ea0dc2f7c9cd019002abdc3751135dcd (patch)
treecf679f832875505db677ea407c618a5acf4fea97 /xlators/cluster
parent26fbaa23cafee4643b7604660762656c4a71684b (diff)
cluster/afr: Fix self-heal loop driver termination logic.
Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 320 (Improve self-heal performance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-algorithm.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c
index f9ed1afe0b5..b6fba9d1faa 100644
--- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c
+++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c
@@ -299,6 +299,8 @@ sh_full_loop_driver (call_frame_t *frame, xlator_t *this)
afr_sh_algo_full_private_t *sh_priv = NULL;
int loop = 0;
+ int recurse = 0;
+
off_t offset = 0;
priv = this->private;
@@ -334,7 +336,8 @@ sh_full_loop_driver (call_frame_t *frame, xlator_t *this)
}
spawn:
- loop = 0;
+ loop = 0;
+ recurse = 0;
LOCK (&sh_priv->lock);
{
@@ -350,15 +353,18 @@ spawn:
sh_priv->loops_running++;
+ loop = 1;
+
if (sh_priv->offset < sh->file_size)
- loop = 1;
+ recurse = 1;
}
}
UNLOCK (&sh_priv->lock);
if (loop) {
sh_full_read_write (frame, this, offset);
- goto spawn;
+ if (recurse)
+ goto spawn;
}
out:
@@ -828,7 +834,9 @@ sh_diff_loop_driver (call_frame_t *frame, xlator_t *this)
afr_self_heal_t * sh = NULL;
afr_sh_algo_diff_private_t *sh_priv = NULL;
- int loop = 0;
+ int loop = 0;
+ int recurse = 0;
+
off_t offset = 0;
priv = this->private;
@@ -864,7 +872,8 @@ sh_diff_loop_driver (call_frame_t *frame, xlator_t *this)
}
spawn:
- loop = 0;
+ loop = 0;
+ recurse = 0;
LOCK (&sh_priv->lock);
{
@@ -880,15 +889,18 @@ spawn:
sh_priv->loops_running++;
+ loop = 1;
+
if (sh_priv->offset < sh->file_size)
- loop = 1;
+ recurse = 1;
}
}
UNLOCK (&sh_priv->lock);
if (loop) {
sh_diff_checksum (frame, this, offset);
- goto spawn;
+ if (recurse)
+ goto spawn;
}
out: