Whamcloud - gitweb
LU-16302 llite: Use alloc_inode_sb() to allocate inodes 70/49070/9
authorShaun Tancheff <shaun.tancheff@hpe.com>
Fri, 2 Dec 2022 09:46:31 +0000 (03:46 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Jan 2023 15:31:30 +0000 (15:31 +0000)
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 <shaun.tancheff@hpe.com>
Change-Id: Ie6f091a01df33738ed2ef6f7fef9c1f9c1a51e03
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49070
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
lustre/autoconf/lustre-core.m4
lustre/llite/super25.c

index 1df9296..c8255b6 100644 (file)
@@ -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 <linux/fs.h>
+       ],[
+               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
 
index 41d2468..e0d9615 100644 (file)
@@ -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;
 }