From: Andrew Deason Date: Wed, 12 Dec 2012 22:14:55 +0000 (-0600) Subject: LINUX: Avoid multiple d_invalidate loops X-Git-Tag: upstream/1.6.6_pre2^2~120 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ec46d5af2e2b85caa6a2a9ddd3527ceccebdf32a;p=packages%2Fo%2Fopenafs.git LINUX: Avoid multiple d_invalidate loops Currently, in afs_linux_lookup, we put an artificial limit on how many times we loop through all dentry aliases, trying ti d_invalidate all of them. Instead of using an arbitrary limit, we can just go through all of them once, by using d_prune_aliases. This should be faster, and removes some of the logic required here. Note that this does remove our check for DCACHE_DISCONNECTED in each alias' d_flags. This should not be a problem, since we will still use any remaining DCACHE_DISCONNECTED dentry via d_splice_alias if one still exists. Reviewed-on: http://gerrit.openafs.org/8751 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear (cherry picked from commit 370aaaeafa43f804b0a5286d92b4ec5f1ccb62be) Change-Id: I1aa70afe8268852c676f241e0189bc010ad757aa Reviewed-on: http://gerrit.openafs.org/9288 Reviewed-by: Andrew Deason Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear Reviewed-by: Stephan Wiesand Tested-by: BuildBot --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 2f6e5bdf6..25e544c01 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1420,25 +1420,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) AFS_GUNLOCK(); if (ip && S_ISDIR(ip->i_mode)) { - int retry = 1; - struct dentry *alias; - int safety; - - for (safety = 0; retry && safety < 64; safety++) { - retry = 0; - - /* Try to invalidate an existing alias in favor of our new one */ - alias = d_find_alias(ip); - /* But not if it's disconnected; then we want d_splice_alias below */ - if (alias && !(alias->d_flags & DCACHE_DISCONNECTED)) { - if (d_invalidate(alias) == 0) { - /* there may be more aliases; try again until we run out */ - retry = 1; - } - } - - dput(alias); - } + d_prune_aliases(ip); #ifdef STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT ip->i_flags |= S_AUTOMOUNT; diff --git a/src/afs/LINUX24/osi_vnodeops.c b/src/afs/LINUX24/osi_vnodeops.c index 6c0589b76..5351a7e09 100644 --- a/src/afs/LINUX24/osi_vnodeops.c +++ b/src/afs/LINUX24/osi_vnodeops.c @@ -1302,25 +1302,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) #if defined(AFS_LINUX24_ENV) if (ip && S_ISDIR(ip->i_mode)) { - int retry = 1; - struct dentry *alias; - int safety; - - for (safety = 0; retry && safety < 64; safety++) { - retry = 0; - - /* Try to invalidate an existing alias in favor of our new one */ - alias = d_find_alias(ip); - /* But not if it's disconnected; then we want d_splice_alias below */ - if (alias) { - if (d_invalidate(alias) == 0) { - /* there may be more aliases; try again until we run out */ - retry = 1; - } - } - - dput(alias); - } + d_prune_aliases(ip); } #endif d_add(dp, ip);