From a883fec55694491a26b664c2cff7fb904f72b7af Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Fri, 2 Dec 2022 03:46:31 -0600 Subject: [PATCH] LU-16302 llite: Use alloc_inode_sb() to allocate inodes linux-commit: v5.17-49-g8b9f3ac5b01d fs: introduce alloc_inode_sb() to allocate filesystems specific inode Filesystems are expected to use alloc_inode_sb to allocate inodes for proper lru handling. Test-Parameters: trivial HPE-bug-id: LUS-11332 Signed-off-by: Shaun Tancheff Change-Id: Ie6f091a01df33738ed2ef6f7fef9c1f9c1a51e03 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49070 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Petros Koutoupis Reviewed-by: jsimmons --- lustre/autoconf/lustre-core.m4 | 35 +++++++++++++++++++++++++++++++---- lustre/llite/super25.c | 11 +++++++++-- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 1df9296..c8255b6 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2800,9 +2800,6 @@ kiocb_ki_complete_2args, [ EXTRA_KCFLAGS="$tmp_flags" ]) # LC_HAVE_KIOCB_COMPLETE_2ARGS -AC_DEFUN([LC_PROG_LINUX_SRC], []) -AC_DEFUN([LC_PROG_LINUX_RESULTS], []) - # # LC_HAVE_INVALIDATE_FOLIO # @@ -2853,6 +2850,33 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LC_HAVE_DIRTY_FOLIO # +# LC_HAVE_ALLOC_INODE_SB +# +# linux commit v5.17-49-g8b9f3ac5b01d +# fs: introduce alloc_inode_sb() to allocate filesystems specific inode +# +AC_DEFUN([LC_HAVE_ALLOC_INODE_SB], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_COMPILE([if alloc_inode_sb() exists], +alloc_inode_sb, [ + #include + ],[ + struct super_block *sb = NULL; + struct kmem_cache *cache = NULL; + + (void)alloc_inode_sb(sb, cache, GFP_NOFS); + ],[ + AC_DEFINE(HAVE_ALLOC_INODE_SB, 1, + [alloc_inode_sb() exists]) + ]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LC_HAVE_ALLOC_INODE_SB + +AC_DEFUN([LC_PROG_LINUX_SRC], []) +AC_DEFUN([LC_PROG_LINUX_RESULTS], []) + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -3061,10 +3085,13 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG LC_HAVE_KIOCB_COMPLETE_2ARGS - # 5.18 + # 5.17 LC_HAVE_INVALIDATE_FOLIO LC_HAVE_DIRTY_FOLIO + # 5.18 + LC_HAVE_ALLOC_INODE_SB + # kernel patch to extend integrity interface LC_BIO_INTEGRITY_PREP_FN diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 41d2468..e0d9615 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -50,10 +50,17 @@ static struct kmem_cache *ll_inode_cachep; static struct inode *ll_alloc_inode(struct super_block *sb) { struct ll_inode_info *lli; +#ifdef HAVE_ALLOC_INODE_SB + lli = alloc_inode_sb(sb, ll_inode_cachep, GFP_NOFS); + if (!lli) + return NULL; + OBD_ALLOC_POST(lli, sizeof(*lli), "slab-alloced"); + memset(lli, 0, sizeof(*lli)); +#else OBD_SLAB_ALLOC_PTR_GFP(lli, ll_inode_cachep, GFP_NOFS); - if (lli == NULL) + if (!lli) return NULL; - +#endif inode_init_once(&lli->lli_vfs_inode); return &lli->lli_vfs_inode; } -- 1.8.3.1