[Top] [All Lists]

[PATCH 1/3] xfs: rcu free inodes

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/3] xfs: rcu free inodes
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 13 Dec 2010 12:32:35 +1100
Cc: paulmck@xxxxxxxxxxxxxxxxxx, eric.dumazet@xxxxxxxxx
In-reply-to: <1292203957-15819-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1292203957-15819-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

Introduce RCU freeing of XFS inodes so that we can convert lookup
traversals to use rcu_read_lock() protection. This patch only
introduces the RCU freeing to minimise the potential conflicts with
mainline if this is merged into mainline via a VFS patchset. It
abuses the i_dentry list for the RCU callback structure because the
VFS patches make this a union so it is safe to use like this and
simplifies and merge issues.

This patch uses basic RCU freeing rather than SLAB_DESTROY_BY_RCU.
The later lookup patches need the same "found free inode" protection
regardless of the RCU freeing method used, so once again the RCU
freeing method can be dealt with apprpriately at merge time without
affecting any other code.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
 fs/xfs/xfs_iget.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index cdb1c25..9fae475 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -105,6 +105,18 @@ xfs_inode_alloc(
+       struct rcu_head         *head)
+       struct inode            *inode = container_of((void *)head,
+                                                       struct inode, i_dentry);
+       struct xfs_inode        *ip = XFS_I(inode);
+       INIT_LIST_HEAD(&inode->i_dentry);
+       kmem_zone_free(xfs_inode_zone, ip);
        struct xfs_inode        *ip)
@@ -147,7 +159,7 @@ xfs_inode_free(
-       kmem_zone_free(xfs_inode_zone, ip);
+       call_rcu((struct rcu_head *)&VFS_I(ip)->i_dentry, __xfs_inode_free);

<Prev in Thread] Current Thread [Next in Thread>