STABLE14-newvcache-dont-spin-20060128

make things so newvcache won't spin


(cherry picked from commit 29277d96bfade62e437b9206f885af307c74e3ca)
This commit is contained in:
Chaskiel M Grundman 2006-01-28 18:06:37 +00:00 committed by Derrick Brashear
parent c2c2b8e336
commit 6e76880bf7

View File

@ -787,6 +787,7 @@ restart:
#else /* AFS_OSF_ENV */
/* pull out a free cache entry */
if (!freeVCList) {
int loop = 0;
i = 0;
for (tq = VLRU.prev; (anumber > 0) && (tq != &VLRU); tq = uq) {
tvc = QTOV(tq);
@ -814,6 +815,7 @@ restart:
/* VREFCOUNT_GT only sees usecounts, not iocounts */
/* so this may fail to actually recycle the vnode now */
/* must call vnode_get to avoid races. */
fv_slept = 0;
if (vnode_get(tvp) == 0) {
fv_slept=1;
/* must release lock, since vnode_put will immediately
@ -828,9 +830,13 @@ restart:
/* we can't use the vnode_recycle return value to figure
* this out, since the iocount we have to hold makes it
* always "fail" */
if (AFSTOV(tvc) == tvp)
if (AFSTOV(tvc) == tvp) {
if (anumber > 0 && fv_slept) {
QRemove(&tvc->vlruq);
QAdd(&VLRU, &tvc->vlruq);
}
code = EBUSY;
else
} else
code = 0;
#else
/*
@ -853,6 +859,8 @@ restart:
anumber--;
}
if (fv_slept) {
if (loop++ > 100)
break;
uq = VLRU.prev;
i = 0;
continue; /* start over - may have raced. */