From 9b9ede959d70438b1c41aad14ed189c03d16a544 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 29 May 2012 18:22:16 +0530 Subject: distribute: use global synctask 'env' instead of local creating a local synctask_env can lead to creating of many more syncop threads than required. The current syncop logic can handle the scale-up/scale-down of threads depending on the load. Hence, its neater to use global synctask env. Change-Id: Iff71885ed92eaab67fa2c2cf88c85af3a4a603d9 BUG: 823774 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/3480 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-common.h | 2 -- xlators/cluster/dht/src/dht-helper.c | 10 ++-------- xlators/cluster/dht/src/dht-rebalance.c | 5 +---- xlators/cluster/dht/src/dht.c | 9 --------- xlators/cluster/dht/src/nufa.c | 9 --------- xlators/cluster/dht/src/switch.c | 9 --------- 6 files changed, 3 insertions(+), 41 deletions(-) diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index a971f2987..9f7723fdb 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -240,8 +240,6 @@ struct dht_conf { /* Will be a global flag to control the layout spread count */ uint32_t dir_spread_cnt; - struct syncenv *env; /* The env pointer to the rebalance synctask */ - /* to keep track of nodes which are decomissioned */ xlator_t **decommissioned_bricks; int decommission_in_progress; diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index bad268040..920a7aabc 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -773,11 +773,8 @@ int dht_rebalance_complete_check (xlator_t *this, call_frame_t *frame) { int ret = -1; - dht_conf_t *conf = NULL; - conf = this->private; - - ret = synctask_new (conf->env, dht_migration_complete_check_task, + ret = synctask_new (this->ctx->env, dht_migration_complete_check_task, dht_migration_complete_check_done, frame, frame); return ret; @@ -906,11 +903,8 @@ dht_rebalance_in_progress_check (xlator_t *this, call_frame_t *frame) { int ret = -1; - dht_conf_t *conf = NULL; - - conf = this->private; - ret = synctask_new (conf->env, dht_rebalance_inprogress_task, + ret = synctask_new (this->ctx->env, dht_rebalance_inprogress_task, dht_inprogress_check_done, frame, frame); return ret; diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index b07e5e969..fd07a1c7e 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -938,11 +938,8 @@ int dht_start_rebalance_task (xlator_t *this, call_frame_t *frame) { int ret = -1; - dht_conf_t *conf = NULL; - conf = this->private; - - ret = synctask_new (conf->env, rebalance_task, + ret = synctask_new (this->ctx->env, rebalance_task, rebalance_task_completion, frame, frame); return ret; diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 72f03d3e7..e3930e2af 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -453,15 +453,6 @@ init (xlator_t *this) conf->gen = 1; - /* Create 'syncop' environment */ - conf->env = syncenv_new (0); - if (!conf->env) { - gf_log (this->name, GF_LOG_ERROR, - "failed to create sync environment %s", - strerror (errno)); - goto err; - } - this->local_pool = mem_pool_new (dht_local_t, 512); if (!this->local_pool) { gf_log (this->name, GF_LOG_ERROR, diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index bf7eaf8f1..2179870d9 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -609,15 +609,6 @@ init (xlator_t *this) goto err; } - /* Create 'syncop' environment */ - conf->env = syncenv_new (0); - if (!conf->env) { - gf_log (this->name, GF_LOG_ERROR, - "failed to create sync environment %s", - strerror (errno)); - goto err; - } - this->local_pool = mem_pool_new (dht_local_t, 128); if (!this->local_pool) { gf_log (this->name, GF_LOG_ERROR, diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index 1738f8423..fe75914f2 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -917,15 +917,6 @@ init (xlator_t *this) goto err; } - /* Create 'syncop' environment */ - conf->env = syncenv_new (0); - if (!conf->env) { - gf_log (this->name, GF_LOG_ERROR, - "failed to create sync environment %s", - strerror (errno)); - goto err; - } - this->local_pool = mem_pool_new (dht_local_t, 128); if (!this->local_pool) { gf_log (this->name, GF_LOG_ERROR, -- cgit