diff options
| -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__ */  | 
