From 5076dfc14b980aed310f3862875d5e9919fa199d Mon Sep 17 00:00:00 2001 From: Mark Vitale Date: Thu, 30 Nov 2017 17:56:13 -0500 Subject: [PATCH] LINUX: consolidate duplicate code in osi_TryEvictDentries The two stanzas for HAVE_DCACHE_LOCK are now functionally identical; remove the preprocessor conditionals and duplicate code. Minor functional change is incurrred for very old (before 2.6.38) Linux versions that have dcache_lock; we are now obtaining the d_lock as well. This is safe because d_lock is also quite old (pre-git, 2.6.12), and it is a spinlock that's only held for checking d_unhashed. Therefore, it should have negligible performance impact. It cannot cause deadlocks or violate locking order, because spinlocks can't be held across sleeps. Change-Id: I08faf204e6bd82c4401cdf6048d12cd551dd18fc Reviewed-on: https://gerrit.openafs.org/12792 Reviewed-by: Benjamin Kaduk Reviewed-by: Andrew Deason Tested-by: BuildBot --- src/afs/LINUX/osi_vcache.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index e7c8620..1a5012c 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -24,27 +24,6 @@ TryEvictDentries(struct vcache *avc) struct hlist_node *p; #endif -#if defined(HAVE_DCACHE_LOCK) - afs_d_alias_lock(inode); - -restart: - list_for_each_entry(dentry, &inode->i_dentry, d_alias) { - if (d_unhashed(dentry)) - continue; - afs_linux_dget(dentry); - - afs_d_alias_unlock(inode); - if (d_invalidate(dentry) == -EBUSY) { - dput(dentry); - /* perhaps lock and try to continue? (use cur as head?) */ - goto inuse; - } - dput(dentry); - afs_d_alias_lock(inode); - goto restart; - } - afs_d_alias_unlock(inode); -#else /* HAVE_DCACHE_LOCK */ afs_d_alias_lock(inode); restart: @@ -76,7 +55,7 @@ restart: goto restart; } afs_d_alias_unlock(inode); -#endif /* HAVE_DCACHE_LOCK */ + inuse: return; } -- 1.9.4