summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-04-26 16:25:08 +0530
committerNiels de Vos <ndevos@redhat.com>2015-05-10 05:28:23 -0700
commite043bd6b3b80aa17a9853f223bf86e6311060e01 (patch)
treeef41f20b22ebbee4e9fb457a46a652f93bebfd7d /xlators/features
parent1a217b2a0295ca4d9068ee5c17d6a4374cc5f8fc (diff)
features/bitrot: Use global timer wheel
> Change-Id: I761927ea263b4144b851881f25791fda5b794f59 > BUG: 1170075 > Signed-off-by: Venky Shankar <vshankar@redhat.com> > Reviewed-on: http://review.gluster.org/10381 > Tested-by: NetBSD Build System > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> > Reviewed-by: Vijay Bellur <vbellur@redhat.com> Change-Id: I4aa7c0d8b42b4c8d14a1d810e54c2de4d52b4389 Signed-off-by: Venky Shankar <vshankar@redhat.com> BUG: 1220041 Reviewed-on: http://review.gluster.org/10717 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 4ace55fcfe1..b7ffe762c80 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -25,6 +25,8 @@
#include "bit-rot-scrub.h"
#include <pthread.h>
+#include "tw.h"
+
static int
br_find_child_index (xlator_t *this, xlator_t *child)
{
@@ -604,6 +606,8 @@ br_add_object_to_queue (struct gf_tw_timer_list *timer,
this = object->this;
priv = this->private;
+ THIS = this;
+
pthread_mutex_lock (&priv->lock);
{
list_add_tail (&object->list, &priv->obj_queue->objects);
@@ -1292,23 +1296,17 @@ static inline void
br_fini_signer (xlator_t *this, br_private_t *priv)
{
int i = 0;
- int ret = 0;
for (; i < BR_WORKERS; i++) {
(void) gf_thread_cleanup_xint (priv->obj_queue->workers[i]);
}
pthread_cond_destroy (&priv->object_cond);
- ret = gf_tw_cleanup_timers (priv->timer_wheel);
- if (ret == 0) {
- priv->timer_wheel = NULL;
- }
}
static inline int32_t
br_init_signer (xlator_t *this, br_private_t *priv)
{
- int rc = 0;
int i = 0;
int32_t ret = -1;
@@ -1317,10 +1315,10 @@ br_init_signer (xlator_t *this, br_private_t *priv)
if (ret)
goto out;
- priv->timer_wheel = gf_tw_init_timers ();
+ priv->timer_wheel = glusterfs_global_timer_wheel (this);
if (!priv->timer_wheel) {
gf_log (this->name, GF_LOG_ERROR,
- "failed to initialize the timer wheel");
+ "global timer wheel unavailable");
goto out;
}
@@ -1329,7 +1327,7 @@ br_init_signer (xlator_t *this, br_private_t *priv)
priv->obj_queue = GF_CALLOC (1, sizeof (*priv->obj_queue),
gf_br_mt_br_ob_n_wk_t);
if (!priv->obj_queue)
- goto cleanup_timer;
+ goto cleanup_cond;
INIT_LIST_HEAD (&priv->obj_queue->objects);
for (i = 0; i < BR_WORKERS; i++) {
@@ -1352,14 +1350,9 @@ br_init_signer (xlator_t *this, br_private_t *priv)
GF_FREE (priv->obj_queue);
- cleanup_timer:
+ cleanup_cond:
/* that's explicit */
pthread_cond_destroy (&priv->object_cond);
- rc = gf_tw_cleanup_timers (priv->timer_wheel);
- if (rc == 0) {
- priv->timer_wheel = NULL;
- }
-
out:
return -1;
}
@@ -1460,7 +1453,6 @@ init (xlator_t *this)
void
fini (xlator_t *this)
{
- int ret = 0;
br_private_t *priv = this->private;
if (!priv)
@@ -1469,13 +1461,6 @@ fini (xlator_t *this)
if (!priv->iamscrubber)
br_fini_signer (this, priv);
br_free_children (this);
- if (priv->timer_wheel) {
- ret = gf_tw_cleanup_timers (priv->timer_wheel);
-
- if (ret == 0) {
- priv->timer_wheel = NULL;
- }
- }
this->private = NULL;
GF_FREE (priv);