diff mbox series

[1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free()

Message ID 20240221112205.48389-1-dmantipov@yandex.ru (mailing list archive)
State New, archived
Headers show
Series [1/2] dcache: prefer kfree()/kfree_rcu() in dentry_free() | expand

Commit Message

Dmitry Antipov Feb. 21, 2024, 11:22 a.m. UTC
In 'dentry_free()', prefer plain 'kfree()' and 'kfree_rcu()' over
'call_rcu()' with dummy '__d_free()' callback. This follows commit
878c391f74d6 ("fs: prefer kfree_rcu() in fasync_remove_entry()")
and should not be backported to stable as well.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 fs/dcache.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/fs/dcache.c b/fs/dcache.c
index b813528fb147..18770fe4ac10 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -290,13 +290,6 @@  static inline struct external_name *external_name(struct dentry *dentry)
 	return container_of(dentry->d_name.name, struct external_name, name[0]);
 }
 
-static void __d_free(struct rcu_head *head)
-{
-	struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
-
-	kmem_cache_free(dentry_cache, dentry); 
-}
-
 static void __d_free_external(struct rcu_head *head)
 {
 	struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
@@ -371,9 +364,9 @@  static void dentry_free(struct dentry *dentry)
 	}
 	/* if dentry was never visible to RCU, immediate free is OK */
 	if (dentry->d_flags & DCACHE_NORCU)
-		__d_free(&dentry->d_u.d_rcu);
+		kfree(dentry);
 	else
-		call_rcu(&dentry->d_u.d_rcu, __d_free);
+		kfree_rcu(dentry, d_u.d_rcu);
 }
 
 /*