]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Remove hardcoded maximum time
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Mon, 26 Oct 2009 18:52:52 +0000 (18:52 +0000)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 07:00:31 +0000 (23:00 -0800)
When iterating across the buffer list, afs_newslot used a hardcoded
maximum time to find the oldest. Instead of using this, just use the
accesstime of the first unused buffer that we find as the oldest, and
continue as normal.

Change-Id: Ifeacb8a407901b46a23fbc838b1fca761108ebbb
Reviewed-on: http://gerrit.openafs.org/738
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 293e8c6a1048bf3c342134b5ca6f79d68023258b)
Reviewed-on: http://gerrit.openafs.org/981

src/afs/afs_buffer.c

index 2b057820a24b4fb71f570f5e87654db40f36ad50..c061fec23f735cdca64af08216bce7d9171c1dd3 100644 (file)
@@ -305,8 +305,7 @@ afs_newslot(struct dcache *adc, afs_int32 apage, register struct buffer *lp)
     if (lp && (lp->lockers == 0)) {
        lt = lp->accesstime;
     } else {
-       lp = 0;
-       lt = BUF_TIME_MAX;
+       lp = NULL;
     }
 
     /* timecounter might have wrapped, if machine is very very busy
@@ -336,7 +335,7 @@ afs_newslot(struct dcache *adc, afs_int32 apage, register struct buffer *lp)
        tp = Buffers;
        for (i = 0; i < nbuffers; i++, tp++) {
            if (tp->lockers == 0) {
-               if (tp->accesstime < lt) {
+               if (!lp || tp->accesstime < lt) {
                    lp = tp;
                    lt = tp->accesstime;
                }