diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-12-24 05:30:40 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-12-28 04:39:20 -0800 |
commit | 9658e13bd91849f75d968376aae5b937aabec512 (patch) | |
tree | 23f22472a602f90f616f5c8a178a970d82f293a7 /xlators | |
parent | 9331e101a4cd0a3faff25cf7dd603762296c7345 (diff) |
cluster/afr: Report number of blocks healed during diff self-heal.
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')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.c | 16 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.h | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index 73a87824724..2ef81b7e0ab 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -728,6 +728,14 @@ sh_diff_checksum_cbk (call_frame_t *rw_frame, void *cookie, xlator_t *this, } } + LOCK (&sh_priv->lock); + { + sh_priv->total_blocks++; + if (write_needed) + sh_priv->diff_blocks++; + } + UNLOCK (&sh_priv->lock); + if (write_needed && !sh->op_failed) { sh_diff_read (rw_frame, this, loop_state); } else { @@ -856,10 +864,16 @@ sh_diff_loop_driver (call_frame_t *frame, xlator_t *this) 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", + "diff self-heal completed on %s", local->loc.path); + gf_log (this->name, GF_LOG_DEBUG, + "diff self-heal on %s: %d blocks of %d were different (%.2f%%)", + local->loc.path, sh_priv->diff_blocks, + sh_priv->total_blocks, + ((sh_priv->diff_blocks * 1.0)/sh_priv->total_blocks) * 100); + sh_diff_private_cleanup (frame, this); local->self_heal.algo_completion_cbk (frame, this); } diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.h b/xlators/cluster/afr/src/afr-self-heal-algorithm.h index 7ef324477e1..b9c58b5cb1b 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.h +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.h @@ -46,6 +46,9 @@ typedef struct { gf_lock_t lock; unsigned int loops_running; off_t offset; + + int32_t total_blocks; + int32_t diff_blocks; } afr_sh_algo_diff_private_t; #endif /* __AFR_SELF_HEAL_ALGORITHM_H__ */ |