avoid-long-windows-shell-timeouts-20040105
[openafs.git] / src / WINNT / afsd / cm_buf.c
index b4790d9..cf36cbd 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "afsd.h"
 
-void afsi_log();
+extern void afsi_log(char *pattern, ...);
 
 /* This module implements the buffer package used by the local transaction
  * system (cm).  It is initialized by calling cm_Init, which calls buf_Init;
@@ -401,6 +401,9 @@ long buf_AddBuffers(long nbuffers)
        HANDLE hm;
        long cs;
 
+    afsi_log("%d buffers being added to the existing cache of size %d",
+              nbuffers, buf_nbuffers);
+
        /*
         * Cache file mapping constrained by
         * system allocation granularity;
@@ -1408,3 +1411,39 @@ long buf_CleanVnode(struct cm_scache *scp, cm_user_t *userp, cm_req_t *reqp)
         /* done */
        return code;
 }
+
+/* dump the contents of the buf_hashTablepp. */
+int cm_DumpBufHashTable(FILE *outputFile, char *cookie)
+{
+    int zilch;
+    cm_buf_t *bp;
+    char output[1024];
+    int i;
+  
+    lock_ObtainRead(&buf_globalLock);
+  
+    sprintf(output, "%s - dumping buf_HashTable - buf_hashSize=%d\n", cookie, buf_hashSize);
+    WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+  
+    for (i = 0; i < buf_hashSize; i++)
+    {
+        for(bp = buf_hashTablepp[i]; bp; bp=bp->hashp) 
+        {
+            if (bp->refCount)
+            {
+                sprintf(output, "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d,"
+                        "vnode=%d, unique=%d), size=%d refCount=%d\n", 
+                        cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume, 
+                        bp->fid.vnode, bp->fid.unique, bp->size, bp->refCount);
+                WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+            }
+        }
+    }
+  
+    sprintf(output, "%s - Done dumping buf_HashTable.\n", cookie);
+    WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+
+    lock_ReleaseRead(&buf_globalLock);
+    return 0;
+}
+