summaryrefslogtreecommitdiffstats
path: root/glusterfsd
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 /glusterfsd
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 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c15
-rw-r--r--glusterfsd/src/glusterfsd.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index ca9940fc9d7..61ae4e497fc 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -74,6 +74,7 @@
#include "exports.h"
#include "daemon.h"
+#include "tw.h"
/* process mode definitions */
#define GF_SERVER_PROCESS 0
@@ -184,6 +185,8 @@ static struct argp_option gf_options[] = {
"Brick Port to be registered with Gluster portmapper" },
{"fopen-keep-cache", ARGP_FOPEN_KEEP_CACHE_KEY, "BOOL", OPTION_ARG_OPTIONAL,
"Do not purge the cache on file open"},
+ {"global-timer-wheel", ARGP_GLOBAL_TIMER_WHEEL, "BOOL",
+ OPTION_ARG_OPTIONAL, "Instantiate process global timer-wheel"},
{0, 0, 0, 0, "Fuse options:"},
{"direct-io-mode", ARGP_DIRECT_IO_MODE_KEY, "BOOL", OPTION_ARG_OPTIONAL,
@@ -1065,6 +1068,10 @@ parse_opts (int key, char *arg, struct argp_state *state)
break;
+ case ARGP_GLOBAL_TIMER_WHEEL:
+ cmd_args->global_timer_wheel = 1;
+ break;
+
case ARGP_GID_TIMEOUT_KEY:
if (!gf_string2int(arg, &cmd_args->gid_timeout)) {
cmd_args->gid_timeout_set = _gf_true;
@@ -2218,7 +2225,6 @@ out:
return ret;
}
-
/* This is the only legal global pointer */
glusterfs_ctx_t *glusterfsd_ctx;
@@ -2306,6 +2312,13 @@ main (int argc, char *argv[])
goto out;
}
+ /* do this _after_ deamonize() */
+ if (cmd->global_timer_wheel) {
+ ret = glusterfs_global_timer_wheel_init (ctx);
+ if (ret)
+ goto out;
+ }
+
ret = glusterfs_volumes_init (ctx);
if (ret)
goto out;
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index a16e0a65254..d183b0507fa 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -94,6 +94,7 @@ enum argp_option_keys {
ARGP_LOG_BUF_SIZE = 170,
ARGP_LOG_FLUSH_TIMEOUT = 171,
ARGP_SECURE_MGMT_KEY = 172,
+ ARGP_GLOBAL_TIMER_WHEEL = 173,
};
struct _gfd_vol_top_priv_t {