if (vcp->vlruq.prev || vcp->vlruq.next)
osi_Panic("inode freed while on LRU");
- if (vcp->hnext || vcp->vhnext)
+ if (vcp->hnext)
osi_Panic("inode freed while still hashed");
#if !defined(STRUCT_SUPER_HAS_ALLOC_INODE)
*/
#define QTOV(e) ((struct vcache *)(((char *) (e)) - (((char *)(&(((struct vcache *)(e))->vlruq))) - ((char *)(e)))))
#define QTOC(e) ((struct cell *)((char *) (e)))
+#define QTOVH(e) ((struct vcache *)(((char *) (e)) - (((char *)(&(((struct vcache *)(e))->vhashq))) - ((char *)(e)))))
#define SRVADDR_MH 1
#define SRVADDR_ISDOWN 0x20 /* same as SRVR_ISDOWN */
struct vcache *nextfree; /* next on free list (if free) */
#endif
struct vcache *hnext; /* Hash next */
- struct vcache *vhnext; /* vol hash next */
+ struct afs_q vhashq; /* Hashed per-volume list */
struct VenusFid fid;
struct mstat {
afs_size_t Length;
extern afs_size_t afs_cacheBlocks; /*1K blocks in cache */
extern afs_int32 afs_cacheStats; /*Stat entries in cache */
extern struct vcache *afs_vhashT[VCSIZE]; /*Stat cache hash table */
-extern struct vcache *afs_vhashTV[VCSIZE]; /* cache hash table on volume */
+extern struct afs_q afs_vhashTV[VCSIZE]; /* cache hash table on volume */
extern afs_int32 afs_initState; /*Initialization state */
extern afs_int32 afs_termState; /* Termination state */
extern struct VenusFid afs_rootFid; /*Root for whole file system */
*/
if (a_fid->Volume != 0) {
if (a_fid->Vnode == 0) {
+ struct afs_q *tq, *uq;
/*
* Clear callback for the whole volume. Zip through the
* hash chain, nullifying entries whose volume ID matches.
*/
i = VCHashV(&localFid);
- for (tvc = afs_vhashTV[i]; tvc; tvc = tvc->vhnext) {
+ for (tq = afs_vhashTV[i].prev; tq != &afs_vhashTV[i]; tq = uq) {
+ uq = QPrev(tq);
+ tvc = QTOVH(tq);
if (tvc->fid.Fid.Volume == a_fid->Volume) {
tvc->callback = NULL;
if (!localFid.Cell)
register struct vcache *tvc;
register struct volume *tv;
afs_int32 cell, volume;
+ struct afs_q *tq, *uq;
AFS_STATCNT(PFlushVolumeData);
if (!avc)
*/
ObtainReadLock(&afs_xvcache);
i = VCHashV(&avc->fid);
- for (tvc = afs_vhashT[i]; tvc; tvc = tvc->vhnext) {
+ for (tq = afs_vhashTV[i].prev; tq != &afs_vhashTV[i]; tq = uq) {
+ uq = QPrev(tq);
+ tvc = QTOVH(tq);
if (tvc->fid.Fid.Volume == volume && tvc->fid.Cell == cell) {
#if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
VN_HOLD(AFSTOV(tvc));
extern struct afs_q VLRU;
extern afs_int32 vcachegen;
extern unsigned int afs_paniconwarn;
-extern struct vcache *afs_vhashT[VCSIZE];
+extern struct afs_q afs_vhashTV[VCSIZE];
extern afs_int32 afs_bulkStatsLost;
extern int afs_norefpanic;
afs_int32 vcachegen = 0;
unsigned int afs_paniconwarn = 0;
struct vcache *afs_vhashT[VCSIZE];
-struct vcache *afs_vhashTV[VCSIZE];
+struct afs_q afs_vhashTV[VCSIZE];
static struct afs_cbr *afs_cbrHashT[CBRSIZE];
afs_int32 afs_bulkStatsLost;
int afs_norefpanic = 0;
afs_FlushVCache(struct vcache *avc, int *slept)
{ /*afs_FlushVCache */
- afs_int32 i, code, j;
- struct vcache **uvc, *wvc, **uvc2, *wvc2;
+ afs_int32 i, code;
+ struct vcache **uvc, *wvc;
*slept = 0;
AFS_STATCNT(afs_FlushVCache);
}
/* remove entry from the volume hash table */
- 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 */
+ QRemove(&avc->vhashq);
+
if (avc->mvid)
osi_FreeSmallSpace(avc->mvid);
avc->mvid = (struct VenusFid *)0;
#ifdef AFS_OSF_ENV
struct vcache *nvc;
#endif /* AFS_OSF_ENV */
- struct afs_q *tq, *uq;
int code, fv_slept;
AFS_STATCNT(afs_NewVCache);
j = VCHashV(afid);
tvc->hnext = afs_vhashT[i];
- tvc->vhnext = afs_vhashTV[j];
- afs_vhashT[i] = afs_vhashTV[j] = tvc;
+ afs_vhashT[i] = tvc;
+ QAdd(&afs_vhashTV[i], &tvc->vhashq);
if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) {
refpanic("NewVCache VLRU inconsistent");
#endif /* AFS_SGI62_ENV */
}
#endif
-
QInit(&VLRU);
-
-
+ for(i = 0; i < VCSIZE; ++i)
+ QInit(&afs_vhashTV[i]);
}
/*
afs_FreeAllAxs(&(tvc->Access));
}
- afs_vhashT[i] = afs_vhashTV[i] = 0;
+ afs_vhashT[i] = 0;
}
}
/*
RWLOCK_INIT(&afs_xvcache, "afs_xvcache");
LOCK_INIT(&afs_xvcb, "afs_xvcb");
QInit(&VLRU);
-
+ for(i = 0; i < VCSIZE; ++i)
+ QInit(&afs_vhashTV[i]);
}