From 06db2350c28b4129e3bee3566e98a3ecc9a8729f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 24 Feb 2008 06:28:57 +0000 Subject: [PATCH] DEVEL15-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. (cherry picked from commit 812ac61cfd3601abb1373f6d3f9e4d52c2ff61b9) --- src/WINNT/afsd/cm_access.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsd/cm_access.c b/src/WINNT/afsd/cm_access.c index 055186885..b2b2e20be 100644 --- a/src/WINNT/afsd/cm_access.c +++ b/src/WINNT/afsd/cm_access.c @@ -42,6 +42,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 cm_fid_t tfid; int didLock; long trights; + int release = 0; /* Used to avoid a call to cm_HoldSCache in the directory case */ #if 0 if (scp->flags & CM_SCACHEFLAG_EACCESS) { @@ -51,8 +52,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 #endif didLock = 0; if (scp->fileType == CM_SCACHETYPE_DIRECTORY) { - aclScp = scp; - cm_HoldSCache(scp); + aclScp = scp; /* not held, not released */ } else { cm_SetFid(&tfid, scp->fid.cell, scp->fid.volume, scp->parentVnode, scp->parentUnique); aclScp = cm_FindSCache(&tfid); @@ -75,6 +75,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 } didLock = 1; } + release = 1; } lock_AssertMutex(&aclScp->mx); @@ -139,7 +140,8 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 done: if (didLock) lock_ReleaseMutex(&aclScp->mx); - cm_ReleaseSCache(aclScp); + if (release) + cm_ReleaseSCache(aclScp); return code; } -- 2.39.5