summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/Makefile.am7
-rw-r--r--libglusterfs/src/glusterfs.h8
-rw-r--r--libglusterfs/src/tw.c25
-rw-r--r--libglusterfs/src/tw.h23
4 files changed, 60 insertions, 3 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index cdec56a2b51..c7b85bdf839 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -5,7 +5,7 @@ libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \
-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
-I$(top_srcdir)/rpc/rpc-lib/src/ -I$(CONTRIBDIR)/rbtree \
-I$(CONTRIBDIR)/libexecinfo ${ARGP_STANDALONE_CPPFLAGS} \
- -DSBIN_DIR=\"$(sbindir)\"
+ -DSBIN_DIR=\"$(sbindir)\" -I$(CONTRIBDIR)/timer-wheel
libglusterfs_la_LIBADD = @LEXLIB@ $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS)
libglusterfs_la_LDFLAGS = -version-info $(LIBGLUSTERFS_LT_VERSION)
@@ -28,7 +28,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
strfd.c parse-utils.c $(CONTRIBDIR)/mount/mntent.c \
$(CONTRIBDIR)/libexecinfo/execinfo.c quota-common-utils.c rot-buffs.c \
$(CONTRIBDIR)/timer-wheel/timer-wheel.c \
- $(CONTRIBDIR)/timer-wheel/find_last_bit.c
+ $(CONTRIBDIR)/timer-wheel/find_last_bit.c tw.c
nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c
@@ -47,7 +47,8 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h timespec.
$(CONTRIBDIR)/mount/mntent_compat.h lvm-defaults.h \
$(CONTRIBDIR)/libexecinfo/execinfo_compat.h \
unittest/unittest.h quota-common-utils.h rot-buffs.h \
- $(CONTRIBDIR)/timer-wheel/timer-wheel.h compat-uuid.h
+ $(CONTRIBDIR)/timer-wheel/timer-wheel.h compat-uuid.h \
+ tw.h
if !HAVE_LIBUUID
# FIXME: unbundle libuuid, see compat-uuid.h.
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 50a5dba86ee..e9b54535e66 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -434,6 +434,10 @@ struct _cmd_args {
int gid_timeout;
char gid_timeout_set;
int aux_gfid_mount;
+
+ /* need a process wide timer-wheel? */
+ int global_timer_wheel;
+
struct list_head xlator_options; /* list of xlator_option_t */
/* fuse options */
@@ -496,6 +500,8 @@ typedef enum {
MGMT_SSL_ALWAYS
} mgmt_ssl_t;
+struct tvec_base;
+
struct _glusterfs_ctx {
cmd_args_t cmd_args;
char *process_uuid;
@@ -570,6 +576,8 @@ struct _glusterfs_ctx {
pthread_cond_t notify_cond;
int notifying;
+ struct tvec_base *timer_wheel; /* global timer-wheel instance */
+
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;
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;
+}
diff --git a/libglusterfs/src/tw.h b/libglusterfs/src/tw.h
new file mode 100644
index 00000000000..e635cd2b496
--- /dev/null
+++ b/libglusterfs/src/tw.h
@@ -0,0 +1,23 @@
+/*
+ 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.
+*/
+
+#ifndef __TW_H__
+#define __TW_H__
+
+#include "xlator.h"
+#include "glusterfs.h"
+
+int
+glusterfs_global_timer_wheel_init (glusterfs_ctx_t *);
+
+struct tvec_base *
+glusterfs_global_timer_wheel (xlator_t *);
+
+#endif /* __TW_H__ */