avoid downward vcache pressure when entries are free
authorDerrick Brashear <shadow@dementia.org>
Fri, 29 Apr 2011 07:59:19 +0000 (03:59 -0400)
committerDerrick Brashear <shadow@dementia.org>
Fri, 29 Apr 2011 15:26:08 +0000 (08:26 -0700)
we try to keep VCACHE_FREE entries free. if there's already that many free,
do nothing.

Change-Id: I7e92430329a17250f94d0435de7641fa331dd461
Reviewed-on: http://gerrit.openafs.org/4595
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/afs_daemons.c

index e6d2590..1b22812 100644 (file)
@@ -235,15 +235,13 @@ 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_vcount <= afs_cacheStats)
-                anumber = VCACHE_FREE;
-            else
-                anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats);
-
-           ObtainWriteLock(&afs_xvcache, 734);
-            afs_ShakeLooseVCaches(anumber);
-           ReleaseWriteLock(&afs_xvcache);
+            int anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats);
+
+           if (anumber > 0) {
+               ObtainWriteLock(&afs_xvcache, 734);
+               afs_ShakeLooseVCaches(anumber);
+               ReleaseWriteLock(&afs_xvcache);
+           }
             last5MinCheck = now;
         }