From 250edc9e494fe0c59eff580df18080111ecb475e Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Tue, 24 Nov 2009 08:45:10 +0000 Subject: cluster/afr: Refactored the self-heal interface. Cleaned up the self-heal interface to callers. Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170 --- xlators/cluster/afr/src/afr-self-heal-metadata.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-metadata.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 9842902e6e0..bddccf6821d 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -81,7 +81,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) local->loc.path); sh->completion_cbk (frame, this); } else { - if (S_ISREG (local->cont.lookup.buf.st_mode)) { + if (S_ISREG (sh->mode)) { gf_log (this->name, GF_LOG_TRACE, "proceeding to data check on %s", local->loc.path); @@ -89,7 +89,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) return 0; } - if (S_ISDIR (local->cont.lookup.buf.st_mode)) { + if (S_ISDIR (sh->mode)) { gf_log (this->name, GF_LOG_TRACE, "proceeding to entry check on %s", local->loc.path); @@ -668,7 +668,8 @@ afr_sh_metadata_lookup (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; priv = this->private; - call_count = local->child_count; + call_count = afr_up_children_count (priv->child_count, + local->child_up); local->call_count = call_count; xattr_req = dict_new(); @@ -769,7 +770,8 @@ afr_sh_metadata_lock (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; priv = this->private; - call_count = local->child_count; + call_count = afr_up_children_count (priv->child_count, + local->child_up); local->call_count = call_count; for (i = 0; i < priv->child_count; i++) { @@ -809,7 +811,7 @@ afr_self_heal_metadata (call_frame_t *frame, xlator_t *this) local = frame->local; sh = &local->self_heal; - if (local->need_metadata_self_heal && priv->metadata_self_heal) { + if (local->self_heal.need_metadata_self_heal && priv->metadata_self_heal) { afr_sh_metadata_lock (frame, this); } else { afr_sh_metadata_done (frame, this); -- cgit