From 722ed512220395af8a707756b49df67afacda795 Mon Sep 17 00:00:00 2001 From: Richard Wareing Date: Wed, 12 Feb 2014 18:37:55 -0800 Subject: xlators: add JSON FOP statistics dumps every N seconds Summary: - Adds a thread to the io-stats translator which dumps out statistics every N seconds where N is configurable by an option called "diagnostics.stats-dump-interval" - Thread cleanly starts/stops when translator is unloaded - Updates macros to use "Atomic Builtins" (e.g. intel CPU extentions) to use memory barries to update counters vs using locks. This should reduce overhead and prevent any deadlock bugs due to lock contention. Test Plan: - Test on development machine - Run prove -v tests/basic/stats-dump.t Change-Id: If071239d8fdc185e4e8fd527363cc042447a245d BUG: 1266476 Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/12209 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Avra Sengupta --- xlators/nfs/server/src/nfs.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index e057b17c3d6..4dda35c49ef 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -729,7 +729,7 @@ struct nfs_state * nfs_init_state (xlator_t *this) { struct nfs_state *nfs = NULL; - int ret = -1; + int i = 0, ret = -1; unsigned int fopspoolsize = 0; char *optstr = NULL; gf_boolean_t boolt = _gf_false; @@ -856,6 +856,23 @@ nfs_init_state (xlator_t *this) } } + if (dict_get (this->options, "transport.socket.bind-address")) { + ret = dict_get_str (this->options, + "transport.socket.bind-address", + &optstr); + if (ret < 0) { + gf_log (GF_NFS, GF_LOG_ERROR, "Failed to parse " + "transport.socket.bind-address string"); + } else { + this->instance_name = gf_strdup (optstr); + for (i = 0; i < strlen (this->instance_name); i++) { + if (this->instance_name[i] == '.' || + this->instance_name[i] == ':') + this->instance_name[i] = '_'; + } + } + } + if (dict_get(this->options, "transport.socket.listen-port") == NULL) { if (nfs->override_portnum) ret = gf_asprintf (&optstr, "%d", @@ -1531,6 +1548,7 @@ fini (xlator_t *this) nfs = (struct nfs_state *)this->private; gf_msg_debug (GF_NFS, 0, "NFS service going down"); nfs_deinit_versions (&nfs->versions, this); + GF_FREE (this->instance_name); return 0; } -- cgit