From: Simon Wilkinson Date: Mon, 26 Oct 2009 18:52:52 +0000 (+0000) Subject: Remove hardcoded maximum time X-Git-Tag: openafs-devel-1_5_67~102 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=293e8c6a1048bf3c342134b5ca6f79d68023258b;p=packages%2Fo%2Fopenafs.git Remove hardcoded maximum time 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 Tested-by: Derrick Brashear --- diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index 220b49663..bf0c49d0b 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -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; }