]> 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>
Mon, 26 Oct 2009 22:04:30 +0000 (15:04 -0700)
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>
src/afs/afs_buffer.c

index 220b49663a5ab8da50a41272e40adf7fa4a722a7..bf0c49d0ba7253abf9d7b6a9d0b1cd94853c0060 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;
                }