From 45a5cea1ad028bdff5f33770df8ecdd9ac69b6f1 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 17 Apr 2017 15:50:07 +0530 Subject: core: make the per glusterfs_ctx_t timer-wheel refcounted xlators can use a 'global' timer-wheel for scheduling events. This timer-wheel is managed per glusterfs_ctx_t, but does not need to be allocated for every graph. When an xlator wants to use the timer-wheel, it will be instanciated on demand, and provided to xlators that request it later on. By adding a reference counter to the glusterfs_ctx_t for the timer-wheel, the threads and structures can be cleaned up when the last xlator does not have a need for it anymore. In general, the xlators request the timer-wheel in init(), and they should return it in fini(). Because the timer-wheel is managed per glusterfs_ctx_t, the functions can be added to ctx.c and do not need to live in their very minimal tw.[ch] files. >Reported-by: Poornima G >Signed-off-by: Niels de Vos >Reviewed-on: https://review.gluster.org/17068 >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Smoke: Gluster Build System >Reviewed-by: Amar Tumballi >Reviewed-by: Zhou Zhengping >Reviewed-by: Kaleb KEITHLEY >(cherry picked from commit 73fcf3a874b2049da31d01b8363d1ac85c9488c2) Change-Id: I19d225b39aaa272d9005ba7adc3104c3764f1572 BUG: 1450267 Reviewed-on: https://review.gluster.org/17262 Tested-by: Poornima G Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- glusterfsd/src/glusterfsd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index cb92cbee867..bd10dff8430 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -80,7 +80,6 @@ #include "exports.h" #include "daemon.h" -#include "tw.h" /* using argp for command line parsing */ @@ -2510,9 +2509,10 @@ main (int argc, char *argv[]) /* do this _after_ daemonize() */ if (cmd->global_timer_wheel) { - ret = glusterfs_global_timer_wheel_init (ctx); - if (ret) + if (!glusterfs_ctx_tw_get (ctx)) { + ret = -1; goto out; + } } ret = glusterfs_volumes_init (ctx); -- cgit