afs: Consolidate ShakeLooseVCaches retry init
authorAndrew Deason <adeason@sinenomine.net>
Fri, 28 Dec 2012 21:36:42 +0000 (16:36 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 31 Dec 2012 14:54:48 +0000 (06:54 -0800)
Don't duplicate the initialization code in effectively three separate
places. Just goto the top of the loop again.

This should incur no functional change; it's just reorganization.

Change-Id: I40548919a5fa9c4e472a4de0eada8d213d034097
Reviewed-on: http://gerrit.openafs.org/8848
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/afs/afs_vcache.c

index 7620ed4..21c49f8 100644 (file)
@@ -709,8 +709,10 @@ afs_ShakeLooseVCaches(afs_int32 anumber)
     int fv_slept, defersleep = 0;
     afs_int32 target = anumber;
 
-    i = 0;
     loop = 0;
+
+ retry:
+    i = 0;
     for (tq = VLRU.prev; tq != &VLRU && anumber > 0; tq = uq) {
        tvc = QTOV(tq);
        uq = QPrev(tq);
@@ -731,16 +733,12 @@ afs_ShakeLooseVCaches(afs_int32 anumber)
        if (fv_slept) {
            if (loop++ > 100)
                break;
-           uq = VLRU.prev;
-           i = 0;
-           continue;   /* start over - may have raced. */
+           goto retry; /* start over - may have raced. */
        }
        if (uq == &VLRU) {
            if (anumber && !defersleep) {
                defersleep = 1;
-               uq = VLRU.prev;
-               i = 0;
-               continue;
+               goto retry;
            }
            break;
        }