diff options
author | Raghavendra G <raghavendra@gluster.com> | 2011-06-14 01:41:56 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-14 22:37:46 -0700 |
commit | 90117ca1c28b54845d617cdba0887d6453f875a4 (patch) | |
tree | e95730cceb7ee904d6ae992f8e9b5b18311b07a9 | |
parent | aae8ad0cf080ff3e4f704f3bcccef39a07cabb05 (diff) |
performance/read-ahead: dump pages in read-ahead cache.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 1059 (enhancements for getting statistics from performance translators)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index d41931eeca8..6358b4f48e8 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -793,6 +793,96 @@ unwind: } +void +ra_page_dump (struct ra_page *page, char *key_prefix) +{ + int i = 0; + call_frame_t *frame = NULL; + char key[GF_DUMP_MAX_BUF_LEN] = {0, }; + ra_waitq_t *trav = NULL; + + if (page == NULL) { + goto out; + } + + gf_proc_dump_build_key (key, key_prefix, "offset"); + gf_proc_dump_write (key, "%"PRId64, page->offset); + + gf_proc_dump_build_key (key, key_prefix, "size"); + gf_proc_dump_write (key, "%"PRId64, page->size); + + gf_proc_dump_build_key (key, key_prefix, "dirty"); + gf_proc_dump_write (key, "%s", page->dirty ? "yes" : "no"); + + gf_proc_dump_build_key (key, key_prefix, "ready"); + gf_proc_dump_write (key, "%s", page->ready ? "yes" : "no"); + + for (trav = page->waitq; trav; trav = trav->next) { + frame = trav->data; + gf_proc_dump_build_key (key, key_prefix, "waiting-frame[%d]", + i++); + gf_proc_dump_write (key, "%"PRId64, frame->root->unique); + } + +out: + return; +} + +int32_t +ra_fdctx_dump (xlator_t *this, fd_t *fd) +{ + ra_file_t *file = NULL; + ra_page_t *page = NULL; + int32_t ret = 0, i = 0; + uint64_t tmp_file = 0; + char key[GF_DUMP_MAX_BUF_LEN] = {0, }; + char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, }; + + fd_ctx_get (fd, this, &tmp_file); + file = (ra_file_t *)(long)tmp_file; + + if (file == NULL) { + ret = 0; + goto out; + } + + gf_proc_dump_build_key (key_prefix, + "xlator.performance.read-ahead", + "file"); + + gf_proc_dump_add_section (key_prefix); + + gf_proc_dump_build_key (key, key_prefix, "fd"); + gf_proc_dump_write (key, "%p", fd); + + gf_proc_dump_build_key (key, key_prefix, "disabled"); + gf_proc_dump_write (key, "%s", file->disabled ? "yes" : "no"); + + if (file->disabled) { + ret = 0; + goto out; + } + + gf_proc_dump_build_key (key, key_prefix, "page-size"); + gf_proc_dump_write (key, "%"PRId64, file->page_size); + + gf_proc_dump_build_key (key, key_prefix, "page-count"); + gf_proc_dump_write (key, "%u", file->page_count); + + gf_proc_dump_build_key (key, key_prefix, + "next-expected-offset-for-sequential-reads"); + gf_proc_dump_write (key, "%"PRId64, file->offset); + + for (page = file->pages.next; page != &file->pages; + page = page->next) { + gf_proc_dump_build_key (key, key_prefix, "page[%d]", i++); + ra_page_dump (page, key_prefix); + } + +out: + return ret; +} + int ra_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) { @@ -1063,6 +1153,7 @@ struct xlator_cbks cbks = { struct xlator_dumpops dumpops = { .priv = ra_priv_dump, + .fdctx = ra_fdctx_dump, }; struct volume_options options[] = { |