afs: Fix some dcache-related comments
authorAndrew Deason <adeason@sinenomine.net>
Thu, 14 Nov 2013 18:06:56 +0000 (12:06 -0600)
committerDerrick Brashear <shadow@your-file-system.com>
Sun, 12 Jan 2014 19:38:11 +0000 (11:38 -0800)
 - The comments preceding the afs_CacheIsTooFull macro, describing the
   cache-related high and low water marks, are a little out of date.
   We start freeing on 90% space, not 95%, and we also can take into
   account how many free/used chunks we have.

 - afs_WakeCacheWaitersIfDrained looks at the number of non-used (free
   or discarded) blocks, not just free blocks.

Change-Id: I5bf923b3c24993294e752f4312737815d0102779
Reviewed-on: http://gerrit.openafs.org/10459
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/afs.h
src/afs/afs_dcache.c

index 8684f22..39a8e57 100644 (file)
@@ -1392,9 +1392,14 @@ extern struct brequest afs_brs[NBRS];    /* request structures */
     (((rw) == UIO_WRITE) ? afs_write(avc, uio, io, cred, 1) : afs_read(avc, uio, cred, 1))
 
 /* Cache size truncation uses the following low and high water marks:
- * If the cache is more than 95% full (CM_DCACHECOUNTFREEPCT), the cache
- * truncation daemon is awakened and will free up space until the cache is 85%
- * (CM_DCACHESPACEFREEPCT - CM_DCACHEEXTRAPCT) full.
+ * If the cache is more than 90% full by space (CM_DCACHESPACEFREEPCT) or
+ * 95% full by # of chunks (CM_DCACHECOUNTFREEPCT), the cache truncation
+ * daemon is awakened and will start freeing space. The cache truncation
+ * daemon will continue to free space until the cache is at most 85% full
+ * by space (CM_DCACHESPACEFREEPCT - CM_DCACHEEXTRAPCT). The cache truncation
+ * daemon will also try to free space until the cache is at most 90% full by
+ * chunks (CM_DCACHECOUNTFREEPCT - CM_DCACHEEXTRAPCT), but the 85% space limit
+ * is the only limit that we must hit.
  * afs_UFSWrite and afs_GetDCache (when it needs to fetch data) will wait on
  * afs_WaitForCacheDrain if the cache is 98% (CM_WAITFORDRAINPCT) full.
  * afs_GetDownD wakes those processes once the cache is 95% full
index d3c329f..872757a 100644 (file)
@@ -397,7 +397,8 @@ u_int afs_min_cache = 0;
 
 /*!
  * If there are waiters for the cache to drain, wake them if
- * the number of free cache blocks reaches the CM_CACHESIZEDDRAINEDPCT.
+ * the number of free or discarded cache blocks reaches the
+ * CM_CACHESIZEDDRAINEDPCT limit.
  *
  * \note Environment:
  *     This routine must be called with the afs_xdcache lock held