Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Update struct nchstats to 64 bit counters on all mac...



details:   https://anonhg.NetBSD.org/src/rev/2910e8ebc1a5
branches:  trunk
changeset: 805224:2910e8ebc1a5
user:      dennis <dennis%NetBSD.org@localhost>
date:      Wed Dec 24 19:50:04 2014 +0000

description:
Update struct nchstats to 64 bit counters on all machines.
Remove the now-redundant struct nchstats_sysctl. Containerize
structure member names with a macro to eliminate cut-and-paste.

diffstat:

 sys/sys/namei.src |  53 +++++++++++++++++++++++------------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diffs (68 lines):

diff -r a1a3c5334497 -r 2910e8ebc1a5 sys/sys/namei.src
--- a/sys/sys/namei.src Wed Dec 24 18:34:28 2014 +0000
+++ b/sys/sys/namei.src Wed Dec 24 19:50:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.src,v 1.33 2014/06/03 21:16:15 joerg Exp $       */
+/*     $NetBSD: namei.src,v 1.34 2014/12/24 19:50:04 dennis Exp $      */
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -288,36 +288,29 @@
 #endif
 
 /*
- * Stats on usefulness of namei caches.
- * XXX: should be 64-bit counters.
+ * Stats on usefulness of namei caches.  A couple of structures are
+ * used for counting, with members having the same names but different
+ * types.  Containerize member names with the preprocessor to avoid
+ * cut-'n'-paste.  A (U) in the comment documents values that are
+ * incremented unlocked; we may treat these specially.
  */
-struct nchstats {
-       long    ncs_goodhits;           /* hits that we can really use */
-       long    ncs_neghits;            /* negative hits that we can use */
-       long    ncs_badhits;            /* hits we must drop */
-       long    ncs_falsehits;          /* hits with id mismatch */
-       long    ncs_miss;               /* misses */
-       long    ncs_long;               /* long names that ignore cache */
-       long    ncs_pass2;              /* names found with passes == 2 */
-       long    ncs_2passes;            /* number of times we attempt it */
-       long    ncs_revhits;            /* reverse-cache hits */
-       long    ncs_revmiss;            /* reverse-cache misses */
-};
+#define        _NAMEI_CACHE_STATS(type) {                                      \
+       type    ncs_goodhits;   /* hits that we can really use (U) */   \
+       type    ncs_neghits;    /* negative hits that we can use */     \
+       type    ncs_badhits;    /* hits we must drop */                 \
+       type    ncs_falsehits;  /* hits with id mismatch (U) */         \
+       type    ncs_miss;       /* misses */                            \
+       type    ncs_long;       /* long names that ignore cache */      \
+       type    ncs_pass2;      /* names found with passes == 2 (U) */  \
+       type    ncs_2passes;    /* number of times we attempt it (U) */ \
+       type    ncs_revhits;    /* reverse-cache hits */                \
+       type    ncs_revmiss;    /* reverse-cache misses */              \
+}
 
-struct nchstats_sysctl {
-       uint64_t ncs_goodhits;          /* hits that we can really use */
-       uint64_t ncs_neghits;           /* negative hits that we can use */
-       uint64_t ncs_badhits;           /* hits we must drop */
-       uint64_t ncs_falsehits;         /* hits with id mismatch */
-       uint64_t ncs_miss;              /* misses */
-       uint64_t ncs_long;              /* long names that ignore cache */
-       uint64_t ncs_pass2;             /* names found with passes == 2 */
-       uint64_t ncs_2passes;           /* number of times we attempt it */
-       uint64_t ncs_revhits;           /* reverse-cache hits */
-       uint64_t ncs_revmiss;           /* reverse-cache misses */
-};
+/*
+ * Sysctl deals with a uint64_t version of the stats and summary
+ * totals are kept that way.
+ */
+struct nchstats _NAMEI_CACHE_STATS(uint64_t);
 
-#ifdef _KERNEL
-extern struct nchstats nchstats;
-#endif
 /* #endif !_SYS_NAMEI_H_ (generated by gennameih.awk) */



Home | Main Index | Thread Index | Old Index