afs: Remove 'retry' arg from afs_FindVCache 31/14231/4
authorAndrew Deason <adeason@dson.org>
Mon, 25 May 2020 21:48:37 +0000 (16:48 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 3 Oct 2021 01:32:12 +0000 (21:32 -0400)
Since OpenAFS 1.0, afs_FindVCache has had an optional 'retry' output
arg. The relevant functionality appears to have been specific to Irix
versions before 5.3, but even OpenAFS 1.0 only had param.h files and
general build logic for Irix 6.2 and later.

With commit 13e44b2b (afs: Refactor osi_vnhold/AFS_FAST_HOLD), the
unused 'retry' argument has now been removed from the lower-level
osi_vnhold function, so now remove it from afs_FindVCache and related
comments, and remove the associated logic to handle a non-zero
'retry'.

Change-Id: I4464347bf6e0a57f8babbcdcdf5283e52532f687
Reviewed-on: https://gerrit.openafs.org/14231
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

13 files changed:
src/afs/LINUX/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_create.c
src/afs/VNOPS/afs_vnop_dirops.c
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/VNOPS/afs_vnop_readdir.c
src/afs/VNOPS/afs_vnop_remove.c
src/afs/VNOPS/afs_vnop_rename.c
src/afs/afs_analyze.c
src/afs/afs_dcache.c
src/afs/afs_disconnected.c
src/afs/afs_dynroot.c
src/afs/afs_prototypes.h
src/afs/afs_vcache.c

index efadeda..ac0c33d 100644 (file)
@@ -524,7 +524,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
            afid.Fid.Unique = ntohl(de->fid.vunique);
            if ((avc->f.states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) {
                type = DT_DIR;
-           } else if ((tvc = afs_FindVCache(&afid, 0, 0))) {
+           } else if ((tvc = afs_FindVCache(&afid, 0))) {
                if (tvc->mvstat != AFS_MVSTAT_FILE) {
                    type = DT_DIR;
                } else if (((tvc->f.states) & (CStatd | CTruth))) {
index dc0966d..2c07897 100644 (file)
@@ -435,7 +435,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
      * freeing of the vnode will change evenZaps.  Don't need to update the VLRU
      * queue, since the find will only succeed in the event of a create race, and 
      * then the vcache will be at the front of the VLRU queue anyway...  */
-    if (!(tvc = afs_FindVCache(&newFid, 0, DO_STATS))) {
+    if (!(tvc = afs_FindVCache(&newFid, DO_STATS))) {
        tvc = afs_NewVCache(&newFid, hostp);
        if (tvc) {
            int finalCBs;
index 5a73506..8a15019 100644 (file)
@@ -327,7 +327,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
                    afs_LookupVCache(&unlinkFid, treq, adp, aname);
            } else {
                ObtainReadLock(&afs_xvcache);
-               tvc = afs_FindVCache(&unlinkFid, 0, 1 /* do xstats */ );
+               tvc = afs_FindVCache(&unlinkFid, 1 /* do xstats */ );
                ReleaseReadLock(&afs_xvcache);
            }
        }
@@ -389,7 +389,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
            code = afs_dir_Lookup(tdc, aname, &tfid.Fid);
 
            ObtainSharedLock(&afs_xvcache, 764);
-           tvc = afs_FindVCache(&tfid, 0, 1 /* do xstats */ );
+           tvc = afs_FindVCache(&tfid, 1 /* do xstats */ );
            ReleaseSharedLock(&afs_xvcache);
            
            if (!tvc) {
index bb3194f..16f27ee 100644 (file)
@@ -373,17 +373,8 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state,
     }
     if (tvc->mvid.target_root && (tvc->f.states & CMValid)) {
        if (!canblock) {
-           afs_int32 retry;
-
-           do {
-               retry = 0;
-               ObtainReadLock(&afs_xvcache);
-               root_vp = afs_FindVCache(tvc->mvid.target_root, &retry, 0);
-               if (root_vp && retry) {
-                   ReleaseReadLock(&afs_xvcache);
-                   afs_PutVCache(root_vp);
-               }
-           } while (root_vp && retry);
+           ObtainReadLock(&afs_xvcache);
+           root_vp = afs_FindVCache(tvc->mvid.target_root, 0);
            ReleaseReadLock(&afs_xvcache);
        } else {
            root_vp = afs_GetVCache(tvc->mvid.target_root, areq);
@@ -685,7 +676,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
     int i;
     struct VenusFid afid;      /* file ID we are using now */
     struct VenusFid tfid;      /* another temp. file ID */
-    afs_int32 retry;           /* handle low-level SGI MP race conditions */
+    afs_int32 retry;           /* handle low-level VFS race conditions */
     long volStates;            /* flags from vol structure */
     struct volume *volp = 0;   /* volume ptr */
     struct VenusFid dotdot = {0, {0, 0, 0}};
@@ -831,15 +822,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
            tfid.Fid.Volume = adp->f.fid.Fid.Volume;
            tfid.Fid.Vnode = ntohl(dirEntryp->fid.vnode);
            tfid.Fid.Unique = ntohl(dirEntryp->fid.vunique);
-           do {
-               retry = 0;
-               ObtainSharedLock(&afs_xvcache, 130);
-               tvcp = afs_FindVCache(&tfid, &retry, IS_SLOCK /* no stats | LRU */ );
-               if (tvcp && retry) {
-                   ReleaseSharedLock(&afs_xvcache);
-                   afs_PutVCache(tvcp);
-               }
-           } while (tvcp && retry);
+           ObtainSharedLock(&afs_xvcache, 130);
+           tvcp = afs_FindVCache(&tfid, IS_SLOCK /* no stats | LRU */ );
            if (!tvcp) {        /* otherwise, create manually */
                UpgradeSToWLock(&afs_xvcache, 129);
                tvcp = afs_NewBulkVCache(&tfid, hostp, statSeqNo);
@@ -970,12 +954,9 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
                afid.Fid.Vnode = fidsp[i].Vnode;
                afid.Fid.Unique = fidsp[i].Unique;
 
-               do {
-                   retry = 0;
-                   ObtainReadLock(&afs_xvcache);
-                   tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */);
-                   ReleaseReadLock(&afs_xvcache);
-               } while (tvcp && retry);
+               ObtainReadLock(&afs_xvcache);
+               tvcp = afs_FindVCache(&afid, 0 /* !stats&!lru */);
+               ReleaseReadLock(&afs_xvcache);
 
                if (!tvcp) {
                    continue;
@@ -1131,12 +1112,10 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        afid.Fid.Volume = adp->f.fid.Fid.Volume;
        afid.Fid.Vnode = fidsp[i].Vnode;
        afid.Fid.Unique = fidsp[i].Unique;
-       do {
-           retry = 0;
-           ObtainReadLock(&afs_xvcache);
-           tvcp = afs_FindVCache(&afid, &retry, 0/* !stats&!lru */);
-           ReleaseReadLock(&afs_xvcache);
-       } while (tvcp && retry);
+
+       ObtainReadLock(&afs_xvcache);
+       tvcp = afs_FindVCache(&afid, 0/* !stats&!lru */);
+       ReleaseReadLock(&afs_xvcache);
 
        /* The entry may no longer exist */
        if (tvcp == NULL) {
@@ -1310,12 +1289,10 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        afid.Fid.Volume = adp->f.fid.Fid.Volume;
        afid.Fid.Vnode = fidsp[i].Vnode;
        afid.Fid.Unique = fidsp[i].Unique;
-       do {
-           retry = 0;
-           ObtainReadLock(&afs_xvcache);
-           tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */);
-           ReleaseReadLock(&afs_xvcache);
-       } while (tvcp && retry);
+
+       ObtainReadLock(&afs_xvcache);
+       tvcp = afs_FindVCache(&afid, 0 /* !stats&!lru */);
+       ReleaseReadLock(&afs_xvcache);
        if (tvcp != NULL) {
            if ((tvcp->f.states & CBulkFetching)
                && (tvcp->f.m.Length == statSeqNo)) {
@@ -1781,16 +1758,12 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
         * dirCookie tells us where to start prefetching from.
         */
        if (afs_ShouldTryBulkStat(adp)) {
-           afs_int32 retry;
            /* if the entry is not in the cache, or is in the cache,
             * but hasn't been statd, then do a bulk stat operation.
             */
-           do {
-               retry = 0;
-               ObtainReadLock(&afs_xvcache);
-               tvc = afs_FindVCache(&tfid, &retry, 0 /* !stats,!lru */ );
-               ReleaseReadLock(&afs_xvcache);
-           } while (tvc && retry);
+           ObtainReadLock(&afs_xvcache);
+           tvc = afs_FindVCache(&tfid, 0 /* !stats,!lru */ );
+           ReleaseReadLock(&afs_xvcache);
 
            if (!tvc || !(tvc->f.states & CStatd))
                bulkcode = afs_DoBulkStat(adp, dirCookie, treq);
index ac2441e..09b5762 100644 (file)
@@ -267,7 +267,7 @@ afs_readdir_type(struct vcache *avc, struct DirEntry *ade)
        return DT_DIR;
     }
     ObtainReadLock(&afs_xvcache);
-    if ((tvc = afs_FindVCache(&tfid, 0, 0))) {
+    if ((tvc = afs_FindVCache(&tfid, 0))) {
         ReleaseReadLock(&afs_xvcache);
        if (tvc->mvstat != AFS_MVSTAT_FILE) {
            afs_PutVCache(tvc);
index 54ef539..ee05819 100644 (file)
@@ -259,7 +259,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
                                         aname);
                } else {
                    ObtainReadLock(&afs_xvcache);
-                   tvc = afs_FindVCache(&unlinkFid, 0, DO_STATS);
+                   tvc = afs_FindVCache(&unlinkFid, DO_STATS);
                    ReleaseReadLock(&afs_xvcache);
                }
            }
index 8d72f10..d04817f 100644 (file)
@@ -199,7 +199,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
        fileFid.Cell = aodp->f.fid.Cell;
        fileFid.Fid.Volume = aodp->f.fid.Fid.Volume;
        ObtainSharedLock(&afs_xvcache, 754);
-       tvc = afs_FindVCache(&fileFid, 0 , 1);
+       tvc = afs_FindVCache(&fileFid, 1);
        ReleaseSharedLock(&afs_xvcache);
 
        if (tvc) {
index 188d36e..0ccf711 100644 (file)
@@ -315,7 +315,7 @@ afs_ClearStatus(struct VenusFid *afid, int op, struct volume *avp)
     if (tvp) {
        struct vcache *tvc;
        ObtainReadLock(&afs_xvcache);
-       if ((tvc = afs_FindVCache(afid, 0, 0))) {
+       if ((tvc = afs_FindVCache(afid, 0))) {
            ReleaseReadLock(&afs_xvcache);
            afs_StaleVCacheFlags(tvc, AFS_STALEVC_NOCB | AFS_STALEVC_NODNLC,
                                 CUnique);
index 56eed52..73b6a9d 100644 (file)
@@ -791,7 +791,7 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint)
                /* xdcache is lower than the xvcache lock */
                ReleaseWriteLock(&afs_xdcache);
                ObtainReadLock(&afs_xvcache);
-               tvc = afs_FindVCache(afid, 0, 0 /* no stats, no vlru */ );
+               tvc = afs_FindVCache(afid, 0 /* no stats, no vlru */ );
                ReleaseReadLock(&afs_xvcache);
                ObtainWriteLock(&afs_xdcache, 527);
                skip = 0;
index 3b88585..d114928 100644 (file)
@@ -263,7 +263,7 @@ afs_GetVnodeName(struct vcache *avc, struct VenusFid *afid, char *aname,
 
        /* Get the parent dir's vcache that contains the shadow fid. */
        ObtainSharedLock(&afs_xvcache, 755);
-       parent_vc = afs_FindVCache(&parent_fid, 0, 1);
+       parent_vc = afs_FindVCache(&parent_fid, 1);
        ReleaseSharedLock(&afs_xvcache);
        if (!parent_vc) {
            return ENETDOWN;
@@ -334,7 +334,7 @@ chk_del_children_hook(void *hdata, char *aname, afs_int32 vnode,
     tfid.Fid.Unique = unique;
 
     ObtainSharedLock(&afs_xvcache, 757);
-    tvc = afs_FindVCache(&tfid, 0, 1);
+    tvc = afs_FindVCache(&tfid, 1);
     ReleaseSharedLock(&afs_xvcache);
 
     /* Count unfinished dirty children. */
@@ -415,7 +415,7 @@ fix_children_fids_hook(void *hdata, char *aname, afs_int32 vnode,
 
        /* Get the vcache. */
        ObtainSharedLock(&afs_xvcache, 759);
-       tvc = afs_FindVCache(&tfid, 0, 1);
+       tvc = afs_FindVCache(&tfid, 1);
        ReleaseSharedLock(&afs_xvcache);
 
        /* Change the fields. */
@@ -519,7 +519,7 @@ afs_GetParentVCache(struct vcache *avc, int deleted, struct VenusFid *afid,
     }
 
     ObtainSharedLock(&afs_xvcache, 766);
-    *adp = afs_FindVCache(afid, 0, 1);
+    *adp = afs_FindVCache(afid, 1);
     ReleaseSharedLock(&afs_xvcache);
     if (!*adp) {
        /* printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n"); */
@@ -1402,7 +1402,7 @@ afs_GenShadowFid(struct VenusFid *afid)
 
        /* Is this a used vnode? */
        ObtainSharedLock(&afs_xvcache, 762);
-       tvc = afs_FindVCache(afid, 0, 1);
+       tvc = afs_FindVCache(afid, 1);
        ReleaseSharedLock(&afs_xvcache);
        if (tvc)
            afs_PutVCache(tvc);
index ab21f8a..0acb448 100644 (file)
@@ -286,7 +286,6 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP,
 void
 afs_DynrootInvalidate(void)
 {
-    afs_int32 retry;
     struct vcache *tvc;
     struct VenusFid tfid;
 
@@ -299,12 +298,9 @@ afs_DynrootInvalidate(void)
     ReleaseWriteLock(&afs_dynrootDirLock);
 
     afs_GetDynrootFid(&tfid);
-    do {
-       retry = 0;
-       ObtainReadLock(&afs_xvcache);
-       tvc = afs_FindVCache(&tfid, &retry, 0);
-       ReleaseReadLock(&afs_xvcache);
-    } while (retry);
+    ObtainReadLock(&afs_xvcache);
+    tvc = afs_FindVCache(&tfid, 0);
+    ReleaseReadLock(&afs_xvcache);
     if (tvc) {
        afs_StaleVCacheFlags(tvc, AFS_STALEVC_NOCB, CUnique);
        afs_PutVCache(tvc);
index 82c9e0b..60be3f4 100644 (file)
@@ -1042,8 +1042,7 @@ extern struct osi_file *afs_vcacheMetaInodep;
 
 extern void afs_FlushReclaimedVcaches(void);
 void afs_vcacheInit(int astatSize);
-extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 * retry,
-                                    afs_int32 flag);
+extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 flag);
 extern void afs_BadFetchStatus(struct afs_conn *tc);
 extern int afs_CheckFetchStatus(struct afs_conn *tc,
                                 struct AFSFetchStatus *status);
index 670ad62..aff7faf 100644 (file)
@@ -1773,24 +1773,12 @@ afs_GetVCache(struct VenusFid *afid, struct vrequest *areq)
     afs_int32 code, newvcache = 0;
     struct vcache *tvc;
     struct volume *tvp;
-    afs_int32 retry;
 
     AFS_STATCNT(afs_GetVCache);
 
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-  loop:
-#endif
-
     ObtainSharedLock(&afs_xvcache, 5);
 
-    tvc = afs_FindVCache(afid, &retry, DO_STATS | DO_VLRU | IS_SLOCK);
-    if (tvc && retry) {
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-       ReleaseSharedLock(&afs_xvcache);
-       spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
-       goto loop;
-#endif
-    }
+    tvc = afs_FindVCache(afid, DO_STATS | DO_VLRU | IS_SLOCK);
     if (tvc) {
        osi_Assert((tvc->f.states & CVInit) == 0);
        /* If we are in readdir, return the vnode even if not statd */
@@ -1995,25 +1983,14 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq,
     struct AFSVolSync tsync;
     struct server *serverp = 0;
     afs_int32 origCBs;
-    afs_int32 retry;
 
     AFS_STATCNT(afs_GetVCache);
 
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-  loop1:
-#endif
-
     ObtainReadLock(&afs_xvcache);
-    tvc = afs_FindVCache(afid, &retry, DO_STATS /* no vlru */ );
+    tvc = afs_FindVCache(afid, DO_STATS /* no vlru */ );
 
     if (tvc) {
        ReleaseReadLock(&afs_xvcache);
-       if (retry) {
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-           spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
-           goto loop1;
-#endif
-       }
        ObtainReadLock(&tvc->lock);
 
        if (tvc->f.states & CStatd) {
@@ -2042,20 +2019,8 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq,
            afs_RemoteLookup(&adp->f.fid, areq, aname, &nfid, &OutStatus,
                             &CallBack, &serverp, &tsync);
 
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-  loop2:
-#endif
-
     ObtainSharedLock(&afs_xvcache, 6);
-    tvc = afs_FindVCache(&nfid, &retry, DO_VLRU | IS_SLOCK/* no xstats now */ );
-    if (tvc && retry) {
-#if    defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
-       ReleaseSharedLock(&afs_xvcache);
-       spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
-       goto loop2;
-#endif
-    }
-
+    tvc = afs_FindVCache(&nfid, DO_VLRU | IS_SLOCK/* no xstats now */ );
     if (!tvc) {
        /* no cache entry, better grab one */
        UpgradeSToWLock(&afs_xvcache, 22);
@@ -2649,8 +2614,6 @@ afs_RefVCache(struct vcache *tvc)
  * Find a vcache entry given a fid.
  *
  * \param afid Pointer to the fid whose cache entry we desire.
- * \param retry (SGI-specific) tell the caller to drop the lock on xvcache,
- *  unlock the vnode, and try again.
  * \param flag Bit 1 to specify whether to compute hit statistics.  Not
  *  set if FindVCache is called as part of internal bookkeeping.
  *
@@ -2660,7 +2623,7 @@ afs_RefVCache(struct vcache *tvc)
  */
 
 struct vcache *
-afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag)
+afs_FindVCache(struct VenusFid *afid, afs_int32 flag)
 {
 
     struct vcache *tvc;
@@ -2772,8 +2735,6 @@ afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag)
  *
  * \param avcp Fill in pointer if we found one and only one.
  * \param afid Pointer to the fid whose cache entry we desire.
- * \param retry (SGI-specific) tell the caller to drop the lock on xvcache,
- *             unlock the vnode, and try again.
  * \param flags bit 1 to specify whether to compute hit statistics.  Not
  *             set if FindVCache is called as part of internal bookkeeping.
  *