* [PATCH] fs: use kfree_rcu instead of i_callback
@ 2014-10-05 3:00 John de la Garza
2014-10-05 3:48 ` Al Viro
2014-10-05 10:24 ` Chuck Ebbert
0 siblings, 2 replies; 3+ messages in thread
From: John de la Garza @ 2014-10-05 3:00 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel
Since the callback is doing nothing more than calling kfree() we can
use kfree_rcu() instead of having to use a callback.
Signed-off-by: John de la Garza <john@jjdev.com>
---
fs/inode.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 26753ba..51deccd 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -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);
}
/**
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: use kfree_rcu instead of i_callback
2014-10-05 3:00 [PATCH] fs: use kfree_rcu instead of i_callback John de la Garza
@ 2014-10-05 3:48 ` Al Viro
2014-10-05 10:24 ` Chuck Ebbert
1 sibling, 0 replies; 3+ messages in thread
From: Al Viro @ 2014-10-05 3:48 UTC (permalink / raw)
To: John de la Garza; +Cc: linux-fsdevel, linux-kernel
On Sat, Oct 04, 2014 at 11:00:42PM -0400, John de la Garza wrote:
> Since the callback is doing nothing more than calling kfree() we can
> use kfree_rcu() instead of having to use a callback.
Except that this
> - kmem_cache_free(inode_cachep, inode);
isn't kfree()...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: use kfree_rcu instead of i_callback
2014-10-05 3:00 [PATCH] fs: use kfree_rcu instead of i_callback John de la Garza
2014-10-05 3:48 ` Al Viro
@ 2014-10-05 10:24 ` Chuck Ebbert
1 sibling, 0 replies; 3+ messages in thread
From: Chuck Ebbert @ 2014-10-05 10:24 UTC (permalink / raw)
To: John de la Garza; +Cc: viro, linux-fsdevel, linux-kernel
On Sat, 4 Oct 2014 23:00:42 -0400
John de la Garza <john@jjdev.com> wrote:
> Since the callback is doing nothing more than calling kfree() we can
> use kfree_rcu() instead of having to use a callback.
>
> Signed-off-by: John de la Garza <john@jjdev.com>
> ---
> fs/inode.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 26753ba..51deccd 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -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);
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.
> }
>
> /**
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-05 10:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-05 3:00 [PATCH] fs: use kfree_rcu instead of i_callback John de la Garza
2014-10-05 3:48 ` Al Viro
2014-10-05 10:24 ` Chuck Ebbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).