summaryrefslogtreecommitdiffstats
path: root/cli/src/cli.c
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-03-14 15:35:51 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 21:52:47 -0700
commitd05708d7976a8340ae7647fd26f38f22f1863b6a (patch)
treec2d12ea0c86f09d7bf24fc7c170f75464a51b24b /cli/src/cli.c
parent212d739886cde04ca79f58915a84b6ed09eec00b (diff)
dht: Rebalance status should display status from each process
Change-Id: Id128417219bdb7146253618a5f8f31ef35013894 BUG: 801322 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/2942 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'cli/src/cli.c')
0 files changed, 0 insertions, 0 deletions
'add'>+ local->self_heal.algo_abort_cbk (frame, this);
+ } else {
+ gf_log (this->name, GF_LOG_TRACE,
+ "full self-heal completed on %s",
+ local->loc.path);
+
+ local->self_heal.algo_completion_cbk (frame, this);
+ }
+ return 0;
+}
static int
sh_full_loop_return (call_frame_t *rw_frame, xlator_t *this, off_t offset)
@@ -90,18 +120,9 @@ sh_full_loop_return (call_frame_t *rw_frame, xlator_t *this, off_t offset)
sh = &sh_local->self_heal;
sh_priv = sh->private;
- LOCK (&sh_priv->lock);
- {
- sh_priv->loops_running--;
- }
- UNLOCK (&sh_priv->lock);
-
- gf_log (this->name, GF_LOG_TRACE,
- "loop for offset %"PRId64" returned", offset);
-
AFR_STACK_DESTROY (rw_frame);
- sh_full_loop_driver (sh_frame, this);
+ sh_full_loop_driver (sh_frame, this, _gf_false);
return 0;
}
@@ -279,90 +300,67 @@ sh_full_read_write (call_frame_t *frame, xlator_t *this, off_t offset)
out:
sh->op_failed = 1;
- sh_full_loop_driver (frame, this);
+ sh_full_loop_driver (frame, this, _gf_false);
return 0;
}
static int
-sh_full_loop_driver (call_frame_t *frame, xlator_t *this)
+sh_full_loop_driver (call_frame_t *frame, xlator_t *this, gf_boolean_t is_first_call)
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
afr_self_heal_t *sh = NULL;
afr_sh_algo_full_private_t *sh_priv = NULL;
+ gf_boolean_t is_driver_done = _gf_false;
+ blksize_t block_size = 0;
+ off_t offset = 0;
int loop = 0;
- int recurse = 0;
-
- off_t offset = 0;
priv = this->private;
local = frame->local;
sh = &local->self_heal;
sh_priv = sh->private;
- if (sh->op_failed) {
- if (sh_priv->loops_running == 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "full self-heal aborting on %s",
- local->loc.path);
-
- sh_full_private_cleanup (frame, this);
- local->self_heal.algo_abort_cbk (frame, this);
- }
-
- goto out;
- }
-
- if (sh_priv->offset >= sh->file_size) {
- if (sh_priv->loops_running == 0) {
-
- gf_log (this->name, GF_LOG_TRACE,
- "full self-heal completed on %s",
- local->loc.path);
-
- sh_full_private_cleanup (frame, this);
- local->self_heal.algo_completion_cbk (frame, this);
- }
-
- goto out;
- }
-
-spawn:
- loop = 0;
- recurse = 0;
-
LOCK (&sh_priv->lock);
{
- if ((sh_priv->loops_running < priv->data_self_heal_window_size)
+ if (_gf_false == is_first_call)
+ sh_priv->loops_running--;
+ offset = sh_priv->offset;
+ block_size = sh->block_size;
+ while ((sh->op_failed == 0) &&
+ (sh_priv->loops_running < priv->data_self_heal_window_size)
&& (sh_priv->offset < sh->file_size)) {
+ loop++;
gf_log (this->name, GF_LOG_TRACE,
"spawning a loop for offset %"PRId64,
sh_priv->offset);
- offset = sh_priv->offset;
sh_priv->offset += sh->block_size;
-
sh_priv->loops_running++;
- loop = 1;
+ if (_gf_false == is_first_call)
+ break;
- if (sh_priv->offset < sh->file_size)
- recurse = 1;
+ }
+ if (0 == sh_priv->loops_running) {
+ is_driver_done = _gf_true;
}
}
UNLOCK (&sh_priv->lock);
- if (loop) {
+ while (loop--) {
sh_full_read_write (frame, this, offset);
- if (recurse)
- goto spawn;
+ offset += block_size;
+ }
+
+ if (is_driver_done) {
+ sh_full_loop_driver_done (frame, this);
}
-out:
return 0;
}
@@ -386,7 +384,7 @@ afr_sh_algo_full (call_frame_t *frame, xlator_t *this)
local->call_count