fs: use kfree_rcu instead of i_callback
PATCH 1/1 fs: use kfree_rcu instead of i_callback
Since the callback is doing nothing more than calling kfree() we can use kfree_rcu() instead of having to use a callback.
--- fs/inode.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
fs/inode.c +1 -7
@@ -250,12 +250,6 @@ void __destroy_inode(struct inode *inode) }EXPORT_SYMBOL (__destroy_inode); -static void i_callback (struct rcu_head *head) -{ - struct inode *inode = container_of(head, struct inode, i_rcu); -kmem_cache_free (inode_cachep, inode); -} -static void destroy_inode (struct inode *inode) {BUG_ON (!list_empty (&inode->i_lru));
@@ -263,7 +257,7 @@ static void destroy_inode(struct inode *inode)if (inode->i_sb->s_op->destroy_inode) inode->i_sb->s_op->destroy_inode (inode);else -call_rcu (&inode->i_rcu, i_callback); +kfree (inode, i_rcu); }/**
Signature · 1 line
2.1.0
Al Viro
maintainerQuoted 2 lines · John de la Garza
Since the callback is doing nothing more than calling
kfree()we can usekfree_rcu()instead of having to use a callback.
Except that this
fs/inode.c void __destroy_inode(struct inode *inode) · line 256
Quoted 1 line
fs/inode.c +0
-1-kmem_cache_free (inode_cachep, inode);
isn't kfree()...
Quoted 26 lines · On Sat, 4 Oct 2014 23:00:42 -0400 John de la Garza <[email protected]> wrote:
Since the callback is doing nothing more than calling
kfree()we can usekfree_rcu()instead of having to use a callback.Signed-off-by John de la Garza <[email protected]>--- fs/inode.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)fs/inode.c +0
-6@@ -250,12 +250,6 @@ void __destroy_inode(struct inode *inode) }EXPORT_SYMBOL (__destroy_inode); -static void i_callback (struct rcu_head *head) -{ - struct inode *inode = container_of(head, struct inode, i_rcu); -kmem_cache_free (inode_cachep, inode); -} -static void destroy_inode (struct inode *inode) {BUG_ON (!list_empty (&inode->i_lru));
fs/inode.c static void destroy_inode(struct inode *inode) · line 260
Quoted 5 lines
fs/inode.c +1
-1@@ -263,7 +257,7 @@ static void destroy_inode(struct inode *inode)if (inode->i_sb->s_op->destroy_inode) inode->i_sb->s_op->destroy_inode (inode);else -call_rcu (&inode->i_rcu, i_callback); +kfree (inode, i_rcu);
Your description says "use kfree_rcu()" but that is kfree(). This won't even compile.
And as Al pointed out, kfree() is not the same as kmem_cache_free(). So you'd need to invent kmem_cache_free_rcu() also. Not sure that would have any value elsewhere.
Quoted 3 lines
fs/inode.c +0
-0}/**