Skip to content

Commit 5e7a5c8

Browse files
author
Al Viro
committed
fold dentry_kill() into dput()
Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 339e9e1 commit 5e7a5c8

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

fs/dcache.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -756,28 +756,6 @@ void d_mark_dontcache(struct inode *inode)
756756
}
757757
EXPORT_SYMBOL(d_mark_dontcache);
758758

759-
/*
760-
* Finish off a dentry we've decided to kill.
761-
* dentry->d_lock must be held, returns with it unlocked.
762-
* Returns dentry requiring refcount drop, or NULL if we're done.
763-
*/
764-
static struct dentry *dentry_kill(struct dentry *dentry)
765-
__releases(dentry->d_lock)
766-
{
767-
768-
dentry->d_lockref.count--;
769-
rcu_read_lock();
770-
if (likely(lock_for_kill(dentry))) {
771-
struct dentry *parent = dentry->d_parent;
772-
rcu_read_unlock();
773-
__dentry_kill(dentry);
774-
return parent != dentry ? parent : NULL;
775-
}
776-
rcu_read_unlock();
777-
spin_unlock(&dentry->d_lock);
778-
return NULL;
779-
}
780-
781759
/*
782760
* Try to do a lockless dput(), and return whether that was successful.
783761
*
@@ -915,9 +893,18 @@ void dput(struct dentry *dentry)
915893
}
916894

917895
/* Slow case: now with the dentry lock held */
918-
rcu_read_unlock();
919-
dentry->d_lockref.count = 1;
920-
dentry = dentry_kill(dentry);
896+
if (likely(lock_for_kill(dentry))) {
897+
struct dentry *parent = dentry->d_parent;
898+
rcu_read_unlock();
899+
__dentry_kill(dentry);
900+
if (dentry == parent)
901+
return;
902+
dentry = parent;
903+
} else {
904+
rcu_read_unlock();
905+
spin_unlock(&dentry->d_lock);
906+
return;
907+
}
921908
}
922909
}
923910
EXPORT_SYMBOL(dput);

0 commit comments

Comments
 (0)