summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-23 10:11:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-26 07:09:05 -0700
commit4163a3f8fbcc5e0d84d955258161f3a6f7a86de8 (patch)
tree50b6ee8ae655f1b8b822e50d3cc290729c17b1a5 /xlators/cluster/afr/src/afr.c
parent6490122f107c992f2600fc7d3214a43c3f50df70 (diff)
cluster/afr: Do self-heal in the background.
This patch introduces a new option "background-self-heal-count", with a default value of 16. This means that upto {background-self-heal-count} number of files/directories will be healed in the background at any given time. If such number of self-heals are already in progress, further self-heals take place in the foreground. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 320 (Improve self-heal performance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index bf023ce27ce..641fa1551ec 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -2337,6 +2337,7 @@ init (xlator_t *this)
char * algo = NULL;
char * change_log = NULL;
+ int32_t background_count = 0;
int32_t lock_server_count = 1;
int32_t window_size;
@@ -2366,6 +2367,18 @@ init (xlator_t *this)
fav_ret = dict_get_str (this->options, "favorite-child", &fav_child);
priv->favorite_child = -1;
+ priv->background_self_heal_count = 16;
+
+ dict_ret = dict_get_int32 (this->options, "background-self-heal-count",
+ &background_count);
+ if (dict_ret == 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Setting background self-heal count to %d.",
+ window_size);
+
+ priv->background_self_heal_count = background_count;
+ }
+
/* Default values */
priv->data_self_heal = 1;
@@ -2673,6 +2686,10 @@ struct volume_options options[] = {
{ .key = {"favorite-child"},
.type = GF_OPTION_TYPE_XLATOR
},
+ { .key = {"background-self-heal-count"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 0
+ },
{ .key = {"data-self-heal"},
.type = GF_OPTION_TYPE_BOOL
},