diff options
author | Vijay Bellur <vijay@gluster.com> | 2012-02-14 14:48:43 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-02-14 02:58:15 -0800 |
commit | cd3ad588f206a902027e6045e15c55380f33998d (patch) | |
tree | 84b3e56c9b801b953b495483bce221a6fb25ad87 /xlators | |
parent | fa580e9299e09562c395bd464f3a1cf8a1116d6e (diff) |
nfs/server: Add counters for hard resolutionv3.2.6qa3
Change-Id: Id7b26731b750b63d645222dde18cd9fe4ed54018
BUG: 785314
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Reviewed-on: http://review.gluster.com/2745
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 53 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.h | 8 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 28 |
3 files changed, 85 insertions, 4 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index fb664715218..6f0e4132899 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 diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index ed91b79bb42..a015cb6cac5 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -58,6 +58,12 @@ struct nfs_initer_list { rpcsvc_program_t *program; }; +typedef struct nfs_hard_res_stats { + int64_t ino_cnt; + int64_t entry_cnt; + int64_t intvl_ino_cnt; + int64_t intvl_entry_cnt; +} nfs_hard_res_stats_t; struct nfs_state { rpcsvc_t *rpcsvc; @@ -74,6 +80,8 @@ struct nfs_state { int dynamicvolumes; int enable_ino32; unsigned int override_portnum; + gf_lock_t lock; + nfs_hard_res_stats_t res_stat; }; #define gf_nfs_dvm_on(nfsstt) (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON) diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 1c4f69fad22..e59d3ba7601 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -2909,8 +2909,9 @@ err: int nfs3_fh_resolve_inode_hard (nfs3_call_state_t *cs) { - int ret = -EFAULT; - nfs_user_t nfu = {0, }; + int ret = -EFAULT; + nfs_user_t nfu = {0, }; + struct nfs_state *nfs = NULL; if (!cs) return ret; @@ -2929,6 +2930,16 @@ nfs3_fh_resolve_inode_hard (nfs3_call_state_t *cs) ", hashcount: %d, current hashidx %d", uuid_utoa (cs->resolvefh.gfid), cs->resolvefh.hashcount, cs->hashidx); + + nfs = THIS->private; + + LOCK (&nfs->lock); + { + nfs->res_stat.ino_cnt++; + nfs->res_stat.intvl_ino_cnt++; + } + UNLOCK (&nfs->lock); + ret = nfs_root_loc_fill (cs->vol->itable, &cs->resolvedloc); if (ret == 0) { @@ -2951,8 +2962,9 @@ out: int nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs) { - int ret = -EFAULT; - nfs_user_t nfu = {0, }; + int ret = -EFAULT; + nfs_user_t nfu = {0, }; + struct nfs_state *nfs = NULL; if (!cs) return ret; @@ -2962,6 +2974,14 @@ nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs) gf_log (GF_NFS3, GF_LOG_TRACE, "FH hard resolution: gfid: %s " ", entry: %s, hashidx: %d", uuid_utoa (cs->resolvefh.gfid), cs->resolventry, cs->hashidx); + nfs = THIS->private; + + LOCK (&nfs->lock); + { + nfs->res_stat.entry_cnt++; + nfs->res_stat.intvl_entry_cnt++; + } + UNLOCK (&nfs->lock); ret = nfs_entry_loc_fill (cs->vol->itable, cs->resolvefh.gfid, cs->resolventry, &cs->resolvedloc, |