]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-vc-hashing-be-less-expensive-20050728
authorChas Williams <chas@cmf.nrl.navy.mil>
Thu, 13 Oct 2005 19:53:39 +0000 (19:53 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 13 Oct 2005 19:53:39 +0000 (19:53 +0000)
pullup the rest of this

src/afs/afs_vcache.c

index 2e903d8a0c8c21f8e5dc3aadb70b794973894dd6..ecc5f6381d3c32d25481dd59d9fbfc590ea0b362 100644 (file)
@@ -71,7 +71,7 @@ struct afs_q VLRU;            /*vcache LRU */
 afs_int32 vcachegen = 0;
 unsigned int afs_paniconwarn = 0;
 struct vcache *afs_vhashT[VCSIZE];
-struct afs_q afs_vhashTV[VCSIZE];
+struct vcache *afs_vhashTV[VCSIZE];
 static struct afs_cbr *afs_cbrHashT[CBRSIZE];
 afs_int32 afs_bulkStatsLost;
 int afs_norefpanic = 0;
@@ -132,8 +132,8 @@ int
 afs_FlushVCache(struct vcache *avc, int *slept)
 {                              /*afs_FlushVCache */
 
-    afs_int32 i, code;
-    struct vcache **uvc, *wvc;
+    afs_int32 i, code, j;
+    struct vcache **uvc, *wvc, **uvc2, *wvc2;
 
     *slept = 0;
     AFS_STATCNT(afs_FlushVCache);
@@ -181,8 +181,17 @@ afs_FlushVCache(struct vcache *avc, int *slept)
     }
 
     /* remove entry from the volume hash table */
-    QRemove(&avc->vhashq);
-
+    j = VCHashV(&avc->fid);
+    uvc2 = &afs_vhashTV[j];
+    for (wvc2 = *uvc2; wvc2; uvc2 = &wvc2->vhnext, wvc2 = *uvc2) {
+        if (avc == wvc2) {
+            *uvc2 = avc->vhnext;
+            avc->vhnext = (struct vcache *)NULL;
+            break;
+        }
+    }
+    if (!wvc || !wvc2)
+       osi_Panic("flushvcache");       /* not in correct hash bucket */
     if (avc->mvid)
        osi_FreeSmallSpace(avc->mvid);
     avc->mvid = (struct VenusFid *)0;
@@ -599,6 +608,7 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp)
 #ifdef AFS_OSF_ENV
     struct vcache *nvc;
 #endif /* AFS_OSF_ENV */
+    struct afs_q *tq, *uq;
     int code, fv_slept;
 
     AFS_STATCNT(afs_NewVCache);
@@ -884,8 +894,8 @@ restart:
     j = VCHashV(afid);
 
     tvc->hnext = afs_vhashT[i];
-    afs_vhashT[i] = tvc;
-    QAdd(&afs_vhashTV[i], &tvc->vhashq);
+    tvc->vhnext = afs_vhashTV[j];
+    afs_vhashT[i] = afs_vhashTV[j] = tvc;
 
     if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) {
        refpanic("NewVCache VLRU inconsistent");
@@ -2862,9 +2872,10 @@ afs_vcacheInit(int astatSize)
 #endif /* AFS_SGI62_ENV */
     }
 #endif
+
     QInit(&VLRU);
-    for(i = 0; i < VCSIZE; ++i)
-       QInit(&afs_vhashTV[i]);
+
+
 }
 
 /*
@@ -2940,7 +2951,7 @@ shutdown_vcache(void)
 
                afs_FreeAllAxs(&(tvc->Access));
            }
-           afs_vhashT[i] = 0;
+           afs_vhashT[i] = afs_vhashTV[i] = 0;
        }
     }
     /*
@@ -2965,6 +2976,5 @@ shutdown_vcache(void)
     RWLOCK_INIT(&afs_xvcache, "afs_xvcache");
     LOCK_INIT(&afs_xvcb, "afs_xvcb");
     QInit(&VLRU);
-    for(i = 0; i < VCSIZE; ++i)
-       QInit(&afs_vhashTV[i]);
+
 }