]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: Avoid multiple d_invalidate loops
authorAndrew Deason <adeason@sinenomine.net>
Wed, 12 Dec 2012 22:14:55 +0000 (16:14 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 29 Aug 2013 07:16:03 +0000 (00:16 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 370aaaeafa43f804b0a5286d92b4ec5f1ccb62be)

Change-Id: I1aa70afe8268852c676f241e0189bc010ad757aa
Reviewed-on: http://gerrit.openafs.org/9288
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/LINUX/osi_vnodeops.c
src/afs/LINUX24/osi_vnodeops.c

index 2f6e5bdf6e5e446342625f632569337daebf9604..25e544c017f5c2bc28ba362bca79cec73e503330 100644 (file)
@@ -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;
index 6c0589b76c82fd305dc92316b6032fddf92dbdb5..5351a7e09debcaa002c669616e967fea4dc373f6 100644 (file)
@@ -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);