summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-12 05:33:30 +0000
committerAnand Avati <avati@gluster.com>2011-07-12 09:03:09 -0700
commite87432be87c37c36467a85e3d2c55970f8439915 (patch)
tree06f5005aff7811f071e7f8b878b68458f223981d /xlators/cluster/afr/src
parent1d0cb953bb117689fb8381d65932ead486d13b05 (diff)
afr: changes in volume_options to assist volume set help/help-xml
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2041 (volume set help option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
Diffstat (limited to 'xlators/cluster/afr/src')
-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 35dad5007..d8939ab4d 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