From: James Simmons Date: Tue, 25 Jun 2013 16:07:13 +0000 (-0400) Subject: LU-2987 llite: rcu-free inode X-Git-Tag: 2.4.52~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F5763%2F5;p=fs%2Flustre-release.git LU-2987 llite: rcu-free inode Since 2.6.38, inode.i_rcu was added and file system .destroy_inode should rcu-free inodes. Signed-off-by: Peng Tao Signed-off-by: James Simmons Change-Id: Idc12c94fd1bf9c99756c9bcb2d07f3061e6dad5a Reviewed-on: http://review.whamcloud.com/5763 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Keith Mannthey Tested-by: Maloo Reviewed-by: Alexey Shvetsov --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index a362095..076c3c0 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 6567d07..a0feba9 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -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) {