mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
DEVEL15-windows-buffers-20071210
LICENSE MIT after removing cm_buf_t objects from the hash tables, clear the HT list pointers to make debugging easier. when modifying data version values in buf_ForceDataVersion() grab a read lock on buf_globalLock instead of a write lock. A write lock is only required if the hash table linked lists are being modified. The dataVersion itself is protected by the cm_scache_t mx mutex being held. (cherry picked from commit ef5e9a4dd7a4977d7d9f41266f2a0c491720e387)
This commit is contained in:
parent
2dd74f42d3
commit
fd7856fa5d
@ -700,19 +700,23 @@ void buf_Recycle(cm_buf_t *bp)
|
||||
i = BUF_HASH(&bp->fid, &bp->offset);
|
||||
lbpp = &(cm_data.buf_scacheHashTablepp[i]);
|
||||
for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) {
|
||||
if (tbp == bp) break;
|
||||
if (tbp == bp)
|
||||
break;
|
||||
}
|
||||
|
||||
/* we better find it */
|
||||
osi_assertx(tbp != NULL, "buf_Recycle: hash table screwup");
|
||||
|
||||
*lbpp = bp->hashp; /* hash out */
|
||||
bp->hashp = NULL;
|
||||
|
||||
/* Remove from file hash */
|
||||
|
||||
i = BUF_FILEHASH(&bp->fid);
|
||||
prevBp = bp->fileHashBackp;
|
||||
bp->fileHashBackp = NULL;
|
||||
nextBp = bp->fileHashp;
|
||||
bp->fileHashp = NULL;
|
||||
if (prevBp)
|
||||
prevBp->fileHashp = nextBp;
|
||||
else
|
||||
@ -1560,7 +1564,7 @@ long buf_ForceDataVersion(cm_scache_t * scp, afs_uint64 fromVersion, afs_uint64
|
||||
|
||||
i = BUF_FILEHASH(&scp->fid);
|
||||
|
||||
lock_ObtainWrite(&buf_globalLock);
|
||||
lock_ObtainRead(&buf_globalLock);
|
||||
|
||||
for (bp = cm_data.buf_fileHashTablepp[i]; bp; bp = bp->fileHashp) {
|
||||
if (cm_FidCmp(&bp->fid, &scp->fid) == 0) {
|
||||
@ -1570,7 +1574,7 @@ long buf_ForceDataVersion(cm_scache_t * scp, afs_uint64 fromVersion, afs_uint64
|
||||
}
|
||||
}
|
||||
}
|
||||
lock_ReleaseWrite(&buf_globalLock);
|
||||
lock_ReleaseRead(&buf_globalLock);
|
||||
|
||||
if (found)
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user