]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: rcu free inodes
authorDave Chinner <dchinner@redhat.com>
Thu, 16 Dec 2010 05:41:39 +0000 (16:41 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 16 Dec 2010 05:41:39 +0000 (16:41 +1100)
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@redhat.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
fs/xfs/xfs_iget.c

index cdb1c2505fc672db69eb1ef9b1ee3519995bbdf9..9fae4755660457d09c0b68c4ef7ed5ad7a4269d8 100644 (file)
@@ -104,6 +104,18 @@ xfs_inode_alloc(
        return ip;
 }
 
+void
+__xfs_inode_free(
+       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);
+}
+
 void
 xfs_inode_free(
        struct xfs_inode        *ip)
@@ -147,7 +159,7 @@ xfs_inode_free(
        ASSERT(!spin_is_locked(&ip->i_flags_lock));
        ASSERT(completion_done(&ip->i_flush));
 
-       kmem_zone_free(xfs_inode_zone, ip);
+       call_rcu((struct rcu_head *)&VFS_I(ip)->i_dentry, __xfs_inode_free);
 }
 
 /*