vcache-cleanup-20050529
authorChas Williams <chas@cmf.nrl.navy.mil>
Mon, 30 May 2005 04:57:02 +0000 (04:57 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 30 May 2005 04:57:02 +0000 (04:57 +0000)
FIXES 18368

clean up unused stuff in struct vcache

src/afs/VNOPS/afs_vnop_dirops.c
src/afs/VNOPS/afs_vnop_remove.c
src/afs/VNOPS/afs_vnop_rename.c
src/afs/afs.h
src/afs/afs_callback.c
src/afs/afs_cbqueue.c
src/afs/afs_dcache.c
src/afs/afs_pioctl.c
src/afs/afs_vcache.c

index 4ae637c..0079acf 100644 (file)
@@ -286,10 +286,9 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred)
     }
 
 
-    if (tvc) {
+    if (tvc)
        osi_dnlc_purgedp(tvc);  /* get rid of any entries for this directory */
-       afs_symhint_inval(tvc);
-    } else
+    else
        osi_dnlc_remove(adp, aname, 0);
 
     if (tvc) {
index 301e4e9..7dd8a5d 100644 (file)
@@ -126,8 +126,6 @@ afsremove(register struct vcache *adp, register struct dcache *tdc,
              SHARED_LOCK, NULL));
 
     osi_dnlc_remove(adp, aname, tvc);
-    if (tvc)
-       afs_symhint_inval(tvc); /* XXX: don't really need to be so extreme */
 
     if (code) {
        if (tdc) {
@@ -362,8 +360,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
     }
 
     osi_dnlc_remove(adp, aname, tvc);
-    if (tvc)
-       afs_symhint_inval(tvc);
 
     Tadp1 = adp;
     Tadpr = VREFCOUNT(adp);
index 2fe49ab..19b3679 100644 (file)
@@ -120,8 +120,6 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
 
     osi_dnlc_remove(aodp, aname1, 0);
     osi_dnlc_remove(andp, aname2, 0);
-    afs_symhint_inval(aodp);
-    afs_symhint_inval(andp);
 
     /*
      * Make sure that the data in the cache is current. We may have
index 25a49ad..95c8a34 100644 (file)
@@ -580,20 +580,6 @@ struct SimpleLocks {
 
 extern afs_int32 vmPageHog;    /* counter for # of vnodes which are page hogs. */
 
-/*
- * Fast map from vcache to dcache
- */
-struct vtodc {
-    struct dcache *dc;
-    afs_uint32 stamp;
-    struct osi_file *f;
-    afs_offs_t minLoc;         /* smallest offset into dc. */
-    afs_offs_t len;            /* largest offset into dc. */
-};
-
-extern afs_uint32 afs_stampValue;      /* stamp for pair's usage */
-#define        MakeStamp()     (++afs_stampValue)
-
 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
 #define VTOAFS(v) ((struct vcache *)(v)->v_data)
 #define AFSTOV(vc) ((vc)->v)
@@ -690,12 +676,7 @@ struct vcache {
 #if    defined(AFS_SUN5_ENV)
     afs_uint32 vstates;                /* vstate bits */
 #endif                         /* defined(AFS_SUN5_ENV) */
-    struct vtodc quick;
-    afs_uint32 symhintstamp;
-    union {
-       struct vcache *symhint;
-       struct dcache *dchint;
-    } h1;
+    struct dcache *dchint;
 #ifdef AFS_LINUX22_ENV
     u_short mapcnt;            /* Number of mappings of this file. */
 #endif
@@ -723,9 +704,6 @@ struct vcache {
 #endif
 };
 
-#define afs_symhint_inval(avc)
-
-
 #define        DONT_CHECK_MODE_BITS    0
 #define        CHECK_MODE_BITS         1
 #define CMB_ALLOW_EXEC_AS_READ  2      /* For the NFS xlator */
@@ -963,7 +941,6 @@ struct dcache {
     char dflags;               /* Data flags */
     char mflags;               /* Meta flags */
     struct fcache f;           /* disk image */
-    afs_int32 stamp;           /* used with vtodc struct for hints */
     afs_int32 bucket;           /* which bucket these dcache entries are in */
     /*
      * Locking rules:
@@ -983,10 +960,6 @@ struct dcache {
      * Note that dcache.lock(W) gives you the right to update mflags,
      * as dcache.mflock(W) can only be held with dcache.lock(R).
      *
-     * dcache.stamp is protected by the associated vcache lock, because
-     * it's only purpose is to establish correspondence between vcache
-     * and dcache entries.
-     *
      * dcache.index, dcache.f.fid, dcache.f.chunk and dcache.f.inode are
      * write-protected by afs_xdcache and read-protected by refCount.
      * Once an entry is referenced, these values cannot change, and if
@@ -996,8 +969,6 @@ struct dcache {
      * ensuring noone else has a refCount on it).
      */
 };
-/* this is obsolete and should be removed */
-#define ihint stamp
 
 /* afs_memcache.c */
 struct memCacheEntry {
index 05885e5..49c6bb9 100644 (file)
@@ -392,10 +392,9 @@ ClearCallBack(register struct rx_connection *a_conn,
                for (tvc = afs_vhashTV[i]; tvc; tvc = tvc->vhnext) {
                    if (tvc->fid.Fid.Volume == a_fid->Volume) {
                        tvc->callback = NULL;
-                       tvc->quick.stamp = 0;
                        if (!localFid.Cell)
                            localFid.Cell = tvc->fid.Cell;
-                       tvc->h1.dchint = NULL;  /* invalidate hints */
+                       tvc->dchint = NULL;     /* invalidate hints */
                        ObtainWriteLock(&afs_xcbhash, 449);
                        afs_DequeueCallback(tvc);
                        tvc->states &= ~(CStatd | CUnique | CBulkFetching);
@@ -444,8 +443,7 @@ ClearCallBack(register struct rx_connection *a_conn,
                    && tvc->fid.Fid.Volume == a_fid->Volume
                    && tvc->fid.Fid.Unique == a_fid->Unique) {
                    tvc->callback = NULL;
-                   tvc->quick.stamp = 0;
-                   tvc->h1.dchint = NULL;      /* invalidate hints */
+                   tvc->dchint = NULL; /* invalidate hints */
                    ObtainWriteLock(&afs_xcbhash, 450);
                    afs_DequeueCallback(tvc);
                    tvc->states &= ~(CStatd | CUnique | CBulkFetching);
index 66601d8..c995e31 100644 (file)
@@ -143,7 +143,6 @@ afs_DequeueCallback(struct vcache *avc)
        QRemove(&(avc->callsort));
        avc->callsort.prev = avc->callsort.next = NULL;
     } else;                    /* must have got dequeued in a race */
-    afs_symhint_inval(avc);
 
     return;
 }                              /* afs_DequeueCallback */
@@ -226,8 +225,7 @@ afs_CheckCallbacks(unsigned int secs)
                            if ((tvc->fid.Fid.Vnode & 1)
                                || (vType(tvc) == VDIR))
                                osi_dnlc_purgedp(tvc);
-                           tvc->quick.stamp = 0;
-                           tvc->h1.dchint = NULL;      /*invalidate em */
+                           tvc->dchint = NULL; /*invalidate em */
                            afs_ResetVolumeInfo(tvp);
                            break;
                        }
@@ -309,8 +307,7 @@ afs_FlushCBs(void)
     for (i = 0; i < VCSIZE; i++)       /* reset all the vnodes */
        for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
            tvc->callback = 0;
-           tvc->quick.stamp = 0;
-           tvc->h1.dchint = NULL;      /* invalidate hints */
+           tvc->dchint = NULL; /* invalidate hints */
            tvc->states &= ~(CStatd);
            if ((tvc->fid.Fid.Vnode & 1) || (vType(tvc) == VDIR))
                osi_dnlc_purgedp(tvc);
@@ -339,8 +336,7 @@ afs_FlushServerCBs(struct server *srvp)
        for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
            if (tvc->callback == srvp) {
                tvc->callback = 0;
-               tvc->quick.stamp = 0;
-               tvc->h1.dchint = NULL;  /* invalidate hints */
+               tvc->dchint = NULL;     /* invalidate hints */
                tvc->states &= ~(CStatd);
                if ((tvc->fid.Fid.Vnode & 1) || (vType(tvc) == VDIR)) {
                    osi_dnlc_purgedp(tvc);
index 3db7b85..a3116d3 100644 (file)
@@ -1158,17 +1158,6 @@ afs_GetDownDSlot(int anumber)
 #endif
            }
 
-           tdc->stamp = 0;
-#ifdef IHINT
-           if (tdc->ihint) {
-               struct osi_file *f = (struct osi_file *)tdc->ihint;
-               tdc->ihint = 0;
-               afs_UFSClose(f);
-               nihints--;
-           }
-#endif /* IHINT */
-
-
            /* finally put the entry in the free list */
            afs_indexTable[ix] = NULL;
            afs_indexFlags[ix] &= ~IFEverUsed;
@@ -1622,14 +1611,8 @@ void
 updateV2DC(int lockVc, struct vcache *v, struct dcache *d, int src)
 {
     if (!lockVc || 0 == NBObtainWriteLock(&v->lock, src)) {
-       if (hsame(v->m.DataVersion, d->f.versionNo) && v->callback) {
-           v->quick.dc = d;
-           v->quick.stamp = d->stamp = MakeStamp();
-           v->quick.minLoc = AFS_CHUNKTOBASE(d->f.chunk);
-           /* Don't think I need these next two lines forever */
-           v->quick.len = d->f.chunkBytes;
-           v->h1.dchint = d;
-       }
+       if (hsame(v->m.DataVersion, d->f.versionNo) && v->callback)
+           v->dchint = d;
        if (lockVc)
            ReleaseWriteLock(&v->lock);
     }
@@ -1721,7 +1704,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte,
     shortcut = 0;
 
     /* check hints first! (might could use bcmp or some such...) */
-    if ((tdc = avc->h1.dchint)) {
+    if ((tdc = avc->dchint)) {
        int dcLocked;
 
        /*
@@ -2184,20 +2167,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte,
         * fetch the whole file.
         */
        DZap(tdc);      /* pages in cache may be old */
-#ifdef  IHINT
-       if (file = tdc->ihint) {
-           if (tdc->f.inode == file->inum)
-               usedihint++;
-           else {
-               tdc->ihint = 0;
-               afs_UFSClose(file);
-               file = 0;
-               nihints--;
-               file = osi_UFSOpen(tdc->f.inode);
-           }
-       } else
-#endif /* IHINT */
-           file = afs_CFileOpen(tdc->f.inode);
+       file = afs_CFileOpen(tdc->f.inode);
        afs_RemoveVCB(&avc->fid);
        tdc->f.states |= DWriting;
        tdc->dflags |= DFFetching;
@@ -2961,7 +2931,6 @@ afs_UFSGetDSlot(register afs_int32 aslot, register struct dcache *tmpdc)
     } else {
        tdc = tmpdc;
        tdc->f.states = 0;
-       tdc->ihint = 0;
     }
 
     /*
index c298e8e..597e42c 100644 (file)
@@ -1669,7 +1669,6 @@ DECL_PIOCTL(PFlush)
     /* now find the disk cache entries */
     afs_TryToSmush(avc, *acred, 1);
     osi_dnlc_purgedp(avc);
-    afs_symhint_inval(avc);
     if (avc->linkData && !(avc->states & CCore)) {
        afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
        avc->linkData = NULL;
@@ -3561,7 +3560,6 @@ DECL_PIOCTL(PFlushMount)
     /* now find the disk cache entries */
     afs_TryToSmush(tvc, *acred, 1);
     osi_dnlc_purgedp(tvc);
-    afs_symhint_inval(tvc);
     if (tvc->linkData && !(tvc->states & CCore)) {
        afs_osi_Free(tvc->linkData, strlen(tvc->linkData) + 1);
        tvc->linkData = NULL;
index 3dc65f4..4c9dc09 100644 (file)
@@ -216,7 +216,6 @@ afs_FlushVCache(struct vcache *avc, int *slept)
     afs_DequeueCallback(avc);  /* remove it from queued callbacks list */
     avc->states &= ~(CStatd | CUnique);
     ReleaseWriteLock(&afs_xcbhash);
-    afs_symhint_inval(avc);
     if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1))
        osi_dnlc_purgedp(avc);  /* if it (could be) a directory */
     else
@@ -866,7 +865,6 @@ restart:
     tvc->fid = *afid;
     tvc->asynchrony = -1;
     tvc->vc_error = 0;
-    afs_symhint_inval(tvc);
 #ifdef AFS_TEXT_ENV
     tvc->flushDV.low = tvc->flushDV.high = AFS_MAXDV;
 #endif
@@ -1080,9 +1078,8 @@ restart:
     vn_initlist((struct vnlist *)&tvc->v);
     tvc->lastr = 0;
 #endif /* AFS_SGI_ENV */
-    tvc->h1.dchint = 0;
+    tvc->dchint = NULL;
     osi_dnlc_purgedp(tvc);     /* this may be overkill */
-    memset((char *)&(tvc->quick), 0, sizeof(struct vtodc));
     memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q));
     tvc->slocks = NULL;
     i = VCHash(afid);
@@ -2239,8 +2236,7 @@ afs_FetchStatus(struct vcache * avc, struct VenusFid * afid,
     XSTATS_DECLS;
     do {
        tc = afs_Conn(afid, areq, SHARED_LOCK);
-       avc->quick.stamp = 0;
-       avc->h1.dchint = NULL;  /* invalidate hints */
+       avc->dchint = NULL;     /* invalidate hints */
        if (tc) {
            avc->callback = tc->srvr->server;
            start = osi_Time();