Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Feb 2012 12:06:40 +0000 (UTC)
From:      Maxim Konovalov <maxim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232156 - head/sys/kern
Message-ID:  <201202251206.q1PC6eaF016823@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: maxim
Date: Sat Feb 25 12:06:40 2012
New Revision: 232156
URL: http://svn.freebsd.org/changeset/base/232156

Log:
  o Reduce chances for integer overflow.
  o More verbose sysctl description added.
  
  MFC after:	2 weeks
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Sat Feb 25 11:07:32 2012	(r232155)
+++ head/sys/kern/vfs_cache.c	Sat Feb 25 12:06:40 2012	(r232156)
@@ -369,7 +369,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND
 			maxlength = count;
 	}
 	n_nchash = nchash + 1;
-	pct = (used * 100 * 100) / n_nchash;
+	pct = (used * 100) / (n_nchash / 100);
 	error = SYSCTL_OUT(req, &n_nchash, sizeof(n_nchash));
 	if (error)
 		return (error);
@@ -386,7 +386,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND
 }
 SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD|
     CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I",
-    "nchash chain lengths");
+    "nchash statistics (number of total/used buckets, maximum chain length, usage percentage)");
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202251206.q1PC6eaF016823>