diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2010-07-11 06:33:17 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-07-12 06:39:31 -0700 |
commit | 9563c51ddeedee87a1d71defc20c0a7f06f24d23 (patch) | |
tree | 48ef1aa0239be612c0baa841fd2838e925993105 /xlators | |
parent | 915adb9c1291d140e57765b7fad0c5bb0e7d5ed5 (diff) |
dump total files cached in quick-read in statedump information
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1059 (enhancements for getting statistics from performance translators)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/performance/quick-read/src/quick-read.c | 24 |
1 files changed, 24 insertions, 0 deletions
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; } |