From 1d52c60b22419feb32ae85958ade609a3c5fe232 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 20 Mar 2008 00:01:59 +0000 Subject: [PATCH] DEVEL15-windows-max-cells-20080319 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. (cherry picked from commit edbde00d6c3be0228b1647505d8483632cceaf39) --- src/WINNT/afsd/afsd_init.c | 13 ++++++++++++- src/WINNT/afsd/cm_config.h | 1 + src/WINNT/afsd/cm_memmap.c | 5 ++--- src/WINNT/afsd/cm_memmap.h | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index d162fe474..2275abfc9 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -556,6 +556,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; @@ -790,6 +791,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 *) <t, &dummyLen); @@ -1234,7 +1245,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"; diff --git a/src/WINNT/afsd/cm_config.h b/src/WINNT/afsd/cm_config.h index 7926b917c..d640af758 100644 --- a/src/WINNT/afsd/cm_config.h +++ b/src/WINNT/afsd/cm_config.h @@ -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 diff --git a/src/WINNT/afsd/cm_memmap.c b/src/WINNT/afsd/cm_memmap.c index 5fa86954b..c0473b34f 100644 --- a/src/WINNT/afsd/cm_memmap.c +++ b/src/WINNT/afsd/cm_memmap.c @@ -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; diff --git a/src/WINNT/afsd/cm_memmap.h b/src/WINNT/afsd/cm_memmap.h index ba0963d2d..107302a64 100644 --- a/src/WINNT/afsd/cm_memmap.h +++ b/src/WINNT/afsd/cm_memmap.h @@ -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 -- 2.39.5