summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-data.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-06-09 04:00:42 +0000
committerAnand Avati <avati@gluster.com>2011-06-09 07:41:39 -0700
commitd213487802f0aa62c46eb18eeb75bd5b65434dbc (patch)
tree993b6889933a42ce9452a673d114f4103b73f078 /xlators/cluster/afr/src/afr-self-heal-data.c
parent5462cbb9c483addf5288e44bbc6eae147bd9d442 (diff)
cluster/afr: lookup should set the read-child based on pending xattrs
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2840 (files not getting self-healed when the first child goes down) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2840
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 263d49fbb2d..5adaba1c974 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -697,14 +697,15 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this)
}
-int
-afr_self_heal_get_source (xlator_t *this, afr_local_t *local, dict_t **xattr)
+void
+afr_self_heal_find_sources (xlator_t *this, afr_local_t *local, dict_t **xattr,
+ afr_transaction_type transaction_type)
{
afr_self_heal_t *sh = NULL;
afr_private_t *priv = NULL;
- int source = 0;
int i = 0;
+ afr_self_heal_type sh_type = AFR_SELF_HEAL_DATA;
sh = &local->self_heal;
priv = this->private;
@@ -721,13 +722,23 @@ afr_self_heal_get_source (xlator_t *this, afr_local_t *local, dict_t **xattr)
gf_afr_mt_int32_t);
afr_sh_build_pending_matrix (priv, sh->pending_matrix, xattr,
- priv->child_count, AFR_DATA_TRANSACTION);
-
- (void)afr_sh_mark_sources (sh, priv->child_count, AFR_SELF_HEAL_DATA);
-
- source = afr_sh_select_source (sh->sources, priv->child_count);
-
- return source;
+ priv->child_count, transaction_type);
+
+ switch (transaction_type) {
+ case AFR_DATA_TRANSACTION:
+ sh_type = AFR_SELF_HEAL_DATA;
+ break;
+ case AFR_ENTRY_TRANSACTION:
+ sh_type = AFR_SELF_HEAL_ENTRY;
+ break;
+ case AFR_METADATA_TRANSACTION:
+ sh_type = AFR_SELF_HEAL_METADATA;
+ break;
+ default:
+ sh_type = AFR_SELF_HEAL_METADATA;
+ break;
+ }
+ (void)afr_sh_mark_sources (sh, priv->child_count, sh_type);
}