diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-12-10 12:51:37 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-04-28 09:38:57 -0700 |
commit | b744a9cf93171cbe6c6f43c6f241888754e27fa7 (patch) | |
tree | 3978bf56c004588cdbbdc29978166a712e32d2fd /xlators/cluster/afr/src/afr-common.c | |
parent | ba8212527e886a94b8d393172e0672c44de8457b (diff) |
cluster/afr: Add dry-run functionality to self-heal.
This will be useful in figuring out if a file needs
self-heal or not with certainity for data-self-heal
Change-Id: Idf98a68e69f2c35646ef2e7c97302586fe1dc07d
BUG: 1039544
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6510
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 66978a910aa..953df5a67a4 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1743,14 +1743,23 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this, afr_lookup_done_success_action (frame, this, _gf_true); xattr = local->cont.lookup.xattr; - if (xattr) { + if (!xattr) + goto out; + + if (sh_failed) { ret = dict_set_int32 (xattr, "sh-failed", sh_failed); if (ret) gf_log (this->name, GF_LOG_ERROR, "%s: Failed to set " "sh-failed to %d", local->loc.path, sh_failed); - - if (local->self_heal.actual_sh_started == _gf_true && - sh_failed == 0) { + } else { + ret = dict_set_int32 (xattr, "metadata-self-heal-pending", + local->self_heal.metadata_sh_pending); + ret = dict_set_int32 (xattr, "data-self-heal-pending", + local->self_heal.data_sh_pending); + ret = dict_set_int32 (xattr, "entry-self-heal-pending", + local->self_heal.entry_sh_pending); + + if (local->self_heal.actual_sh_started == _gf_true) { ret = dict_set_int32 (xattr, "actual-sh-done", 1); if (ret) gf_log(this->name, GF_LOG_ERROR, "%s: Failed to" @@ -2511,6 +2520,10 @@ afr_lookup (call_frame_t *frame, xlator_t *this, &local->foreground_self_heal); dict_del (xattr_req, "foreground-self-heal"); + ret = dict_get_int32 (xattr_req, "dry-run-self-heal", + &local->self_heal.dry_run); + dict_del (xattr_req, "dry-run-self-heal"); + ret = afr_lookup_xattr_req_prepare (local, this, xattr_req, &local->loc, &gfid_req); if (ret) { |