diff options
author | Amar Tumballi <amar@gluster.com> | 2010-10-01 08:01:14 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-01 09:33:50 -0700 |
commit | 24ec0fbc4bd145b93b80afa480d5cb4cf785717e (patch) | |
tree | 2122d11aab686dae4d439aecd0e543be33c11feb /xlators/protocol | |
parent | a3f90eeb0ad97e4f86aef603f95b0562ab18f36d (diff) |
stat enhancements
* dht to send 'setxattr' to all subvolumes in the layout
* server dumps info on total bytes read/written for 'trusted.io.stat.dump' key
* server dumps all the mount point IP for 'trusted.list.mount.point' key.
* io-stats dumps latency information only if measured
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1701 (better statistics gathering in glusterd)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1701
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 58 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.h | 3 | ||||
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 6 |
3 files changed, 67 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index e63bc200211..0743ede23b6 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -25,6 +25,8 @@ #include "server.h" #include "server-helpers.h" +#include <fnmatch.h> + int server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req) { @@ -1299,3 +1301,59 @@ readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp) return 0; } + +int +gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key) +{ + + server_conf_t *conf = NULL; + rpc_transport_t *xprt = NULL; + + conf = frame->this->private; + if (!conf) + return 0; + + if (fnmatch ("*list*mount*point*", key, 0) == 0) { + /* list all the client protocol connecting to this process */ + list_for_each_entry (xprt, &conf->xprt_list, list) { + gf_log ("mount-point-list", GF_LOG_INFO, + "%s", xprt->peerinfo.identifier); + } + } + + /* Add more options/keys here */ + + return 0; +} + +int +gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict) +{ + + data_pair_t *pair = NULL; + server_conf_t *conf = NULL; + rpc_transport_t *xprt = NULL; + uint64_t total_read = 0; + uint64_t total_write = 0; + + conf = frame->this->private; + if (!conf) + return 0; + + for (pair = dict->members_list; pair; pair = pair->next) { + /* this exact key is used in 'io-stats' too. + * But this is better place for this information dump. + */ + if (fnmatch ("*io*stat*dump", pair->key, 0) == 0) { + list_for_each_entry (xprt, &conf->xprt_list, list) { + total_read += xprt->total_bytes_read; + total_write += xprt->total_bytes_write; + } + gf_log ("stats", GF_LOG_INFO, + "total-read %"PRIu64", total-write %"PRIu64, + total_read, total_write); + } + } + + return 0; +} diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index 5786ae5b588..06f9beabba2 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -204,4 +204,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, int xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc); +int gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict); +int gf_server_check_getxattr_cmd (call_frame_t *frame, const char *name); + #endif /* !_SERVER_H */ diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 1b0c407ee5e..aa633c65bac 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -3420,6 +3420,9 @@ server_setxattr (rpcsvc_request_t *req) state->dict = dict; } + /* There can be some commands hidden in key, check and proceed */ + gf_server_check_setxattr_cmd (frame, dict); + resolve_and_resume (frame, server_setxattr_resume); return 0; @@ -3718,6 +3721,9 @@ server_getxattr (rpcsvc_request_t *req) if (args.namelen) state->name = gf_strdup (args.name); + /* There can be some commands hidden in key, check and proceed */ + gf_server_check_getxattr_cmd (frame, state->name); + resolve_and_resume (frame, server_getxattr_resume); out: return 0; |