diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-16 00:41:39 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-16 00:41:39 -0500 |
commit | d95b7aaf9ab6738bef1ebcc52ab66563085e44ac (patch) | |
tree | b949bfa2c4588a84f1acf5d84e2fd7b41eab5a2f | |
parent | 6e857567dbbfe14dd6cc3f7414671b047b1ff5c7 (diff) |
xfs: rcu free inodes
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>
-rw-r--r-- | 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 cdb1c2505fc6..9fae47556604 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -105,6 +105,18 @@ xfs_inode_alloc( | |||
105 | } | 105 | } |
106 | 106 | ||
107 | void | 107 | void |
108 | __xfs_inode_free( | ||
109 | struct rcu_head *head) | ||
110 | { | ||
111 | struct inode *inode = container_of((void *)head, | ||
112 | struct inode, i_dentry); | ||
113 | struct xfs_inode *ip = XFS_I(inode); | ||
114 | |||
115 | INIT_LIST_HEAD(&inode->i_dentry); | ||
116 | kmem_zone_free(xfs_inode_zone, ip); | ||
117 | } | ||
118 | |||
119 | void | ||
108 | xfs_inode_free( | 120 | xfs_inode_free( |
109 | struct xfs_inode *ip) | 121 | struct xfs_inode *ip) |
110 | { | 122 | { |
@@ -147,7 +159,7 @@ xfs_inode_free( | |||
147 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); | 159 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); |
148 | ASSERT(completion_done(&ip->i_flush)); | 160 | ASSERT(completion_done(&ip->i_flush)); |
149 | 161 | ||
150 | kmem_zone_free(xfs_inode_zone, ip); | 162 | call_rcu((struct rcu_head *)&VFS_I(ip)->i_dentry, __xfs_inode_free); |
151 | } | 163 | } |
152 | 164 | ||
153 | /* | 165 | /* |