windows-scache-20080308

LICENSE MIT

do not discard data buffers we wish to keep
This commit is contained in:
Jeffrey Altman 2008-03-08 23:17:45 +00:00
parent c32f5466f0
commit 27008912ec

View File

@ -632,16 +632,17 @@ cm_scache_t *cm_FindSCache(cm_fid_t *fidp)
return NULL; return NULL;
} }
lock_ObtainWrite(&cm_scacheLock); lock_ObtainRead(&cm_scacheLock);
for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) { for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) {
if (cm_FidCmp(fidp, &scp->fid) == 0) { if (cm_FidCmp(fidp, &scp->fid) == 0) {
cm_HoldSCacheNoLock(scp); cm_HoldSCacheNoLock(scp);
lock_ConvertRToW(&cm_scacheLock);
cm_AdjustScacheLRU(scp); cm_AdjustScacheLRU(scp);
lock_ReleaseWrite(&cm_scacheLock); lock_ReleaseWrite(&cm_scacheLock);
return scp; return scp;
} }
} }
lock_ReleaseWrite(&cm_scacheLock); lock_ReleaseRead(&cm_scacheLock);
return NULL; return NULL;
} }
@ -1662,8 +1663,8 @@ void cm_MergeStatus(cm_scache_t *dscp,
} }
if (scp->dataVersion != 0 && if (scp->dataVersion != 0 &&
(!(flags & CM_MERGEFLAG_DIROP) && dataVersion != scp->dataVersion || (!(flags & (CM_MERGEFLAG_DIROP|CM_MERGEFLAG_STOREDATA)) && dataVersion != scp->dataVersion ||
(flags & CM_MERGEFLAG_DIROP) && dataVersion - scp->dataVersion > 1)) { (flags & (CM_MERGEFLAG_DIROP|CM_MERGEFLAG_STOREDATA)) && dataVersion - scp->dataVersion > 1)) {
/* /*
* We now know that all of the data buffers that we have associated * We now know that all of the data buffers that we have associated
* with this scp are invalid. Subsequent operations will go faster * with this scp are invalid. Subsequent operations will go faster
@ -1671,6 +1672,8 @@ void cm_MergeStatus(cm_scache_t *dscp,
* *
* We do not remove directory buffers if the dataVersion delta is 1 because * We do not remove directory buffers if the dataVersion delta is 1 because
* those version numbers will be updated as part of the directory operation. * those version numbers will be updated as part of the directory operation.
*
* We do not remove storedata buffers because they will still be valid.
*/ */
int i, j; int i, j;
cm_buf_t **lbpp; cm_buf_t **lbpp;