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.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 775a53a..cb45825 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -71,6 +71,7 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
gf_boolean_t metadata_change_log;
gf_boolean_t entry_change_log;
gf_boolean_t strict_readdir;
+ gf_boolean_t optimistic_change_log;
xlator_list_t * trav = NULL;
@@ -257,6 +258,26 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
"change-log %s'.", change_log);
}
+
+ dict_ret = dict_get_str (options, "optimistic-change-log",
+ &change_log);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (change_log, &optimistic_change_log);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Validation faled for optimistic-change-log");
+ *op_errstr = gf_strdup ("Error, option should be boolean");
+ ret = -1;
+ goto out;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Validated 'option optimistic-"
+ "change-log %s'.", change_log);
+ }
+
+
read_ret = dict_get_str (options, "read-subvolume", &read_subvol);
if (read_ret)
@@ -674,6 +695,7 @@ init (xlator_t *this)
priv->data_change_log = 1;
priv->metadata_change_log = 1;
priv->entry_change_log = 1;
+ priv->optimistic_change_log = 1;
dict_ret = dict_get_str (this->options, "data-change-log",
&change_log);
@@ -715,6 +737,19 @@ init (xlator_t *this)
}
}
+ dict_ret = dict_get_str (this->options, "optimistic-change-log",
+ &change_log);
+ if (dict_ret == 0) {
+ ret = gf_string2boolean (change_log, &priv->optimistic_change_log);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Invalid 'option optimistic-change-log %s'. "
+ "Defaulting to optimistic-change-log as 'on'.",
+ change_log);
+ priv->optimistic_change_log = 1;
+ }
+ }
+
/* Locking options */
priv->inodelk_trace = 0;
@@ -994,6 +1029,9 @@ struct volume_options options[] = {
{ .key = {"entry-change-log"},
.type = GF_OPTION_TYPE_BOOL
},
+ { .key = {"optimistic-change-log"},
+ .type = GF_OPTION_TYPE_BOOL
+ },
{ .key = {"data-lock-server-count"},
.type = GF_OPTION_TYPE_INT,
.min = 0