Avoid using afs_int64's, because this leads to gcc generating calls to
authorNickolai Zeldovich <kolya@mit.edu>
Sat, 28 Dec 2002 05:17:08 +0000 (05:17 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Sat, 28 Dec 2002 05:17:08 +0000 (05:17 +0000)
libgcc functions on Linux (which we don't have in the kernel).  Instead
be slightly more clever to achieve the same result.

src/afs/afs_dcache.c
src/afs/afs_memcache.c
src/afs/afs_prototypes.h

index addeb22..1275796 100644 (file)
@@ -3062,17 +3062,12 @@ 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 */
-
-       cachebytes = afiles;
-       cachebytes *= AFS_FIRSTCSIZE;
-       code = afs_InitMemCache(cachebytes, AFS_FIRSTCSIZE, aflags);
+       code = afs_InitMemCache(afiles, 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");
index a94c8d4..bbde69d 100644 (file)
@@ -34,7 +34,7 @@ static int memAllocMaySleep = 0;
 
 extern int cacheDiskType;
 
-int afs_InitMemCache(afs_int64 size, int blkSize, int flags)
+int afs_InitMemCache(int blkCount, int blkSize, int flags)
   {
       int index;
 
@@ -42,7 +42,7 @@ int afs_InitMemCache(afs_int64 size, int blkSize, int flags)
       if(blkSize)
          memCacheBlkSize = blkSize;
       
-      memMaxBlkNumber = size / memCacheBlkSize;
+      memMaxBlkNumber = blkCount;
       memCache = (struct memCacheEntry *)
          afs_osi_Alloc(memMaxBlkNumber * sizeof(struct memCacheEntry));
       if (flags & AFSCALL_INIT_MEMCACHE_SLEEP) {
index cf96576..267f849 100644 (file)
@@ -352,7 +352,7 @@ extern void shutdown_mariner(void);
 
 
 /* afs_memcache.c */
-extern int afs_InitMemCache(afs_int64 size, int blkSize, int flags);
+extern int afs_InitMemCache(int blkCount, 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);