From cd3ad588f206a902027e6045e15c55380f33998d Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Tue, 14 Feb 2012 14:48:43 +0530 Subject: nfs/server: Add counters for hard resolution Change-Id: Id7b26731b750b63d645222dde18cd9fe4ed54018 BUG: 785314 Signed-off-by: Vijay Bellur Reviewed-on: http://review.gluster.com/2745 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/nfs/server/src/nfs.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'xlators/nfs/server/src/nfs.c') diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index fb6647152..6f0e41328 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -39,6 +39,7 @@ #include "mount3.h" #include "nfs3.h" #include "nfs-mem-types.h" +#include "statedump.h" /* Every NFS version must call this function with the init function * for its particular version. @@ -701,6 +702,8 @@ init (xlator_t *this) { goto err; } + LOCK_INIT (&nfs->lock); + gf_log (GF_NFS, GF_LOG_INFO, "NFS service started"); err: @@ -750,9 +753,59 @@ fini (xlator_t *this) return 0; } +int +nfs_priv_dump (xlator_t *this) +{ + + char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, }; + struct nfs_state *nfs = NULL; + int64_t ino_cnt = 0; + int64_t entry_cnt = 0; + int64_t intvl_ino_cnt = 0; + int64_t intvl_entry_cnt = 0; + + if (!this || !this->private) + goto out; + + nfs = this->private; + + gf_proc_dump_build_key (key_prefix, "xlator.nfs", + "priv"); + gf_proc_dump_add_section (key_prefix); + + LOCK (&nfs->lock); + { + intvl_ino_cnt = nfs->res_stat.intvl_ino_cnt; + intvl_entry_cnt = nfs->res_stat.intvl_entry_cnt; + ino_cnt = nfs->res_stat.ino_cnt; + entry_cnt = nfs->res_stat.entry_cnt; + + nfs->res_stat.intvl_ino_cnt = 0; + nfs->res_stat.intvl_entry_cnt = 0; + } + UNLOCK (&nfs->lock); + + gf_proc_dump_write ("Interval hard resolution (inode)", "%ld", + intvl_ino_cnt); + gf_proc_dump_write ("Interval hard resolution (entry)", "%ld", + intvl_entry_cnt); + gf_proc_dump_write ("Aggregate hard resolution (inode)", "%ld", + ino_cnt); + gf_proc_dump_write ("Aggregate hard resoluton (entry)", "%ld", + entry_cnt); + +out: + return 0; +} + struct xlator_cbks cbks = { }; struct xlator_fops fops = { }; +struct xlator_dumpops dumpops = { + .priv = nfs_priv_dump, +}; + + /* TODO: If needed, per-volume options below can be extended to be export + * specific also because after export-dir is introduced, a volume is not + * neccessarily an export whereas different subdirectories within that volume -- cgit