Skip to content

Commit 6511f6b

Browse files
author
Al Viro
committed
__dput_to_list(): do decrement of refcount in the callers
... and rename it to to_shrink_list(), seeing that it no longer does dropping any references Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 15f2373 commit 6511f6b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

fs/dcache.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -902,16 +902,13 @@ void dput(struct dentry *dentry)
902902
}
903903
EXPORT_SYMBOL(dput);
904904

905-
static void __dput_to_list(struct dentry *dentry, struct list_head *list)
905+
static void to_shrink_list(struct dentry *dentry, struct list_head *list)
906906
__must_hold(&dentry->d_lock)
907907
{
908-
if (dentry->d_flags & DCACHE_SHRINK_LIST) {
909-
/* let the owner of the list it's on deal with it */
910-
--dentry->d_lockref.count;
911-
} else {
908+
if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
912909
if (dentry->d_flags & DCACHE_LRU_LIST)
913910
d_lru_del(dentry);
914-
if (!--dentry->d_lockref.count)
911+
if (!dentry->d_lockref.count)
915912
d_shrink_add(dentry, list);
916913
}
917914
}
@@ -925,8 +922,10 @@ void dput_to_list(struct dentry *dentry, struct list_head *list)
925922
}
926923
rcu_read_unlock();
927924
dentry->d_lockref.count = 1;
928-
if (!retain_dentry(dentry))
929-
__dput_to_list(dentry, list);
925+
if (!retain_dentry(dentry)) {
926+
--dentry->d_lockref.count;
927+
to_shrink_list(dentry, list);
928+
}
930929
spin_unlock(&dentry->d_lock);
931930
}
932931

@@ -1165,8 +1164,10 @@ static bool shrink_lock_dentry(struct dentry *dentry)
11651164
static inline void shrink_kill(struct dentry *victim, struct list_head *list)
11661165
{
11671166
struct dentry *parent = victim->d_parent;
1168-
if (parent != victim)
1169-
__dput_to_list(parent, list);
1167+
if (parent != victim) {
1168+
--parent->d_lockref.count;
1169+
to_shrink_list(parent, list);
1170+
}
11701171
__dentry_kill(victim);
11711172
}
11721173

0 commit comments

Comments
 (0)