From 755686d45a142bb97220e4bbd372dfe7c1630c4b Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Fri, 27 Dec 2002 03:51:51 +0000 Subject: [PATCH] Support memcache sizes larger than 2GB. --- src/afs/afs_dcache.c | 7 ++++++- src/afs/afs_memcache.c | 2 +- src/afs/afs_prototypes.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 2636c745f5..addeb22370 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -3062,12 +3062,17 @@ void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, /* * Use a memory cache instead of a disk cache */ + afs_int64 cachebytes; + cacheDiskType = AFS_FCACHE_TYPE_MEM; afs_cacheType = &afs_MemCacheOps; afiles = (afiles < aDentries) ? afiles : aDentries; /* min */ ablocks = afiles * (AFS_FIRSTCSIZE/1024); /* ablocks is reported in 1K blocks */ - code = afs_InitMemCache(afiles * AFS_FIRSTCSIZE, AFS_FIRSTCSIZE, aflags); + + cachebytes = afiles; + cachebytes *= AFS_FIRSTCSIZE; + code = afs_InitMemCache(cachebytes, AFS_FIRSTCSIZE, aflags); if (code != 0) { printf("afsd: memory cache too large for available memory.\n"); printf("afsd: AFS files cannot be accessed.\n\n"); diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index b0104326d3..a94c8d4e5f 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -34,7 +34,7 @@ static int memAllocMaySleep = 0; extern int cacheDiskType; -int afs_InitMemCache(int size, int blkSize, int flags) +int afs_InitMemCache(afs_int64 size, int blkSize, int flags) { int index; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 3caf48b9e6..cf9657629a 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -352,7 +352,7 @@ extern void shutdown_mariner(void); /* afs_memcache.c */ -extern int afs_InitMemCache(int size, int blkSize, int flags); +extern int afs_InitMemCache(afs_int64 size, int blkSize, int flags); extern int afs_MemCacheClose(char *file); extern void *afs_MemCacheOpen(ino_t blkno); extern int afs_MemReadBlk(register struct memCacheEntry *mceP, int offset, char *dest, int size);