From b21d0930e56a3331cd94c30a07e9d8fdebdcd5c4 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 26 Oct 2009 18:52:52 +0000 Subject: [PATCH] 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 (cherry picked from commit 293e8c6a1048bf3c342134b5ca6f79d68023258b) Reviewed-on: http://gerrit.openafs.org/981 --- src/afs/afs_buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index 2b057820a..c061fec23 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; } -- 2.39.5