Whamcloud - gitweb
LU-17001 pcc: fix the build failures for mmap_conv
authorQian Yingjin <qian@ddn.com>
Fri, 28 Jul 2023 08:40:16 +0000 (16:40 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 29 Jul 2023 07:54:20 +0000 (07:54 +0000)
PCC has implemented mmap page conversion for performance reason.
However, it is not stable, and disabled by default.

The Lustre build meets some failures against the newer kernel such
as Ubuntu 2204 kernel 6.2.0-26-generic.
The reason is that @pagevec_lookup and @add_to_page_cache_locked
are removed and no longer exported by the kernel.

This patch gives a simple solution. It disables the mmap_conv
option for PCC and does not perform mmap page conversion for
the newer kernel without @add_to_page_cache_locked exported.

Change-Id: Ie314830f225848b7f888709ad000fd7d36d3c0b2
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51798
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/pcc.c

index 1f3faa0..0be055b 100644 (file)
@@ -3414,6 +3414,19 @@ AC_DEFUN([LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL], [
 ]) # LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
 
 #
+# LC_HAVE_ADD_TO_PAGE_CACHE_LOCKED
+#
+# Linux version v6.0 commit: 2bb876b58d593d7f2522ec0f41f20a74fde76822
+# filemap: Remove add_to_page_cache() and add_to_page_cache_locked()
+# add_to_page_cache_locked() no longer exported.
+#
+AC_DEFUN([LC_HAVE_ADD_TO_PAGE_CACHE_LOCKED], [
+LB_CHECK_EXPORT([add_to_page_cache_locked], [mm/filemap.c],
+       [AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LOCKED, 1,
+                       [add_to_page_cache_locked is exported by the kernel])])
+]) # LC_HAVE_ADD_TO_PAGE_CACHE_LOCKED
+
+#
 # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
 #
 # Linux commit v6.0-rc3-94-g35b471467f88
@@ -3969,6 +3982,7 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_REGISTER_SHRINKER_FORMAT_NAMED
        LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
        LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2
+       LC_HAVE_ADD_TO_PAGE_CACHE_LOCKED
 
        # 6.1
        LC_HAVE_GET_RANDOM_U32_AND_U64
index 1af4937..143cdcf 100644 (file)
@@ -706,7 +706,11 @@ pcc_parse_value_pair(struct pcc_cmd *cmd, char *buffer)
                if (rc)
                        RETURN(rc);
                if (enable)
+#ifdef HAVE_ADD_TO_PAGE_CACHE_LOCKED
                        cmd->u.pccc_add.pccc_flags |= PCC_DATASET_MMAP_CONV;
+#else
+                       CWARN("mmap convert is not supported, ignored it.\n");
+#endif
                else
                        cmd->u.pccc_add.pccc_flags &= ~PCC_DATASET_MMAP_CONV;
        } else if (strcmp(key, PCC_CMDNAME_PROJ_QUOTA) == 0) {
@@ -3025,6 +3029,7 @@ static void pcc_mmap_io_init(struct inode *inode, enum pcc_io_type iot,
 static int pcc_mmap_pages_convert(struct inode *inode,
                                  struct inode *pcc_inode)
 {
+#ifdef HAVE_ADD_TO_PAGE_CACHE_LOCKED
        struct pagevec pvec;
        pgoff_t index = 0;
        int nr_pages;
@@ -3075,6 +3080,9 @@ static int pcc_mmap_pages_convert(struct inode *inode,
        }
 
        return rc;
+#else
+       return 0;
+#endif /* HAVE_ADD_TO_PAGE_CACHE_LOCKED */
 }
 
 static int pcc_mmap_mapping_set(struct inode *inode, struct inode *pcc_inode)