From 6629bab3bf3c110ce275ad184b5e358272b7593a Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 14 May 2012 16:41:10 +0530 Subject: Self-heald: Enable configuring of heal poll timeout Change-Id: I631e5bf4b3615b553b72e7ac7f490714b3b995f9 BUG: 821395 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3329 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/afr/src/afr-self-heald.c | 4 +--- xlators/cluster/afr/src/afr.c | 10 ++++++++++ xlators/cluster/afr/src/afr.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 3a629574..1a749249 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -19,8 +19,6 @@ #include "protocol-common.h" #include "event-history.h" -#define AFR_POLL_TIMEOUT 600 - typedef enum { STOP_CRAWL_ON_SINGLE_SUBVOL = 1 } afr_crawl_flags_t; @@ -602,7 +600,7 @@ afr_poll_self_heal (void *data) } if (shd->enabled && (shd->pos[child] == AFR_POS_LOCAL)) _do_self_heal_on_subvol (this, child, INDEX); - timeout.tv_sec = AFR_POLL_TIMEOUT; + timeout.tv_sec = shd->timeout; timeout.tv_usec = 0; //notify and previous timer should be synchronized. LOCK (&priv->lock); diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 3f102f80..8e94d549 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -164,6 +164,8 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("quorum-count", priv->quorum_count, options, uint32, out); fix_quorum_options(this,priv,qtype); + GF_OPTION_RECONF ("heal-timeout", priv->shd.timeout, options, + int32, out); ret = 0; out: @@ -402,6 +404,7 @@ init (xlator_t *this) goto out; priv->root_inode = inode_ref (this->itable->root); GF_OPTION_INIT ("node-uuid", priv->shd.node_uuid, str, out); + GF_OPTION_INIT ("heal-timeout", priv->shd.timeout, int32, out); ret = 0; out: @@ -596,5 +599,12 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_STR, .description = "Local glusterd uuid string", }, + { .key = {"heal-timeout"}, + .type = GF_OPTION_TYPE_INT, + .min = 60, + .max = INT_MAX, + .default_value = "600", + .description = "Poll timeout for checking the need to self-heal" + }, { .key = {NULL} }, }; diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 497d82d6..f00a8498 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -96,6 +96,7 @@ typedef struct afr_self_heald_ { eh_t *heal_failed; eh_t *split_brain; char *node_uuid; + int timeout; } afr_self_heald_t; typedef struct _afr_private { -- cgit