mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 23:40:13 +00:00
Windows: Be more efficient when processing locks
Do not drop the cm_scacheLock only to reacquire it a few lines later. Do not manually set the tail of the queue when osi_RemoveHT does it for us. Change-Id: I61b2e54a4864760d257dfcd2841c2c15f1ee41fe Reviewed-on: http://gerrit.openafs.org/5300 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
a576ff1e53
commit
b2c1313f2f
@ -4857,15 +4857,15 @@ long cm_Lock(cm_scache_t *scp, unsigned char sLockType,
|
||||
if (force_client_lock && code != CM_ERROR_WOULDBLOCK)
|
||||
code = 0;
|
||||
|
||||
cm_HoldUser(userp);
|
||||
|
||||
lock_ObtainWrite(&cm_scacheLock);
|
||||
fileLock = cm_GetFileLock();
|
||||
lock_ReleaseWrite(&cm_scacheLock);
|
||||
#ifdef DEBUG
|
||||
fileLock->fid = scp->fid;
|
||||
#endif
|
||||
fileLock->key = key;
|
||||
fileLock->lockType = Which;
|
||||
cm_HoldUser(userp);
|
||||
fileLock->userp = userp;
|
||||
fileLock->range = range;
|
||||
fileLock->flags = (code == 0 ? 0 :
|
||||
@ -4878,7 +4878,6 @@ long cm_Lock(cm_scache_t *scp, unsigned char sLockType,
|
||||
|
||||
fileLock->lastUpdate = (code == 0 && !force_client_lock) ? time(NULL) : 0;
|
||||
|
||||
lock_ObtainWrite(&cm_scacheLock);
|
||||
osi_QAddT(&scp->fileLocksH, &scp->fileLocksT, &fileLock->fileq);
|
||||
cm_HoldSCacheNoLock(scp);
|
||||
fileLock->scp = scp;
|
||||
@ -5085,8 +5084,6 @@ long cm_UnlockByKey(cm_scache_t * scp,
|
||||
fileLock->range.length,
|
||||
fileLock->lockType);
|
||||
|
||||
if (scp->fileLocksT == q)
|
||||
scp->fileLocksT = osi_QPrev(q);
|
||||
osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, q);
|
||||
|
||||
if (IS_LOCK_CLIENTONLY(fileLock)) {
|
||||
@ -5209,8 +5206,6 @@ long cm_Unlock(cm_scache_t *scp,
|
||||
|
||||
/* discard lock record */
|
||||
lock_ConvertRToW(&cm_scacheLock);
|
||||
if (scp->fileLocksT == q)
|
||||
scp->fileLocksT = osi_QPrev(q);
|
||||
osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, q);
|
||||
|
||||
/*
|
||||
@ -5787,8 +5782,6 @@ long cm_RetryLock(cm_file_lock_t *oldFileLock, int client_is_dead)
|
||||
handleCode:
|
||||
if (code != 0 && code != CM_ERROR_WOULDBLOCK) {
|
||||
lock_ObtainWrite(&cm_scacheLock);
|
||||
if (scp->fileLocksT == &oldFileLock->fileq)
|
||||
scp->fileLocksT = osi_QPrev(&oldFileLock->fileq);
|
||||
osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, &oldFileLock->fileq);
|
||||
lock_ReleaseWrite(&cm_scacheLock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user