diff mbox series

[13/15] shrink_dentry_list(): no need to check that dentry refcount is marked dead

Message ID 20231101062104.2104951-13-viro@zeniv.linux.org.uk (mailing list archive)
State New, archived
Headers show
Series [01/15] fast_dput(): having ->d_delete() is not reason to delay refcount decrement | expand

Commit Message

Al Viro Nov. 1, 2023, 6:21 a.m. UTC
... we won't see DCACHE_MAY_FREE on anything that is *not* dead
and checking d_flags is just as cheap as checking d_count.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/dcache.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/dcache.c b/fs/dcache.c
index 49b3fd27559f..19f6eb6f2bde 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1116,11 +1116,10 @@  void shrink_dentry_list(struct list_head *list)
 		spin_lock(&dentry->d_lock);
 		rcu_read_lock();
 		if (!lock_for_kill(dentry)) {
-			bool can_free = false;
+			bool can_free;
 			rcu_read_unlock();
 			d_shrink_del(dentry);
-			if (dentry->d_lockref.count < 0)
-				can_free = dentry->d_flags & DCACHE_MAY_FREE;
+			can_free = dentry->d_flags & DCACHE_MAY_FREE;
 			spin_unlock(&dentry->d_lock);
 			if (can_free)
 				dentry_free(dentry);