From: Andrew Deason Date: Thu, 14 Nov 2013 18:06:56 +0000 (-0600) Subject: afs: Fix some dcache-related comments X-Git-Tag: openafs-stable-1_8_0pre1~850 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=81b785774128e9501c1d758340b6f008403b5181 afs: Fix some dcache-related comments - 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 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/afs/afs.h b/src/afs/afs.h index 8684f22..39a8e57 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -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 diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index d3c329f..872757a 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -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