diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index e2cedf08f9..81147d57ef 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -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); } diff --git a/src/afs/afs.h b/src/afs/afs.h index 407eb89024..3492627a84 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -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 */ diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 2a03f2b3c5..41eeb84e19 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -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); }