Skip to content

Commit c2e5e29

Browse files
author
Al Viro
committed
to_shrink_list(): call only if refcount is 0
The only thing it does if refcount is not zero is d_lru_del(); no point, IMO, seeing that plain dput() does nothing of that sort... Note that 2 of 3 current callers are guaranteed that refcount is 0. Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 5e7a5c8 commit c2e5e29

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/dcache.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,7 @@ __must_hold(&dentry->d_lock)
915915
if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
916916
if (dentry->d_flags & DCACHE_LRU_LIST)
917917
d_lru_del(dentry);
918-
if (!dentry->d_lockref.count)
919-
d_shrink_add(dentry, list);
918+
d_shrink_add(dentry, list);
920919
}
921920
}
922921

@@ -1115,10 +1114,8 @@ EXPORT_SYMBOL(d_prune_aliases);
11151114
static inline void shrink_kill(struct dentry *victim, struct list_head *list)
11161115
{
11171116
struct dentry *parent = victim->d_parent;
1118-
if (parent != victim) {
1119-
--parent->d_lockref.count;
1117+
if (parent != victim && !--parent->d_lockref.count)
11201118
to_shrink_list(parent, list);
1121-
}
11221119
__dentry_kill(victim);
11231120
}
11241121

0 commit comments

Comments
 (0)