Whamcloud - gitweb
LU-18475 build: compatibility updates for kernel 6.12 25/57125/7
authorShaun Tancheff <shaun.tancheff@hpe.com>
Sat, 21 Dec 2024 11:01:03 +0000 (16:31 +0530)
committerOleg Drokin <green@whamcloud.com>
Thu, 6 Mar 2025 08:05:24 +0000 (08:05 +0000)
Linux commit v6.6-rc2-11-gd77008421afd
 groups: Convert group_info.usage to refcount_t
Provide wrappers to inc/dec group_info.usage

Linux v6.12-rc1-3-g5f60d5f6bbc1
 move asm/unaligned.h to linux/unaligned.h
Add a configure test to determine which header to use

Linux v6.11-rc1-51-ga225800f322a
 fs: Convert aops->write_end to take a folio
Linux v6.11-rc1-52-g1da86618bdce
 fs: Convert aops->write_begin to take a folio
Add 'struct folio' for page vs folio signature change.

Linux v6.11-rc4-27-g11068e0b64cb
  fs: remove f_version
f_version is removed, conditionally ignore it.

Linux v6.11-rc6-86-g09022bc196d2
  mm: remove PG_error
PG_error flag and PageError wrappers are removed.

Linux v6.11-rc6-233-g99f86bbda317
  mm: remove PageMlocked
PageMLocked wrappers are removed

Linux v6.11-rc6-225-ge880034cf718
  mm: introduce page_mapcount_is_type()
PAGE_MAPCOUNT_RESERVE is removed and page_mapcount_is_type()
is used instead.

Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I43928749e017c95edcbba9469550c33b00160e16
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57125
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
config/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/dir.c
lustre/llite/llite_lib.c
lustre/llite/rw26.c
lustre/llite/vvp_dev.c
lustre/mdc/mdc_locks.c
lustre/obdclass/upcall_cache_internal.c
lustre/obdclass/upcall_cache_internal.h
lustre/osc/osc_page.c
lustre/osd-ldiskfs/osd_iam.h

index ecf9eb5..e516721 100644 (file)
@@ -4642,6 +4642,29 @@ AC_DEFUN([LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG], [
 ]) # LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
 
 #
+# LC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+#
+# Linux commit v6.6-rc2-11-gd77008421afd
+#  groups: Convert group_info.usage to refcount_t
+#
+AC_DEFUN([LC_SRC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT], [
+       LB2_LINUX_TEST_SRC([struct_group_info_usage_is_refcount_t], [
+               #include <linux/cred.h>
+       ],[
+               struct group_info *group = NULL;
+
+               refcount_dec(&group->usage);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'struct group_info.usage' is refcount_t],
+       [struct_group_info_usage_is_refcount_t], [
+               AC_DEFINE(HAVE_GROUP_INFO_USAGE_AS_REFCOUNT, 1,
+                       ['struct group_info.usage' is refcount_t])
+       ])
+]) # LC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+
+#
 # LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
 #
 # Linux commit v6.5-rc2-20-g2ddd3cac1fa9
@@ -4786,6 +4809,172 @@ AC_DEFUN([LC_HAVE_STRUCT_FILE_LOCK_CORE], [
 ]) # LC_HAVE_STRUCT_FILE_LOCK_CORE
 
 #
+# LC_HAVE_LINUX_UNALIGNED_HEADER
+#
+# Linux v6.12-rc1-3-g5f60d5f6bbc1
+#  move asm/unaligned.h to linux/unaligned.h
+#
+AC_DEFUN([LC_SRC_HAVE_LINUX_UNALIGNED_HEADER],[
+       LB2_LINUX_TEST_SRC([linux_unaligned_header], [
+               #include <linux/unaligned.h>
+       ],[
+       ],[])
+])
+AC_DEFUN([LC_HAVE_LINUX_UNALIGNED_HEADER],[
+       LB2_MSG_LINUX_TEST_RESULT([if linux/unaligned.h header is available],
+       [linux_unaligned_header], [
+               AC_DEFINE(HAVE_LINUX_UNALIGNED_HEADER, 1,
+                       [linux/unaligned.h header is available])
+       ])
+]) # LC_HAVE_LINUX_UNALIGNED_HEADER
+
+#
+# LC_HAVE_WRITE_BEGIN_FOLIO
+#
+# Linux v6.11-rc1-51-ga225800f322a
+#  fs: Convert aops->write_end to take a folio
+# Linux v6.11-rc1-52-g1da86618bdce
+#  fs: Convert aops->write_begin to take a folio
+#
+AC_DEFUN([LC_SRC_HAVE_WRITE_BEGIN_FOLIO],[
+       LB2_LINUX_TEST_SRC([write_begin_with_folio], [
+               #include <linux/fs.h>
+
+               static
+               int ll_write_begin(struct file *f, struct address_space *m,
+                                  loff_t pos, unsigned len,
+                                  struct folio **foliop, void **fsdata)
+               {
+                       *foliop = NULL;
+                       *fsdata = NULL;
+                       return 0;
+               }
+
+               static
+               int ll_write_end(struct file *f, struct address_space *m,
+                                loff_t pos, unsigned len, unsigned copied,
+                                struct folio *folio, void *fsdata)
+               {
+                       return 0;
+               }
+
+               const struct address_space_operations ll_aops = {
+                       .write_begin    = ll_write_begin,
+                       .write_end      = ll_write_end,
+               };
+       ],[
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_WRITE_BEGIN_FOLIO],[
+       LB2_MSG_LINUX_TEST_RESULT([if write_begin() takes folio],
+       [write_begin_with_folio], [
+               AC_DEFINE(HAVE_WRITE_BEGIN_FOLIO, 1,
+                       [write_begin() takes folio])
+       ])
+]) # LC_HAVE_WRITE_BEGIN_FOLIO
+
+#
+# LC_HAVE_STRUCT_FILE_F_VERSION
+#
+# Linux v6.11-rc4-27-g11068e0b64cb
+#   fs: remove f_version
+#
+AC_DEFUN([LC_SRC_HAVE_STRUCT_FILE_F_VERSION], [
+       LB2_LINUX_TEST_SRC([struct_file_f_version], [
+               #include <linux/pagemap.h>
+       ],[
+               struct file *file __attribute__ ((unused)) = NULL;
+
+               file->f_version = 0;
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_STRUCT_FILE_F_VERSION], [
+       LB2_MSG_LINUX_TEST_RESULT([if struct file has f_version],
+       [struct_file_f_version], [
+               AC_DEFINE(HAVE_STRUCT_FILE_F_VERSION, 1,
+                       [struct file has f_version])
+       ])
+]) # LC_HAVE_STRUCT_FILE_F_VERSION
+
+#
+# LC_HAVE_PAGEERROR
+#
+# Linux v6.11-rc6-86-g09022bc196d2
+#   mm: remove PG_error
+#
+AC_DEFUN([LC_SRC_HAVE_PG_ERROR], [
+       LB2_LINUX_TEST_SRC([pg_error], [
+               #include <linux/pagemap.h>
+       ],[
+               bool x __attribute__ ((unused)) = PageError(NULL);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_PG_ERROR], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'PageError()' is available],
+       [pg_error], [
+               AC_DEFINE(HAVE_PG_ERROR, 1,
+                       ['PageError()()' is available])
+       ],[
+               AC_DEFINE(PageError(pg), (0),
+                         ['PageError()' replacement])
+               AC_DEFINE(SetPageError(pg), ,
+                         ['SetPageError()' replacement])
+               AC_DEFINE(ClearPageError(pg), ,
+                         ['ClearPageError()' replacement])
+       ])
+]) # LC_HAVE_PG_ERROR
+
+#
+# LC_HAVE_FOLIO_TEST_MLOCKED
+#
+# Linux v6.11-rc6-233-g99f86bbda317
+#   mm: remove PageMlocked
+#
+AC_DEFUN([LC_SRC_HAVE_FOLIO_TEST_MLOCKED], [
+       LB2_LINUX_TEST_SRC([folio_test_mlocked], [
+               #include <linux/pagemap.h>
+       ],[
+               bool x __attribute__ ((unused)) = folio_test_mlocked(NULL);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_FOLIO_TEST_MLOCKED], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'folio_test_mlocked()' is available],
+       [folio_test_mlocked], [
+               AC_DEFINE([folio_test_mlocked_page(pg)],
+                         [folio_test_mlocked(page_folio((pg)))],
+                         ['folio_test_mlocked()' is available])
+       ],[
+               AC_DEFINE([folio_test_mlocked_page(pg)], [PageMlocked((pg))],
+                         ['folio_test_mlocked()' replacement])
+       ])
+]) # LC_HAVE_FOLIO_TEST_MLOCKED
+
+#
+# LC_HAVE_PAGE_MAPCOUNT_IS_TYPE
+#
+# Linux v6.11-rc6-225-ge880034cf718
+#   mm: introduce page_mapcount_is_type()
+#
+AC_DEFUN([LC_SRC_HAVE_PAGE_MAPCOUNT_IS_TYPE], [
+       LB2_LINUX_TEST_SRC([page_mapcount_is_type], [
+               #include <linux/pagemap.h>
+       ],[
+               bool x __attribute__ ((unused)) = page_mapcount_is_type(0);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_PAGE_MAPCOUNT_IS_TYPE], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'page_mapcount_is_type()' is available],
+       [page_mapcount_is_type], [
+               AC_DEFINE(HAVE_PAGE_MAPCOUNT_IS_TYPE, 1,
+                       ['page_mapcount_is_type()' is available])
+       ],[
+               AC_DEFINE(page_mapcount_is_type(count),
+                         (count < PAGE_MAPCOUNT_RESERVE + 1),
+                         [need 'page_mapcount_is_type()' replacement])
+       ])
+]) # LC_HAVE_PAGE_MAPCOUNT_IS_TYPE
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -5071,9 +5260,10 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        LC_SRC_HAVE_INODE_GET_CTIME
        LC_SRC_HAVE_MMAP_WRITE_TRYLOCK
        LC_SRC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
-       LC_SRC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
 
        # 6.7
+       LC_SRC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+       LC_SRC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
        LC_SRC_HAVE_INODE_GET_MTIME_SEC
        LC_SRC_HAVE_SHRINKER_ALLOC
 
@@ -5085,6 +5275,14 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        # 6.9
        LC_SRC_HAVE_STRUCT_FILE_LOCK_CORE
 
+       # 6.12
+       LC_SRC_HAVE_LINUX_UNALIGNED_HEADER
+       LC_SRC_HAVE_WRITE_BEGIN_FOLIO
+       LC_SRC_HAVE_STRUCT_FILE_F_VERSION
+       LC_SRC_HAVE_PG_ERROR
+       LC_SRC_HAVE_FOLIO_TEST_MLOCKED
+       LC_SRC_HAVE_PAGE_MAPCOUNT_IS_TYPE
+
        # kernel patch to extend integrity interface
        LC_SRC_BIO_INTEGRITY_PREP_FN
 ])
@@ -5392,9 +5590,10 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_HAVE_INODE_GET_CTIME
        LC_HAVE_MMAP_WRITE_TRYLOCK
        LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
-       LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
 
        # 6.7
+       LC_HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+       LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
        LC_HAVE_INODE_GET_MTIME_SEC
        LC_HAVE_SHRINKER_ALLOC
 
@@ -5406,6 +5605,14 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        # 6.9
        LC_HAVE_STRUCT_FILE_LOCK_CORE
 
+       # 6.12
+       LC_HAVE_LINUX_UNALIGNED_HEADER
+       LC_HAVE_WRITE_BEGIN_FOLIO
+       LC_HAVE_STRUCT_FILE_F_VERSION
+       LC_HAVE_PG_ERROR
+       LC_HAVE_FOLIO_TEST_MLOCKED
+       LC_HAVE_PAGE_MAPCOUNT_IS_TYPE
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 ])
index 3ae12ff..a0ba4c2 100644 (file)
@@ -969,6 +969,22 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 }
 #endif  /* !HAVE_INODE_GET_MTIME_SEC */
 
+#ifdef HAVE_WRITE_BEGIN_FOLIO
+/* .write_begin is passed **folio which is put with .write_end *folio */
+#define wbe_folio                      folio
+#define wbe_page_folio(page)           page_folio((page))
+static inline struct page *wbe_folio_page(struct folio *folio)
+{
+       LASSERT(folio_nr_pages(folio) == 1);
+       return folio_page(folio, 0);
+}
+#else
+/* .write_begin is passed **page which is put with .write_end *page */
+#define wbe_folio                      page
+#define wbe_page_folio(page)           (page)
+#define wbe_folio_page(page)           (page)
+#endif
+
 #ifdef HAVE_FOLIO_MAPCOUNT
 /* clone of fs/proc/internal.h:
  *   folio_precise_page_mapcount(struct folio *folio, struct page *page)
@@ -978,7 +994,7 @@ static inline int folio_mapcount_page(struct page *page)
        struct folio *folio = page_folio(page);
        int mapcount = atomic_read(&page->_mapcount) + 1;
 
-       if (mapcount < PAGE_MAPCOUNT_RESERVE + 1)
+       if (page_mapcount_is_type(mapcount))
                mapcount = 0;
        if (folio_test_large(folio))
                mapcount += folio_entire_mapcount(folio);
index a081613..246e4ae 100644 (file)
@@ -2955,7 +2955,9 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin)
                        else
                                lfd->lfd_pos = offset;
                        file->f_pos = offset;
+#ifdef HAVE_STRUCT_FILE_F_VERSION
                        file->f_version = 0;
+#endif
                }
                ret = offset;
        }
index 1addea7..a9da88d 100644 (file)
@@ -3086,8 +3086,8 @@ void ll_truncate_inode_pages_final(struct inode *inode)
 
        LASSERTF((inode->i_state & I_FREEING) || inode_is_locked(inode),
                 DFID ":inode %px state %#lx, lli_flags %#lx\n",
-                PFID(ll_inode2fid(inode)), inode, inode->i_state,
-                ll_i2info(inode)->lli_flags);
+                PFID(ll_inode2fid(inode)), inode,
+                (unsigned long)inode->i_state, ll_i2info(inode)->lli_flags);
 
        truncate_inode_pages_final(mapping);
 
@@ -3114,7 +3114,7 @@ void ll_truncate_inode_pages_final(struct inode *inode)
 #endif
                CWARN("%s: inode="DFID"(%p) nrpages=%lu state %#lx, lli_flags %#lx, see https://jira.whamcloud.com/browse/LU-118\n",
                      ll_i2sbi(inode)->ll_fsname, PFID(ll_inode2fid(inode)),
-                     inode, nrpages, inode->i_state,
+                     inode, nrpages, (unsigned long)inode->i_state,
                      ll_i2info(inode)->lli_flags);
 #ifdef HAVE_XARRAY_SUPPORT
                rcu_read_lock();
index 04ec036..baa92ce 100644 (file)
@@ -777,12 +777,17 @@ static int ll_tiny_write_begin(struct page *vmpage, struct address_space *mappin
        return 0;
 }
 
+/*
+ * write_begin is responsible for allocating page cache pages to be used
+ * to hold data for buffered i/o on the 'write' path.
+ * Called by generic_perform_write() to allocate one page [or one folio]
+ */
 static int ll_write_begin(struct file *file, struct address_space *mapping,
                          loff_t pos, unsigned int len,
 #ifdef HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS
                          unsigned int flags,
 #endif
-                         struct page **pagep, void **fsdata)
+                         struct wbe_folio **foliop, void **fsdata)
 {
        struct ll_cl_context *lcc = NULL;
        const struct lu_env  *env = NULL;
@@ -923,7 +928,7 @@ out:
                if (io)
                        io->ci_result = result;
        } else {
-               *pagep = vmpage;
+               *foliop = wbe_page_folio(vmpage);
                *fsdata = lcc;
        }
        RETURN(result);
@@ -967,13 +972,14 @@ out:
 
 static int ll_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *vmpage, void *fsdata)
+                       struct wbe_folio *vmfolio, void *fsdata)
 {
        struct ll_cl_context *lcc = fsdata;
        const struct lu_env *env;
        struct cl_io *io;
        struct vvp_io *vio;
        struct cl_page *page;
+       struct page *vmpage = wbe_folio_page(vmfolio);
        unsigned from = pos & (PAGE_SIZE - 1);
        bool unplug = false;
        int result = 0;
index 2509391..058b88a 100644 (file)
@@ -475,7 +475,9 @@ static void vvp_pgcache_page_show(const struct lu_env *env,
                   page_count(vmpage));
        has_flags = 0;
        seq_page_flag(seq, vmpage, locked, has_flags);
+#ifdef HAVE_PG_ERROR
        seq_page_flag(seq, vmpage, error, has_flags);
+#endif
        seq_page_flag(seq, vmpage, referenced, has_flags);
        seq_page_flag(seq, vmpage, uptodate, has_flags);
        seq_page_flag(seq, vmpage, dirty, has_flags);
index d017b8c..ea62eee 100644 (file)
@@ -109,7 +109,7 @@ int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh,
                LASSERTF(old_inode->i_state & I_FREEING,
                         "Found existing inode %px/%lu/%u state %lu in lock: setting data to %px/%lu/%u\n",
                         old_inode, old_inode->i_ino, old_inode->i_generation,
-                        old_inode->i_state,
+                        (unsigned long)old_inode->i_state,
                         new_inode, new_inode->i_ino, new_inode->i_generation);
        }
        lock->l_resource->lr_lvb_inode = new_inode;
index 0aa1bb9..7aa493a 100644 (file)
@@ -77,11 +77,11 @@ restart:
                        /* Do not place user's group ID in group list */
                        supp_in_ginfo[i] = true;
                } else if (ginfo_ngroups) {
-                       atomic_inc(&identity->mi_ginfo->usage);
+                       upcall_group_usage_inc(identity->mi_ginfo);
                        supp_in_ginfo[i] =
                                lustre_groups_search(identity->mi_ginfo,
                                                     uc->uc_suppgids[i]);
-                       atomic_dec(&identity->mi_ginfo->usage);
+                       upcall_group_usage_dec(identity->mi_ginfo);
                }
        }
 
@@ -119,9 +119,9 @@ restart:
                 * just start over.
                 */
                if (ginfo_ngroups) {
-                       atomic_inc(&identity->mi_ginfo->usage);
+                       upcall_group_usage_inc(identity->mi_ginfo);
                        lustre_list_from_groups(glist_p, identity->mi_ginfo);
-                       atomic_dec(&identity->mi_ginfo->usage);
+                       upcall_group_usage_dec(identity->mi_ginfo);
                } else if (identity->mi_ginfo && identity->mi_ginfo->ngroups) {
                        CFS_FREE_PTR_ARRAY(groups, groups_num + ginfo_ngroups);
                        groups = NULL;
index f975beb..f362941 100644 (file)
@@ -63,4 +63,22 @@ static inline int upcall_cache_get_entry_internal(struct upcall_cache *cache,
 }
 #endif
 
+static inline void upcall_group_usage_inc(struct group_info *group)
+{
+#ifdef HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+       refcount_inc(&group->usage);
+#else
+       atomic_inc(&group->usage);
+#endif
+}
+
+static inline void upcall_group_usage_dec(struct group_info *group)
+{
+#ifdef HAVE_GROUP_INFO_USAGE_AS_REFCOUNT
+       return refcount_dec(&group->usage);
+#else
+       return atomic_dec(&group->usage);
+#endif
+}
+
 #endif /* _UPCALL_CACHE_INTERNAL_H */
index e9b6240..121e5d5 100644 (file)
@@ -535,7 +535,7 @@ static inline bool lru_page_busy(struct client_obd *cli, struct cl_page *page)
  */
 static inline bool lru_page_unevictable(struct cl_page *clpage)
 {
-       return PageMlocked(cl_page_vmpage(clpage));
+       return folio_test_mlocked_page(cl_page_vmpage(clpage));
 }
 
 enum shrink_action {
index d620f97..1083cd3 100644 (file)
 #define __LINUX_LUSTRE_IAM_H__
 
 #include <linux/module.h>
+#ifdef HAVE_LINUX_UNALIGNED_HEADER
+#include <linux/unaligned.h>
+#else
 #include <asm/unaligned.h>
+#endif
 
 #include "osd_dynlocks.h"