summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-data.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 4ed6071ab..576a15e06 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -476,7 +476,25 @@ afr_sh_data_trim_sinks (call_frame_t *frame, xlator_t *this)
struct afr_sh_algorithm *
afr_sh_data_pick_algo (call_frame_t *frame, xlator_t *this)
{
- return &afr_self_heal_algorithms[1]; /* full */
+ afr_private_t *priv = NULL;
+ int i = 0;
+
+ priv = this->private;
+
+ while (afr_self_heal_algorithms[i].name) {
+ if (!strcmp (priv->data_self_heal_algorithm,
+ afr_self_heal_algorithms[i].name)) {
+ goto out;
+ }
+
+ i++;
+ }
+
+ /* No match found, so fall back on "full" */
+
+ i = 0;
+out:
+ return &afr_self_heal_algorithms[i];
}