From: Jeffrey Altman Date: Fri, 26 Aug 2005 14:48:07 +0000 (+0000) Subject: STABLE14-windows-remove-log-messages-20050826 X-Git-Tag: openafs-stable-1_4_0-rc2~8 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4324a088077c5e98281f8656ef5cd73772b7152f;p=packages%2Fo%2Fopenafs.git STABLE14-windows-remove-log-messages-20050826 The log message added to buf_LockedCleanAsync() during the debugging post 1.3.8201 is output for 1/10th of all buffers once every 5 seconds. This is a huge performance hit. Move the message so that it is only output for buffers that are actually dirty. Also, change the algorithm so that the sqrt() of the number of buffers are checked every 5 seconds instead of 1/10th. This will do a better job with very large cache sizes. (cherry picked from commit ee937439adc8d8ea214c9d53aee0ee5329697c80) --- diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index a564660d7..0073b03ea 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "afsd.h" #include "cm_memmap.h" @@ -109,7 +110,7 @@ void buf_IncrSyncer(long parm) bp = cm_data.buf_allp; bp->refCount++; lock_ReleaseWrite(&buf_globalLock); - nAtOnce = cm_data.buf_nbuffers / 10; + nAtOnce = (long)sqrt(cm_data.buf_nbuffers); while (buf_ShutdownFlag == 0) { #ifndef DJGPP i = SleepEx(5000, 1); @@ -562,9 +563,11 @@ void buf_LockedCleanAsync(cm_buf_t *bp, cm_req_t *reqp) while ((bp->flags & CM_BUF_DIRTY) == CM_BUF_DIRTY) { lock_ReleaseMutex(&bp->mx); + osi_Log1(buf_logp, "buf_LockedCleanAsync starts I/O on 0x%x", bp); code = (*cm_buf_opsp->Writep)(&bp->fid, &bp->offset, cm_data.buf_blockSize, 0, bp->userp, reqp); + osi_Log2(buf_logp, "buf_LockedCleanAsync I/O on 0x%x, done=%d", bp, code); lock_ObtainMutex(&bp->mx); if (code) @@ -578,7 +581,6 @@ void buf_LockedCleanAsync(cm_buf_t *bp, cm_req_t *reqp) }; /* do logging after call to GetLastError, or else */ - osi_Log2(buf_logp, "buf_CleanAsync starts I/O on 0x%x, done=%d", bp, code); /* if someone was waiting for the I/O that just completed or failed, * wake them up.