From 8136f4c3dca79b929ebf67631d6bcf6e91f3b2f9 Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Sun, 24 Apr 2005 15:28:50 +0000 Subject: [PATCH] STABLE14-dentry-revalidate-cleanup-20050424 clean up dentry_revalidate one more time so performance improves (cherry picked from commit 937e96cfd192c86affa8a86f24ea4a5cdd81c7cd) --- src/afs/LINUX/osi_vnodeops.c | 43 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index bbda0c99c..490c4e313 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -844,16 +844,12 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) #endif { - char *name = NULL; - cred_t *credp = crref(); + cred_t *credp = NULL; struct vrequest treq; struct vcache *lookupvcp = NULL; int code, bad_dentry = 1; - struct sysname_info sysState; struct vcache *vcp, *parentvcp; - sysState.allocked = 0; - #ifdef AFS_LINUX24_ENV lock_kernel(); #endif @@ -873,29 +869,27 @@ afs_linux_dentry_revalidate(struct dentry *dp) goto done; } - if ((code = afs_InitReq(&treq, credp))) + /* Make this a fast path (no crref), since it's called so often. */ + if (vcp->states & CStatd) { + if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */ + check_bad_parent(dp); /* check and correct mvid */ + vcache2inode(vcp); + bad_dentry = 0; goto done; + } - Check_AtSys(parentvcp, dp->d_name.name, &sysState, &treq); - name = sysState.name; - - /* First try looking up the DNLC */ - if ((lookupvcp = osi_dnlc_lookup(parentvcp, name, WRITE_LOCK))) { - /* Verify that the dentry does not point to an old inode */ - if (vcp != lookupvcp) - goto done; - /* Check and correct mvid */ - if (*name != '/' && vcp->mvstat == 2) - check_bad_parent(dp); - vcache2inode(vcp); + credp = crref(); + + /* get a validated vcache entry */ + code = afs_InitReq(&treq, credp); + if (code) + goto done; + code = afs_VerifyVCache(vcp, &treq); + if (!code) { bad_dentry = 0; goto done; } - /* A DNLC lookup failure cannot be trusted. Try a real lookup. - Make sure to try the real name and not the @sys expansion; - afs_lookup will expand @sys itself. */ - code = afs_lookup(parentvcp, dp->d_name.name, &lookupvcp, credp); /* Verify that the dentry does not point to an old inode */ @@ -908,8 +902,6 @@ afs_linux_dentry_revalidate(struct dentry *dp) /* Clean up */ if (lookupvcp) afs_PutVCache(lookupvcp); - if (sysState.allocked) - osi_FreeLargeSpace(name); AFS_GUNLOCK(); @@ -921,7 +913,8 @@ afs_linux_dentry_revalidate(struct dentry *dp) #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif - crfree(credp); + if (credp) + crfree(credp); return !bad_dentry; } -- 2.39.5