afs: more cache truncation stats

Add counters for cache too full and waiting to drain occurrences. These
will be used in later commits to indicate how often the cache truncation
is required and how often the cache manager is waiting for cache
truncation to complete.

Change-Id: I4aa802729f0910dff1fb3e90b2d44d36df8bf8f3
Reviewed-on: https://gerrit.openafs.org/13168
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Michael Meffie 2016-06-20 15:29:45 -04:00 committed by Benjamin Kaduk
parent 611507d8b5
commit 25792e2463
3 changed files with 10 additions and 0 deletions

View File

@ -697,6 +697,8 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
&& (afs_blocksUsed > PERCENT(CM_WAITFORDRAINPCT, afs_cacheBlocks))) {
if (afs_blocksUsed - afs_blocksDiscarded >
PERCENT(CM_WAITFORDRAINPCT, afs_cacheBlocks)) {
if (afs_WaitForCacheDrain == 0)
afs_WaitForCacheDrainCount++;
afs_WaitForCacheDrain = 1;
afs_osi_Sleep(&afs_WaitForCacheDrain);
}

View File

@ -1360,6 +1360,7 @@ extern afs_int32 *afs_dcnextTbl; /*Dcache hash table links */
extern afs_int32 afs_cacheFiles; /*Size of afs_indexTable */
extern afs_int32 afs_cacheBlocks; /*1K blocks in cache */
extern afs_int32 afs_cacheStats; /*Stat entries in cache */
extern afs_uint32 afs_WaitForCacheDrainCount;
extern struct vcache *afs_vhashT[VCSIZE]; /*Stat cache hash table */
extern struct afs_q afs_vhashTV[VCSIZE]; /* cache hash table on volume */
extern afs_int32 afs_initState; /*Initialization state */

View File

@ -95,6 +95,8 @@ afs_size_t afs_vmMappingEnd; /* !< For large files (>= 2GB) the VM
int afs_WaitForCacheDrain = 0;
int afs_TruncateDaemonRunning = 0;
int afs_CacheTooFull = 0;
afs_uint32 afs_CacheTooFullCount = 0;
afs_uint32 afs_WaitForCacheDrainCount = 0;
afs_int32 afs_dcentries; /*!< In-memory dcache entries */
@ -395,6 +397,7 @@ void
afs_MaybeWakeupTruncateDaemon(void)
{
if (!afs_CacheTooFull && afs_CacheIsTooFull()) {
afs_CacheTooFullCount++;
afs_CacheTooFull = 1;
if (!afs_TruncateDaemonRunning)
afs_osi_Wakeup((int *)afs_CacheTruncateDaemon);
@ -2435,6 +2438,8 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte,
ReleaseReadLock(&avc->lock);
while ((afs_blocksUsed - afs_blocksDiscarded) >
PERCENT(CM_WAITFORDRAINPCT, afs_cacheBlocks)) {
if (afs_WaitForCacheDrain == 0)
afs_WaitForCacheDrainCount++;
afs_WaitForCacheDrain = 1;
afs_osi_Sleep(&afs_WaitForCacheDrain);
}
@ -3781,6 +3786,8 @@ afs_ObtainDCacheForWriting(struct vcache *avc, afs_size_t filePos,
ReleaseWriteLock(&avc->lock);
if (afs_blocksUsed - afs_blocksDiscarded >
PERCENT(CM_WAITFORDRAINPCT, afs_cacheBlocks)) {
if (afs_WaitForCacheDrain == 0)
afs_WaitForCacheDrainCount++;
afs_WaitForCacheDrain = 1;
afs_osi_Sleep(&afs_WaitForCacheDrain);
}