diff options
author | vinayak hegde <vinayak@gluster.com> | 2009-10-20 07:18:16 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-20 10:18:01 -0700 |
commit | 61d0ad544322ea0e0e9b0549662b8ca912641951 (patch) | |
tree | 8daf230deb1b7eb561ed16d38cf99074b1e968e7 /xlators/performance/read-ahead/src | |
parent | f8d40aad7e21389911b151d6445dd8197bec0049 (diff) |
performance/read-ahead: Process state dump operations are added.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 213 (Support for process state dump)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=213
Diffstat (limited to 'xlators/performance/read-ahead/src')
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 99edd6011..92fc6d1da 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -34,6 +34,7 @@ #include "dict.h" #include "xlator.h" #include "read-ahead.h" +#include "statedump.h" #include <assert.h> #include <sys/time.h> @@ -789,6 +790,48 @@ ra_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) return 0; } +int +ra_priv_dump (xlator_t *this) +{ + ra_conf_t *conf = NULL; + int ret = -1; + char key[GF_DUMP_MAX_BUF_LEN]; + char key_prefix[GF_DUMP_MAX_BUF_LEN]; + + if (!this) + return -1; + + conf = this->private; + if (!conf) { + gf_log (this->name, GF_LOG_WARNING, + "conf null in xlator"); + return -1; + } + + ret = pthread_mutex_trylock (&conf->conf_lock); + if (ret) { + gf_log ("", GF_LOG_WARNING, "Unable to lock client %s" + " errno: %d", this->name, errno); + return -1; + } + + + gf_proc_dump_build_key (key_prefix, + "xlator.performance.read-ahead", + "priv"); + + gf_proc_dump_add_section (key_prefix); + gf_proc_dump_build_key (key, key_prefix, "page_size"); + gf_proc_dump_write (key, "%d", conf->page_size); + gf_proc_dump_build_key (key, key_prefix, "page_count"); + gf_proc_dump_write (key, "%d", conf->page_count); + gf_proc_dump_build_key (key, key_prefix, "force_atime_update"); + gf_proc_dump_write (key, "%d", conf->force_atime_update); + + pthread_mutex_unlock (&conf->conf_lock); + + return 0; +} int init (xlator_t *this) @@ -902,6 +945,10 @@ struct xlator_cbks cbks = { .release = ra_release, }; +struct xlator_dumpops dumpops = { + .priv = ra_priv_dump, +}; + struct volume_options options[] = { { .key = {"force-atime-update"}, .type = GF_OPTION_TYPE_BOOL |