Whamcloud - gitweb
LU-2987 llite: rcu-free inode 63/5763/5
authorJames Simmons <uja.ornl@gmail.com>
Tue, 25 Jun 2013 16:07:13 +0000 (12:07 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:59:13 +0000 (02:59 +0000)
Since 2.6.38, inode.i_rcu was added and file system .destroy_inode
should rcu-free inodes.

Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Idc12c94fd1bf9c99756c9bcb2d07f3061e6dad5a
Reviewed-on: http://review.whamcloud.com/5763
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org>
lustre/autoconf/lustre-core.m4
lustre/llite/super25.c

index a362095..076c3c0 100644 (file)
@@ -1639,6 +1639,26 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.38 inode.i_rcu added.
+#
+AC_DEFUN([LC_INODE_I_RCU],
+[AC_MSG_CHECKING([if inode.i_rcu exists])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/fs.h>
+],[
+       struct inode ino;
+       struct rcu_head rcu = {};
+       ino.i_rcu = rcu;
+],[
+       AC_DEFINE(HAVE_INODE_I_RCU, 1,
+               [inode.i_rcu exists])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # 2.6.38 export blkdev_get_by_dev
 #
 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
@@ -2344,6 +2364,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_GENERIC_PERMISSION
          LC_QUOTA_ON_USE_PATH
          LC_DCACHE_LOCK
+        LC_INODE_I_RCU
          LC_D_COMPARE_7ARGS
          LC_D_DELETE_CONST
 
index 6567d07..a0feba9 100644 (file)
@@ -61,11 +61,25 @@ static struct inode *ll_alloc_inode(struct super_block *sb)
        return &lli->lli_vfs_inode;
 }
 
+#ifdef HAVE_INODE_I_RCU
+static void ll_inode_destroy_callback(struct rcu_head *head)
+{
+       struct inode *inode = container_of(head, struct inode, i_rcu);
+       struct ll_inode_info *ptr = ll_i2info(inode);
+       OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
+}
+
+static void ll_destroy_inode(struct inode *inode)
+{
+       call_rcu(&inode->i_rcu, ll_inode_destroy_callback);
+}
+#else
 static void ll_destroy_inode(struct inode *inode)
 {
-        struct ll_inode_info *ptr = ll_i2info(inode);
-        OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
+       struct ll_inode_info *ptr = ll_i2info(inode);
+       OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
 }
+#endif
 
 int ll_init_inodecache(void)
 {