mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-18 12:45:08 +00:00
dput(): consolidate the "do we need to retain it?" into an inlined helper
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
8b987a46a1
commit
a338579f2f
1 changed files with 23 additions and 19 deletions
36
fs/dcache.c
36
fs/dcache.c
|
@ -626,6 +626,24 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
|
||||||
return __lock_parent(dentry);
|
return __lock_parent(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool retain_dentry(struct dentry *dentry)
|
||||||
|
{
|
||||||
|
WARN_ON(d_in_lookup(dentry));
|
||||||
|
|
||||||
|
/* Unreachable? Get rid of it */
|
||||||
|
if (unlikely(d_unhashed(dentry)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) {
|
||||||
|
if (dentry->d_op->d_delete(dentry))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finish off a dentry we've decided to kill.
|
* Finish off a dentry we've decided to kill.
|
||||||
* dentry->d_lock must be held, returns with it unlocked.
|
* dentry->d_lock must be held, returns with it unlocked.
|
||||||
|
@ -804,27 +822,13 @@ repeat:
|
||||||
/* Slow case: now with the dentry lock held */
|
/* Slow case: now with the dentry lock held */
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
WARN_ON(d_in_lookup(dentry));
|
if (likely(retain_dentry(dentry))) {
|
||||||
|
|
||||||
/* Unreachable? Get rid of it */
|
|
||||||
if (unlikely(d_unhashed(dentry)))
|
|
||||||
goto kill_it;
|
|
||||||
|
|
||||||
if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED))
|
|
||||||
goto kill_it;
|
|
||||||
|
|
||||||
if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) {
|
|
||||||
if (dentry->d_op->d_delete(dentry))
|
|
||||||
goto kill_it;
|
|
||||||
}
|
|
||||||
|
|
||||||
dentry_lru_add(dentry);
|
dentry_lru_add(dentry);
|
||||||
|
|
||||||
dentry->d_lockref.count--;
|
dentry->d_lockref.count--;
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
kill_it:
|
|
||||||
dentry = dentry_kill(dentry);
|
dentry = dentry_kill(dentry);
|
||||||
if (dentry) {
|
if (dentry) {
|
||||||
cond_resched();
|
cond_resched();
|
||||||
|
|
Loading…
Add table
Reference in a new issue