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/server/src/server-helpers.c | |
| 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/server/src/server-helpers.c')
| -rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 58 | 
1 files changed, 58 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; +}  | 
