diff options
-rw-r--r-- | api/src/glfs.c | 10 | ||||
-rw-r--r-- | cli/src/cli-rl.c | 6 | ||||
-rw-r--r-- | cli/src/cli.c | 6 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 6 | ||||
-rw-r--r-- | libglusterfs/src/event.c | 37 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs/gf-event.h | 25 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 20 | ||||
-rw-r--r-- | rpc/rpc-lib/src/autoscale-threads.c | 2 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 50 | ||||
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog.c | 4 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc-common.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 2 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 4 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 4 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 4 |
15 files changed, 92 insertions, 90 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index d13a99cc124..98054b6bdb6 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -92,8 +92,8 @@ glusterfs_ctx_defaults_init(glusterfs_ctx_t *ctx) goto err; } - ctx->event_pool = event_pool_new(DEFAULT_EVENT_POOL_SIZE, - STARTING_EVENT_THREADS); + ctx->event_pool = gf_event_pool_new(DEFAULT_EVENT_POOL_SIZE, + STARTING_EVENT_THREADS); if (!ctx->event_pool) { goto err; } @@ -725,7 +725,7 @@ glfs_poller(void *data) fs = data; - event_dispatch(fs->ctx->event_pool); + gf_event_dispatch(fs->ctx->event_pool); return NULL; } @@ -1189,7 +1189,7 @@ glusterfs_ctx_destroy(glusterfs_ctx_t *ctx) } /* Free the event pool */ - ret = event_pool_destroy(ctx->event_pool); + ret = gf_event_pool_destroy(ctx->event_pool); /* Free the iobuf pool */ iobuf_pool_destroy(ctx->iobuf_pool); @@ -1359,7 +1359,7 @@ pub_glfs_fini(struct glfs *fs) syncenv_destroy(ctx->env); /* Join the poller thread */ - if (event_dispatch_destroy(ctx->event_pool) < 0) + if (gf_event_dispatch_destroy(ctx->event_pool) < 0) ret = -1; } diff --git a/cli/src/cli-rl.c b/cli/src/cli-rl.c index b6f87b189aa..7a38a0b882a 100644 --- a/cli/src/cli-rl.c +++ b/cli/src/cli-rl.c @@ -112,7 +112,7 @@ cli_rl_stdin(int fd, int idx, int gen, void *data, int poll_out, int poll_in, rl_callback_read_char(); - event_handled(state->ctx->event_pool, fd, idx, gen); + gf_event_handled(state->ctx->event_pool, fd, idx, gen); return; } @@ -379,8 +379,8 @@ cli_rl_enable(struct cli_state *state) goto out; } - ret = event_register(state->ctx->event_pool, 0, cli_rl_stdin, state, 1, 0, - 0); + ret = gf_event_register(state->ctx->event_pool, 0, cli_rl_stdin, state, 1, + 0, 0); if (ret == -1) goto out; diff --git a/cli/src/cli.c b/cli/src/cli.c index d6f2e4a1d42..fac32d3e9ca 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -122,8 +122,8 @@ glusterfs_ctx_defaults_init(glusterfs_ctx_t *ctx) goto out; } - ctx->event_pool = event_pool_new(DEFAULT_EVENT_POOL_SIZE, - STARTING_EVENT_THREADS); + ctx->event_pool = gf_event_pool_new(DEFAULT_EVENT_POOL_SIZE, + STARTING_EVENT_THREADS); if (!ctx->event_pool) { gf_log("cli", GF_LOG_ERROR, "Failed to create event pool."); goto out; @@ -862,7 +862,7 @@ main(int argc, char *argv[]) if (ret) goto out; - ret = event_dispatch(ctx->event_pool); + ret = gf_event_dispatch(ctx->event_pool); out: // glusterfs_ctx_destroy (ctx); diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 8773f2d8536..cf6d9a7215c 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1766,8 +1766,8 @@ glusterfs_ctx_defaults_init(glusterfs_ctx_t *ctx) goto out; } - ctx->event_pool = event_pool_new(DEFAULT_EVENT_POOL_SIZE, - STARTING_EVENT_THREADS); + ctx->event_pool = gf_event_pool_new(DEFAULT_EVENT_POOL_SIZE, + STARTING_EVENT_THREADS); if (!ctx->event_pool) { gf_msg("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "ERROR: glusterfs event pool creation failed"); @@ -2914,7 +2914,7 @@ main(int argc, char *argv[]) if (ret) goto out; - ret = event_dispatch(ctx->event_pool); + ret = gf_event_dispatch(ctx->event_pool); out: // glusterfs_ctx_destroy (ctx); diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c index 35a2f5c896f..235128b6044 100644 --- a/libglusterfs/src/event.c +++ b/libglusterfs/src/event.c @@ -22,7 +22,7 @@ #include "glusterfs/syscall.h" struct event_pool * -event_pool_new(int count, int eventthreadcount) +gf_event_pool_new(int count, int eventthreadcount) { struct event_pool *event_pool = NULL; extern struct event_ops event_ops_poll; @@ -51,8 +51,9 @@ event_pool_new(int count, int eventthreadcount) } int -event_register(struct event_pool *event_pool, int fd, event_handler_t handler, - void *data, int poll_in, int poll_out, char notify_poller_death) +gf_event_register(struct event_pool *event_pool, int fd, + event_handler_t handler, void *data, int poll_in, + int poll_out, char notify_poller_death) { int ret = -1; @@ -65,7 +66,7 @@ out: } int -event_unregister(struct event_pool *event_pool, int fd, int idx) +gf_event_unregister(struct event_pool *event_pool, int fd, int idx) { int ret = -1; @@ -78,7 +79,7 @@ out: } int -event_unregister_close(struct event_pool *event_pool, int fd, int idx) +gf_event_unregister_close(struct event_pool *event_pool, int fd, int idx) { int ret = -1; @@ -91,8 +92,8 @@ out: } int -event_select_on(struct event_pool *event_pool, int fd, int idx_hint, - int poll_in, int poll_out) +gf_event_select_on(struct event_pool *event_pool, int fd, int idx_hint, + int poll_in, int poll_out) { int ret = -1; @@ -105,7 +106,7 @@ out: } int -event_dispatch(struct event_pool *event_pool) +gf_event_dispatch(struct event_pool *event_pool) { int ret = -1; @@ -120,7 +121,7 @@ out: } int -event_reconfigure_threads(struct event_pool *event_pool, int value) +gf_event_reconfigure_threads(struct event_pool *event_pool, int value) { int ret = -1; @@ -134,7 +135,7 @@ out: } int -event_pool_destroy(struct event_pool *event_pool) +gf_event_pool_destroy(struct event_pool *event_pool) { int ret = -1; int destroy = 0, activethreadcount = 0; @@ -175,13 +176,13 @@ poller_destroy_handler(int fd, int idx, int gen, void *data, int poll_out, } out: - event_handled(destroy->pool, fd, idx, gen); + gf_event_handled(destroy->pool, fd, idx, gen); return; } /* This function destroys all the poller threads. - * Note: to be called before event_pool_destroy is called. + * Note: to be called before gf_event_pool_destroy is called. * The order in which cleaning is performed: * - Register a pipe fd(this is for waking threads in poll()/epoll_wait()) * - Set the destroy mode, which this no new event registration will succeed @@ -192,7 +193,7 @@ out: * threads are destroyed) */ int -event_dispatch_destroy(struct event_pool *event_pool) +gf_event_dispatch_destroy(struct event_pool *event_pool) { int ret = -1, threadcount = 0; int fd[2] = {-1}; @@ -230,8 +231,8 @@ event_dispatch_destroy(struct event_pool *event_pool) /* From the main thread register an event on the pipe fd[0], */ - idx = event_register(event_pool, fd[0], poller_destroy_handler, &data, 1, 0, - 0); + idx = gf_event_register(event_pool, fd[0], poller_destroy_handler, &data, 1, + 0, 0); if (idx < 0) goto out; @@ -245,7 +246,7 @@ event_dispatch_destroy(struct event_pool *event_pool) } pthread_mutex_unlock(&event_pool->mutex); - ret = event_reconfigure_threads(event_pool, 0); + ret = gf_event_reconfigure_threads(event_pool, 0); if (ret < 0) goto out; @@ -280,7 +281,7 @@ event_dispatch_destroy(struct event_pool *event_pool) } pthread_mutex_unlock(&event_pool->mutex); - ret = event_unregister(event_pool, fd[0], idx); + ret = gf_event_unregister(event_pool, fd[0], idx); out: if (fd[0] != -1) @@ -292,7 +293,7 @@ out: } int -event_handled(struct event_pool *event_pool, int fd, int idx, int gen) +gf_event_handled(struct event_pool *event_pool, int fd, int idx, int gen) { int ret = 0; diff --git a/libglusterfs/src/glusterfs/gf-event.h b/libglusterfs/src/glusterfs/gf-event.h index 0305194d712..c0f05e7c83b 100644 --- a/libglusterfs/src/glusterfs/gf-event.h +++ b/libglusterfs/src/glusterfs/gf-event.h @@ -110,26 +110,27 @@ struct event_ops { }; struct event_pool * -event_pool_new(int count, int eventthreadcount); +gf_event_pool_new(int count, int eventthreadcount); int -event_select_on(struct event_pool *event_pool, int fd, int idx, int poll_in, - int poll_out); +gf_event_select_on(struct event_pool *event_pool, int fd, int idx, int poll_in, + int poll_out); int -event_register(struct event_pool *event_pool, int fd, event_handler_t handler, - void *data, int poll_in, int poll_out, char notify_poller_death); +gf_event_register(struct event_pool *event_pool, int fd, + event_handler_t handler, void *data, int poll_in, + int poll_out, char notify_poller_death); int -event_unregister(struct event_pool *event_pool, int fd, int idx); +gf_event_unregister(struct event_pool *event_pool, int fd, int idx); int -event_unregister_close(struct event_pool *event_pool, int fd, int idx); +gf_event_unregister_close(struct event_pool *event_pool, int fd, int idx); int -event_dispatch(struct event_pool *event_pool); +gf_event_dispatch(struct event_pool *event_pool); int -event_reconfigure_threads(struct event_pool *event_pool, int value); +gf_event_reconfigure_threads(struct event_pool *event_pool, int value); int -event_pool_destroy(struct event_pool *event_pool); +gf_event_pool_destroy(struct event_pool *event_pool); int -event_dispatch_destroy(struct event_pool *event_pool); +gf_event_dispatch_destroy(struct event_pool *event_pool); int -event_handled(struct event_pool *event_pool, int fd, int idx, int gen); +gf_event_handled(struct event_pool *event_pool, int fd, int idx, int gen); #endif /* _GF_EVENT_H_ */ diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 60b3f317cc8..92f05946176 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -438,16 +438,16 @@ eh_dump eh_new eh_save_history entry_copy -event_dispatch -event_dispatch_destroy -event_handled -event_pool_destroy -event_pool_new -event_reconfigure_threads -event_register -event_select_on -event_unregister -event_unregister_close +gf_event_dispatch +gf_event_dispatch_destroy +gf_event_handled +gf_event_pool_destroy +gf_event_pool_new +gf_event_reconfigure_threads +gf_event_register +gf_event_select_on +gf_event_unregister +gf_event_unregister_close fd_anonymous fd_anonymous_with_flags fd_bind diff --git a/rpc/rpc-lib/src/autoscale-threads.c b/rpc/rpc-lib/src/autoscale-threads.c index 2c53ebbf40e..a954ae7a27a 100644 --- a/rpc/rpc-lib/src/autoscale-threads.c +++ b/rpc/rpc-lib/src/autoscale-threads.c @@ -18,5 +18,5 @@ rpcsvc_autoscale_threads(glusterfs_ctx_t *ctx, rpcsvc_t *rpc, int incr) int thread_count = pool->eventthreadcount; pool->auto_thread_count += incr; - (void)event_reconfigure_threads(pool, thread_count + incr); + (void)gf_event_reconfigure_threads(pool, thread_count + incr); } diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index a5a1f2db88d..2fbcbf4a882 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1179,7 +1179,7 @@ __socket_reset(rpc_transport_t *this) memset(&priv->incoming, 0, sizeof(priv->incoming)); - event_unregister_close(this->ctx->event_pool, priv->sock, priv->idx); + gf_event_unregister_close(this->ctx->event_pool, priv->sock, priv->idx); priv->sock = -1; priv->idx = -1; @@ -1368,8 +1368,8 @@ __socket_ioq_churn(rpc_transport_t *this) if (list_empty(&priv->ioq)) { /* all pending writes done, not interested in POLLOUT */ - priv->idx = event_select_on(this->ctx->event_pool, priv->sock, - priv->idx, -1, 0); + priv->idx = gf_event_select_on(this->ctx->event_pool, priv->sock, + priv->idx, -1, 0); } out: @@ -2626,7 +2626,7 @@ socket_event_poll_in(rpc_transport_t *this, gf_boolean_t notify_handled) } if (notify_handled && (ret != -1)) - event_handled(ctx->event_pool, priv->sock, priv->idx, priv->gen); + gf_event_handled(ctx->event_pool, priv->sock, priv->idx, priv->gen); if (pollin) { rpc_transport_ref(this); @@ -2740,10 +2740,10 @@ ssl_rearm_event_fd(rpc_transport_t *this) fd = priv->sock; if (priv->ssl_error_required == SSL_ERROR_WANT_READ) - event_select_on(ctx->event_pool, fd, idx, 1, -1); + gf_event_select_on(ctx->event_pool, fd, idx, 1, -1); if (priv->ssl_error_required == SSL_ERROR_WANT_WRITE) - event_select_on(ctx->event_pool, fd, idx, -1, 1); - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_select_on(ctx->event_pool, fd, idx, -1, 1); + gf_event_handled(ctx->event_pool, fd, idx, gen); } static int @@ -2777,8 +2777,8 @@ ssl_handle_server_connection_attempt(rpc_transport_t *this) ret = ssl_complete_connection(this); if (ret == 0) { /* nothing to do */ - event_select_on(ctx->event_pool, fd, idx, 1, 0); - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_select_on(ctx->event_pool, fd, idx, 1, 0); + gf_event_handled(ctx->event_pool, fd, idx, gen); ret = 1; } else { if (errno == EAGAIN) { @@ -2832,7 +2832,7 @@ ssl_handle_client_connection_attempt(rpc_transport_t *this) ret = ssl_complete_connection(this); if (ret == 0) { ret = socket_connect_finish(this); - event_select_on(ctx->event_pool, fd, idx, 1, 0); + gf_event_select_on(ctx->event_pool, fd, idx, 1, 0); gf_log(this->name, GF_LOG_TRACE, ">>> completed client connect"); } else { if (errno == EAGAIN) { @@ -2901,7 +2901,7 @@ socket_handle_client_connection_attempt(rpc_transport_t *this) * return 1 */ ret = 1; - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_handled(ctx->event_pool, fd, idx, gen); } } return ret; @@ -2937,7 +2937,7 @@ socket_complete_connection(rpc_transport_t *this) * socket_server_event_handler() */ priv->accepted = _gf_true; - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_handled(ctx->event_pool, fd, idx, gen); ret = 1; } else { ret = socket_handle_client_connection_attempt(this); @@ -3051,7 +3051,7 @@ socket_event_handler(int fd, int idx, int gen, void *data, int poll_in, rpc_transport_unref(this); } else if (!notify_handled) { - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_handled(ctx->event_pool, fd, idx, gen); } out: @@ -3112,7 +3112,7 @@ socket_server_event_handler(int fd, int idx, int gen, void *data, int poll_in, new_sock = sys_accept(priv->sock, SA(&new_sockaddr), &addrlen, aflags); - event_handled(ctx->event_pool, fd, idx, gen); + gf_event_handled(ctx->event_pool, fd, idx, gen); if (new_sock == -1) { gf_log(this->name, GF_LOG_WARNING, "accept on %d failed (%s)", @@ -3278,7 +3278,7 @@ socket_server_event_handler(int fd, int idx, int gen, void *data, int poll_in, ret = rpc_transport_notify(this, RPC_TRANSPORT_ACCEPT, new_trans); if (ret != -1) { - new_priv->idx = event_register( + new_priv->idx = gf_event_register( ctx->event_pool, new_sock, socket_event_handler, new_trans, 1, 0, new_trans->notify_poller_death); if (new_priv->idx == -1) { @@ -3655,9 +3655,9 @@ socket_connect(rpc_transport_t *this, int port) refd = _gf_true; this->listener = this; - priv->idx = event_register(ctx->event_pool, priv->sock, - socket_event_handler, this, 1, 1, - this->notify_poller_death); + priv->idx = gf_event_register(ctx->event_pool, priv->sock, + socket_event_handler, this, 1, 1, + this->notify_poller_death); if (priv->idx == -1) { gf_log("", GF_LOG_WARNING, "failed to register the event; " @@ -3831,9 +3831,9 @@ socket_listen(rpc_transport_t *this) rpc_transport_ref(this); - priv->idx = event_register(ctx->event_pool, priv->sock, - socket_server_event_handler, this, 1, 0, - this->notify_poller_death); + priv->idx = gf_event_register(ctx->event_pool, priv->sock, + socket_server_event_handler, this, 1, 0, + this->notify_poller_death); if (priv->idx == -1) { gf_log(this->name, GF_LOG_WARNING, @@ -3902,8 +3902,8 @@ socket_submit_outgoing_msg(rpc_transport_t *this, rpc_transport_msg_t *msg) } if (need_poll_out) { /* first entry to wait. continue writing on POLLOUT */ - priv->idx = event_select_on(ctx->event_pool, priv->sock, priv->idx, - -1, 1); + priv->idx = gf_event_select_on(ctx->event_pool, priv->sock, + priv->idx, -1, 1); } } unlock: @@ -4020,8 +4020,8 @@ socket_throttle(rpc_transport_t *this, gf_boolean_t onoff) * registered fd mapping. */ if (priv->connected == 1) - priv->idx = event_select_on(this->ctx->event_pool, priv->sock, - priv->idx, (int)!onoff, -1); + priv->idx = gf_event_select_on(this->ctx->event_pool, priv->sock, + priv->idx, (int)!onoff, -1); } pthread_mutex_unlock(&priv->out_lock); return 0; diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c index d6acb37f3ef..59c98975cf5 100644 --- a/xlators/features/changelog/lib/src/gf-changelog.c +++ b/xlators/features/changelog/lib/src/gf-changelog.c @@ -102,8 +102,8 @@ gf_changelog_ctx_defaults_init(glusterfs_ctx_t *ctx) if (!ctx->iobuf_pool) goto free_pool; - ctx->event_pool = event_pool_new(GF_CHANGELOG_EVENT_POOL_SIZE, - GF_CHANGELOG_EVENT_THREAD_COUNT); + ctx->event_pool = gf_event_pool_new(GF_CHANGELOG_EVENT_POOL_SIZE, + GF_CHANGELOG_EVENT_THREAD_COUNT); if (!ctx->event_pool) goto free_pool; diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c index dcdcfb1c735..991d77bd837 100644 --- a/xlators/features/changelog/src/changelog-rpc-common.c +++ b/xlators/features/changelog/src/changelog-rpc-common.c @@ -28,7 +28,7 @@ changelog_rpc_poller(void *arg) { xlator_t *this = arg; - (void)event_dispatch(this->ctx->event_pool); + (void)gf_event_dispatch(this->ctx->event_pool); return NULL; } diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 131a3c2b7f2..10b5f82ad5a 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -2015,7 +2015,7 @@ init(xlator_t *this) GF_OPTION_INIT("event-threads", workers, int32, out); if (workers > 0 && workers != conf->workers) { conf->workers = workers; - ret = event_reconfigure_threads(this->ctx->event_pool, workers); + ret = gf_event_reconfigure_threads(this->ctx->event_pool, workers); if (ret) goto out; } diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index aef88acc37b..cab57bbf3c9 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -1115,7 +1115,7 @@ nfs_init_state(xlator_t *this) GF_OPTION_INIT("nfs.event-threads", nfs->event_threads, uint32, free_foppool); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); this->private = (void *)nfs; INIT_LIST_HEAD(&nfs->versions); @@ -1338,7 +1338,7 @@ nfs_reconfigure_state(xlator_t *this, dict_t *options) GF_OPTION_RECONF("nfs.event-threads", nfs->event_threads, options, uint32, out); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); ret = 0; out: diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 94d878a47fd..776e7160c51 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2637,8 +2637,8 @@ client_check_event_threads(xlator_t *this, clnt_conf_t *conf, int32_t old, return 0; conf->event_threads = new; - return event_reconfigure_threads(this->ctx->event_pool, - conf->event_threads); + return gf_event_reconfigure_threads(this->ctx->event_pool, + conf->event_threads); } int diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 45a5e96e31a..f79fe26641d 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -699,7 +699,7 @@ server_check_event_threads(xlator_t *this, server_conf_t *conf, int32_t new) return 0; } - return event_reconfigure_threads(pool, target); + return gf_event_reconfigure_threads(pool, target); } int @@ -1005,7 +1005,7 @@ server_cleanup(xlator_t *this, server_conf_t *conf) if (this->ctx->event_pool) { /* Free the event pool */ - (void)event_pool_destroy(this->ctx->event_pool); + (void)gf_event_pool_destroy(this->ctx->event_pool); } if (dict_get_sizen(this->options, "config-directory")) { |