windows-optimize-access-20080224

LICENSE MIT

profiling shows large numbers of blocked calls in cm_HoldSCache
from cm_HaveAccess...   We can safely avoid the call so do so.
This commit is contained in:
Jeffrey Altman 2008-02-24 06:27:38 +00:00
parent c73b73ee33
commit 812ac61cfd

View File

@ -38,6 +38,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
cm_fid_t tfid; cm_fid_t tfid;
int didLock; int didLock;
long trights; long trights;
int release = 0; /* Used to avoid a call to cm_HoldSCache in the directory case */
#if 0 #if 0
if (scp->flags & CM_SCACHEFLAG_EACCESS) { if (scp->flags & CM_SCACHEFLAG_EACCESS) {
@ -47,8 +48,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
#endif #endif
didLock = 0; didLock = 0;
if (scp->fileType == CM_SCACHETYPE_DIRECTORY) { if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
aclScp = scp; aclScp = scp; /* not held, not released */
cm_HoldSCache(scp);
} else { } else {
cm_SetFid(&tfid, scp->fid.cell, scp->fid.volume, scp->parentVnode, scp->parentUnique); cm_SetFid(&tfid, scp->fid.cell, scp->fid.volume, scp->parentVnode, scp->parentUnique);
aclScp = cm_FindSCache(&tfid); aclScp = cm_FindSCache(&tfid);
@ -71,6 +71,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
} }
didLock = 1; didLock = 1;
} }
release = 1;
} }
lock_AssertMutex(&aclScp->mx); lock_AssertMutex(&aclScp->mx);
@ -135,7 +136,8 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
done: done:
if (didLock) if (didLock)
lock_ReleaseMutex(&aclScp->mx); lock_ReleaseMutex(&aclScp->mx);
cm_ReleaseSCache(aclScp); if (release)
cm_ReleaseSCache(aclScp);
return code; return code;
} }