summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 645388d46da..a662037e788 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -30,6 +30,8 @@
#endif
#include "afr-common.c"
+struct volume_options options[];
+
int32_t
notify (xlator_t *this, int32_t event,
void *data, ...)
@@ -377,6 +379,7 @@ init (xlator_t *this)
char * strict_readdir = NULL;
char * inodelk_trace = NULL;
char * entrylk_trace = NULL;
+ char * def_val = NULL;
int32_t background_count = 0;
int32_t lock_server_count = 1;
int32_t window_size = 0;
@@ -437,16 +440,37 @@ init (xlator_t *this)
}
}
- priv->data_self_heal_algorithm = "";
-
+ if (xlator_get_volopt_info (&this->volume_options,
+ "data-self-heal-algorithm", &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ " data-self-heal-algorithm not found");
+ ret = -1;
+ goto out;
+ } else {
+ priv->data_self_heal_algorithm = def_val;
+ }
dict_ret = dict_get_str (this->options, "data-self-heal-algorithm",
&algo);
if (dict_ret == 0) {
priv->data_self_heal_algorithm = gf_strdup (algo);
}
-
- priv->data_self_heal_window_size = 16;
+ if (xlator_get_volopt_info (&this->volume_options,
+ "data-self-heal-window-size",&def_val,
+ NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "data-self-heal-window-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2int32 (def_val,
+ (int *)&priv->data_self_heal_window_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "data-self-heal-window-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
dict_ret = dict_get_int32 (this->options, "data-self-heal-window-size",
&window_size);
@@ -808,12 +832,22 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_BOOL
},
{ .key = {"data-self-heal-algorithm"},
- .type = GF_OPTION_TYPE_STR
+ .type = GF_OPTION_TYPE_STR,
+ .default_value = "",
+ .description = "Select between \"full\", \"diff\". The "
+ "\"full\" algorithm copies the entire file from "
+ "source to sink. The \"diff\" algorithm copies to "
+ "sink only those blocks whose checksums don't match "
+ "with those of source.",
+ .value = { "diff", "full" }
},
{ .key = {"data-self-heal-window-size"},
.type = GF_OPTION_TYPE_INT,
.min = 1,
- .max = 1024
+ .max = 1024,
+ .default_value = "16",
+ .description = "Maximum number blocks per file for which self-heal "
+ "process would be applied simultaneously."
},
{ .key = {"metadata-self-heal"},
.type = GF_OPTION_TYPE_BOOL