]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-max-cells-20080319
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 20 Mar 2008 00:00:28 +0000 (00:00 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 20 Mar 2008 00:00:28 +0000 (00:00 +0000)
LICENSE MIT

Add CM_CONFIGDEFAULT_CELLS (1024) to cm_config.h and a "Cells" registry
value that can be used to alter the limit at runtime.

No longer tie the number of cells to the number of stat cache objects.
1024 should be more than sufficient.

src/WINNT/afsd/afsd_init.c
src/WINNT/afsd/cm_config.h
src/WINNT/afsd/cm_memmap.c
src/WINNT/afsd/cm_memmap.h

index fcb2b1715b89d4f9dfb235319d1751c8fc9d23bb..14a3fff11c80e7c348cc2272324026f3cacd05c0 100644 (file)
@@ -554,6 +554,7 @@ int afsd_InitCM(char **reasonP)
     long logChunkSize;
     DWORD stats;
     DWORD volumes;
+    DWORD cells;
     DWORD dwValue;
     DWORD rx_enable_peer_stats;
     DWORD rx_enable_process_stats;
@@ -788,6 +789,16 @@ int afsd_InitCM(char **reasonP)
         afsi_log("Default volume cache entries: %d", volumes);
     }
 
+    dummyLen = sizeof(cells);
+    code = RegQueryValueEx(parmKey, "Cells", NULL, NULL,
+                            (BYTE *) &cells, &dummyLen);
+    if (code == ERROR_SUCCESS)
+        afsi_log("Cell cache entries: %d", cells);
+    else {
+        cells = CM_CONFIGDEFAULT_CELLS;
+        afsi_log("Default cell cache entries: %d", cells);
+    }
+
     dummyLen = sizeof(ltt);
     code = RegQueryValueEx(parmKey, "LogoffTokenTransfer", NULL, NULL,
                             (BYTE *) &ltt, &dummyLen);
@@ -1232,7 +1243,7 @@ int afsd_InitCM(char **reasonP)
         
     cm_InitCallback();
 
-    code = cm_InitMappedMemory(virtualCache, cm_CachePath, stats, volumes, cm_chunkSize, cacheBlocks, blockSize);
+    code = cm_InitMappedMemory(virtualCache, cm_CachePath, stats, volumes, cells, cm_chunkSize, cacheBlocks, blockSize);
     afsi_log("cm_InitMappedMemory code %x", code);
     if (code != 0) {
         *reasonP = "error initializing cache file";
index 7926b917ce6f46bc1f520801d87829895419b619..d640af7586384239dfc90d96f887a3a310a74a4b 100644 (file)
@@ -13,6 +13,7 @@
 #define CM_CONFIGDEFAULT_CACHESIZE     98304
 #define CM_CONFIGDEFAULT_BLOCKSIZE     4096
 #define CM_CONFIGDEFAULT_ASYNCSTORESIZE        131072  /* 128K */
+#define CM_CONFIGDEFAULT_CELLS          1024
 #define CM_CONFIGDEFAULT_STATS         10000
 #define CM_CONFIGDEFAULT_CHUNKSIZE     18      /* 256KB */
 #define CM_CONFIGDEFAULT_DAEMONS       4
index 5fa86954b6414f016fd124e1bc070fb4130b59da..c0473b34fbc8342db5005daf1f84158441eba7ca 100644 (file)
@@ -622,14 +622,13 @@ GetMachineSid(PBYTE SidBuffer, DWORD SidSize)
 }
 
 int
-cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD chunkSize, 
-                    afs_uint64 cacheBlocks, afs_uint32 blockSize)
+cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD maxCells,
+                    DWORD chunkSize, afs_uint64 cacheBlocks, afs_uint32 blockSize)
 {
     HANDLE hf = INVALID_HANDLE_VALUE, hm;
     PSECURITY_ATTRIBUTES psa;
     int newFile = 1;
     afs_uint64 mappingSize;
-    DWORD maxCells = stats/4;
     DWORD volumeSerialNumber = 0;
     DWORD sidStringSize = 0;
     DWORD rc;
index ba0963d2ddad3977025dd9fe0b4420d52d4dfc8f..107302a64a4a080383a666408c96a3de7a70119c 100644 (file)
@@ -116,5 +116,5 @@ PSECURITY_ATTRIBUTES CreateCacheFileSA();
 VOID  FreeCacheFileSA(PSECURITY_ATTRIBUTES psa);
 int   cm_ShutdownMappedMemory(void);
 int   cm_ValidateMappedMemory(char * cachePath);
-int   cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD chunkSize, afs_uint64 cacheBlocks, afs_uint32 blockSize);
+int   cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, afs_uint32 blockSize);
 #endif /* CM_MEMMAP_H */
\ No newline at end of file