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 f26affbd475..cc2e5cc5b40 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -91,8 +91,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; } @@ -724,7 +724,7 @@ glfs_poller(void *data) fs = data; - event_dispatch(fs->ctx->event_pool); + gf_event_dispatch(fs->ctx->event_pool); return NULL; } @@ -1188,7 +1188,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); @@ -1357,7 +1357,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 a2c4496a5d8..8a3f02dff15 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; @@ -863,7 +863,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 7a52313392a..5f252f7da04 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1732,8 +1732,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"); @@ -2889,7 +2889,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 527df5106fc..13b42002b59 100644 --- a/libglusterfs/src/event.c +++ b/libglusterfs/src/event.c @@ -24,7 +24,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; @@ -53,8 +53,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; @@ -67,7 +68,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; @@ -80,7 +81,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; @@ -93,8 +94,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; @@ -107,7 +108,7 @@ out: } int -event_dispatch(struct event_pool *event_pool) +gf_event_dispatch(struct event_pool *event_pool) { int ret = -1; @@ -122,7 +123,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; @@ -136,7 +137,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; @@ -177,13 +178,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 @@ -194,7 +195,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}; @@ -232,8 +233,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; @@ -247,7 +248,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; @@ -282,7 +283,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) @@ -294,7 +295,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 a921b4133a9..2d2466377cd 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -442,16 +442,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 1c6004c9045..5bf911fc8c0 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1126,7 +1126,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; @@ -1315,8 +1315,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: @@ -2546,7 +2546,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_notify(this, RPC_TRANSPORT_MSG_RECEIVED, pollin); @@ -2670,10 +2670,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 @@ -2707,8 +2707,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) { @@ -2762,7 +2762,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) { @@ -2831,7 +2831,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; @@ -2867,7 +2867,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); @@ -2981,7 +2981,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: @@ -3042,7 +3042,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)", @@ -3185,7 +3185,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) { @@ -3562,9 +3562,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; " @@ -3738,9 +3738,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, @@ -3809,8 +3809,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: @@ -3927,8 +3927,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 cf35175c3bc..512d414d7a7 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 1d2cf453e7b..b87b08e47dc 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -2016,7 +2016,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 ebded415c38..ad6e9329018 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -1114,7 +1114,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); @@ -1337,7 +1337,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 aa4d760e0b1..34b64828160 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2600,8 +2600,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 c90217e2f03..67122c03556 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -697,7 +697,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 @@ -1002,7 +1002,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(this->options, "config-directory")) { |