From 3cd983f62d4865d807b379ce7282a10f0039e76e Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 28 Apr 2011 11:48:18 -0500 Subject: [PATCH] libafs: Use vcount, not maxvcount to trim vcaches Every five minutes we afs_ShakeLooseVCaches to try and return the number of vcaches in use down to the originally configured -stat level (when we are using dynamic vcaches). We should calculate how many vcaches to flush based on the number of currently active vcaches (afs_vcount), not the peak number (afs_maxvcount). Otherwise, once we exceed the configured -stat level, we will always keep trying to flush numerous vcaches, even if we barely have any vcaches in use. Reviewed-on: http://gerrit.openafs.org/4584 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 2a2206bfe16815a6625fee4d37520e9676d88ab4) Change-Id: Ia8074673ac8c07770bb90016502a9ea860445660 Reviewed-on: http://gerrit.openafs.org/4621 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/afs_daemons.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index d60f8457d4..0149dcf3a3 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -201,10 +201,10 @@ afs_Daemon(void) if (afsd_dynamic_vcaches && (last5MinCheck + 300 < now)) { /* start with trying to drop us back to our base usage */ int anumber; - if (afs_maxvcount <= afs_cacheStats) - anumber = VCACHE_FREE; + if (afs_vcount <= afs_cacheStats) + anumber = VCACHE_FREE; else - anumber = VCACHE_FREE + (afs_maxvcount - afs_cacheStats); + anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats); ObtainWriteLock(&afs_xvcache, 734); afs_ShakeLooseVCaches(anumber);