From 9563c51ddeedee87a1d71defc20c0a7f06f24d23 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Sun, 11 Jul 2010 06:33:17 +0000 Subject: dump total files cached in quick-read in statedump information Signed-off-by: Raghavendra Bhat Signed-off-by: Anand V. Avati BUG: 1059 (enhancements for getting statistics from performance translators) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059 --- xlators/performance/quick-read/src/quick-read.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xlators') diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 70ef8858f1b..696e628e314 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -2343,6 +2343,11 @@ qr_priv_dump (xlator_t *this) char key[GF_DUMP_MAX_BUF_LEN]; char key_prefix[GF_DUMP_MAX_BUF_LEN]; qr_private_t *priv = NULL; + qr_inode_table_t *table = NULL; + uint32_t file_count = 0; + uint32_t i = 0; + qr_inode_t *curr = NULL; + if (!this) return -1; @@ -2356,6 +2361,9 @@ qr_priv_dump (xlator_t *this) return -1; } + table = &priv->table; + + gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read", "priv"); @@ -2367,6 +2375,22 @@ qr_priv_dump (xlator_t *this) gf_proc_dump_build_key (key, key_prefix, "cache_timeout"); gf_proc_dump_write (key, "%d", conf->cache_timeout); + if (!table) { + gf_log (this->name, GF_LOG_WARNING, + "table is NULL"); + goto out; + } else { + for (i = 0; i > conf->max_pri; i++) { + list_for_each_entry (curr, &table->lru[i], lru) { + file_count++; + } + } + } + + gf_proc_dump_build_key (key, key_prefix, "total_files_cached"); + gf_proc_dump_write (key, "%d", file_count); + +out: return 0; } -- cgit