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-08 09:30:02 +0000
committerAnand Avati <avati@gluster.com>2011-06-08 11:19:06 -0700
commit152ba0fa976adcbcb7dd2f485a52fedc2fc49d6d (patch)
tree4a6e7ad705efb451eaaceea3f8a8ed4768e6bd79 /xlators/cluster/afr/src/afr-self-heal-data.c
parentd979696eae8e73bcca9eb6b8b6cdaecf2e19700a (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 3791f21c1..7da6d828e 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -693,13 +693,14 @@ 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;
@@ -716,13 +717,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);
}