[OpenAFS-devel] Re: 1.3.77 on Linux 2.6.10 (Fedora Core 3 test): patches for partial success

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Wed, 12 Jan 2005 10:21:32 -0500


In message <Pine.GSO.4.61-042.0501120053540.10219@johnstown.andrew.cmu.edu>,Der
rick J Brashear writes:
>wow, i wish you hadn't lost that code.

its not actually all that complicated.  just not well tested.  you just
do the same thing that the osf port is doing.

here is a patch for the short term to get the inodes in bit and pieces:

Index: src/afs/afs_vcache.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_vcache.c,v
retrieving revision 1.69
diff -u -u -r1.69 afs_vcache.c
--- src/afs/afs_vcache.c	13 Oct 2004 00:36:59 -0000	1.69
+++ src/afs/afs_vcache.c	11 Jan 2005 22:36:39 -0000
@@ -2895,6 +2895,7 @@
     LOCK_INIT(&afs_xvcb, "afs_xvcb");
 
 #if	!defined(AFS_OSF_ENV)
+#ifdef OLD_STYLE
     /* Allocate and thread the struct vcache entries */
     tvp = (struct vcache *)afs_osi_Alloc(astatSize * sizeof(struct vcache));
     memset((char *)tvp, 0, sizeof(struct vcache) * astatSize);
@@ -2908,6 +2909,15 @@
 #ifdef  KERNEL_HAVE_PIN
     pin((char *)tvp, astatSize * sizeof(struct vcache));	/* XXX */
 #endif
+#else /* !OLD_STYLE */
+    printf("old style would have needed %d contiguous bytes\n", astatSize * sizeof(struct vcache));
+    Initial_freeVCList = freeVCList = tvp = (struct vcache *) afs_osi_Alloc(sizeof(struct vcache));
+    for (i = 0; i < astatSize; i++) {
+	tvp->nextfree = (struct vcache *) afs_osi_Alloc(sizeof(struct vcache));
+	tvp = tvp->nextfree;
+    }
+    tvp->nextfree = NULL;
+#endif /* OLD_STYLE */
 #endif
 
 
@@ -3019,13 +3029,23 @@
     }
     afs_cbrSpace = 0;
 
+#if	!defined(AFS_OSF_ENV)
+#ifdef OLD_STYLE
 #ifdef  KERNEL_HAVE_PIN
     unpin(Initial_freeVCList, afs_cacheStats * sizeof(struct vcache));
 #endif
-#if	!defined(AFS_OSF_ENV)
     afs_osi_Free(Initial_freeVCList, afs_cacheStats * sizeof(struct vcache));
-#endif
-#if	!defined(AFS_OSF_ENV)
+#else /* !OLD_STYLE */
+    {
+	struct vcache *tvp = Initial_freeVCList;
+	while (tvp) {
+		struct vcache *next = tvp->nextfree;
+
+		afs_osi_Free(tvp, sizeof(struct vcache));
+		tvp = next;
+	}
+    }
+#endif /* OLD_STYLE */
     freeVCList = Initial_freeVCList = 0;
 #endif
     RWLOCK_INIT(&afs_xvcache, "afs_xvcache");