mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
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 <kaduk@mit.edu> Reviewed-by: Andrew Deason <adeason@dson.org> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
0678ad26b6
commit
5076dfc14b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user