summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/tw.c
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-04-24 10:10:35 +0530
committerNiels de Vos <ndevos@redhat.com>2015-05-10 05:27:40 -0700
commit1a217b2a0295ca4d9068ee5c17d6a4374cc5f8fc (patch)
tree7b3a92dd4e18fa5b01160630322ad1ae175abb2d /libglusterfs/src/tw.c
parent25bb1061642bcaedfdfcab859a07244c2276571f (diff)
core: Global timer-wheel
Instantiate a process wide global instance of the timer wheel data structure. Spawning glusterfs* process with option arg "--global-timer-wheel" instantiates a global instance of timer-wheel under global context (->ctx). Translators can make use of this process wide instance [via a call to glusterfs_global_timer_wheel()] instead of maintaining an instance of their own and possibly consuming more memory. Linux kernel too has a single instance of timer wheel where subsystems such as IO, networking, etc.. make use of. Bitrot daemon would be early consumers of this: bitrot translator instances for multiple volumes would track objects belonging to their respective bricks in this global expiry tracking data structure. This is also a first step to move GlusterFS timer mechanism to use timer-wheel. > Change-Id: Ie882df607e07acaced846ea269ebf1ece306d6ae > BUG: 1170075 > Signed-off-by: Venky Shankar <vshankar@redhat.com> > Reviewed-on: http://review.gluster.org/10380 > Tested-by: NetBSD Build System > Reviewed-by: Vijay Bellur <vbellur@redhat.com> > Tested-by: Gluster Build System <jenkins@build.gluster.com> Change-Id: I35c840daa9996a059699f8ea5af54c76ede7e09c Signed-off-by: Venky Shankar <vshankar@redhat.com> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> BUG: 1220041 Reviewed-on: http://review.gluster.org/10716 Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs/src/tw.c')
-rw-r--r--libglusterfs/src/tw.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libglusterfs/src/tw.c b/libglusterfs/src/tw.c
new file mode 100644
index 00000000000..fa11998aace
--- /dev/null
+++ b/libglusterfs/src/tw.c
@@ -0,0 +1,25 @@
+/*
+ Copyright (c) 2008-2015 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#include "tw.h"
+#include "timer-wheel.h"
+
+int
+glusterfs_global_timer_wheel_init (glusterfs_ctx_t *ctx)
+{
+ ctx->timer_wheel = gf_tw_init_timers();
+ return ctx->timer_wheel ? 0 : -1;
+}
+
+struct tvec_base *
+glusterfs_global_timer_wheel (xlator_t *this)
+{
+ return this->ctx->timer_wheel;
+}