Linux: cache bypass: remove warning print before panic
[openafs.git] / src / afs / afs_dcache.c
index 32a4da0..f27e08a 100644 (file)
@@ -100,6 +100,18 @@ afs_int32 afs_dcentries;   /*!< In-memory dcache entries */
 int dcacheDisabled = 0;
 
 struct afs_cacheOps afs_UfsCacheOps = {
+#if defined(AFS_SGI_ENV) && !defined(__c99)
+    osi_UFSOpen,
+    osi_UFSTruncate,
+    afs_osi_Read,
+    afs_osi_Write,
+    osi_UFSClose,
+    afs_UFSRead,
+    afs_UFSWrite,
+    afs_UFSGetDSlot,
+    afs_UFSGetVolSlot,
+    afs_UFSHandleLink,
+#else
     .open      = osi_UFSOpen,
     .truncate  = osi_UFSTruncate,
     .fread     = afs_osi_Read,
@@ -110,9 +122,22 @@ struct afs_cacheOps afs_UfsCacheOps = {
     .GetDSlot  = afs_UFSGetDSlot,
     .GetVolSlot = afs_UFSGetVolSlot,
     .HandleLink        = afs_UFSHandleLink,
+#endif
 };
 
 struct afs_cacheOps afs_MemCacheOps = {
+#if (defined(AFS_SGI_ENV) && !defined(__c99))
+    afs_MemCacheOpen,
+    afs_MemCacheTruncate,
+    afs_MemReadBlk,
+    afs_MemWriteBlk,
+    afs_MemCacheClose,
+    afs_MemRead,
+    afs_MemWrite,
+    afs_MemGetDSlot,
+    afs_MemGetVolSlot,
+    afs_MemHandleLink,
+#else
     .open      = afs_MemCacheOpen,
     .truncate  = afs_MemCacheTruncate,
     .fread     = afs_MemReadBlk,
@@ -123,6 +148,7 @@ struct afs_cacheOps afs_MemCacheOps = {
     .GetDSlot  = afs_MemGetDSlot,
     .GetVolSlot        = afs_MemGetVolSlot,
     .HandleLink        = afs_MemHandleLink,
+#endif
 };
 
 int cacheDiskType;             /*Type of backing disk for cache */
@@ -1466,10 +1492,9 @@ afs_FindDCache(register struct vcache *avc, afs_size_t abyte)
  *
  * \return The new dcache.
  */
-struct dcache *afs_AllocDCache(struct vcache *avc,
-                               afs_int32 chunk,
-                               afs_int32 lock,
-                               struct VenusFid *ashFid)
+struct dcache *
+afs_AllocDCache(struct vcache *avc, afs_int32 chunk, afs_int32 lock,
+               struct VenusFid *ashFid)
 {
     struct dcache *tdc = NULL;
     afs_uint32 size = 0;
@@ -1799,9 +1824,6 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte,
                        break;
                    /* If we can't get space for 5 mins we give up and panic */
                    if (++downDCount > 300) {
-#if defined(AFS_CACHE_BYPASS)
-                       afs_warn("GetDCache calling osi_Panic: No space in five minutes.\n downDCount: %d\n aoffset: %d alen: %d\n", downDCount, aoffset, alen);
-#endif
                        osi_Panic("getdcache");
                     }
                    ReleaseWriteLock(&afs_xdcache);
@@ -2526,6 +2548,7 @@ afs_WriteThroughDSlots(void)
        theader.firstCSize = AFS_FIRSTCSIZE;
        theader.otherCSize = AFS_OTHERCSIZE;
        theader.version = AFS_CI_VERSION;
+       theader.dataSize = sizeof(struct fcache);
        afs_osi_Write(afs_cacheInodep, 0, &theader, sizeof(theader));
     }
     ReleaseWriteLock(&afs_xdcache);
@@ -2884,7 +2907,7 @@ afs_InitCacheFile(char *afile, ino_t ainode)
        }
     } else {
        /* Add any other 'complex' inode types here ... */
-#if defined(UKERNEL) || !(defined(LINUX_USE_FH) || defined(AFS_CACHE_VNODE_PATH))
+#if !defined(AFS_LINUX26_ENV) && !defined(AFS_CACHE_VNODE_PATH)
        tdc->f.inode.ufs = ainode;
 #else
        osi_Panic("Can't init cache with inode numbers when complex inodes are "
@@ -3028,12 +3051,12 @@ afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, int aflags)
        /* ablocks is reported in 1K blocks */
        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");
+           afs_warn("afsd: memory cache too large for available memory.\n");
+           afs_warn("afsd: AFS files cannot be accessed.\n\n");
            dcacheDisabled = 1;
            afiles = ablocks = 0;
        } else
-           printf("Memory cache: Allocating %d dcache entries...",
+           afs_warn("Memory cache: Allocating %d dcache entries...",
                   aDentries);
     } else {
        cacheDiskType = AFS_FCACHE_TYPE_UFS;
@@ -3201,7 +3224,8 @@ shutdown_dcache(void)
 struct dcache *
 afs_ObtainDCacheForWriting(struct vcache *avc, afs_size_t filePos, 
                           afs_size_t len, struct vrequest *areq,
-                          int noLock) {
+                          int noLock)
+{
     struct dcache *tdc = NULL;
     afs_size_t offset;
 
@@ -3330,7 +3354,7 @@ afs_MakeShadowDir(struct vcache *avc, struct dcache *adc)
     /* Alloc a 4k block. */
     data = (char *) afs_osi_Alloc(4096);
     if (!data) {
-       printf("afs_MakeShadowDir: could not alloc data\n");
+       afs_warn("afs_MakeShadowDir: could not alloc data\n");
        ret_code = ENOMEM;
        goto done;
     }