Whamcloud - gitweb
LU-12400 llite: Use the new vm_fault_t type 00/35500/3
authorShaun Tancheff <stancheff@cray.com>
Sun, 14 Jul 2019 12:43:14 +0000 (07:43 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 27 Jul 2019 00:22:18 +0000 (00:22 +0000)
Linux 4.17 created the new vm_fault_t type

Linux-commit: 1c8f422059ae5da07db7406ab916203f9417e396

Linux 5.1 changed the vm_fault_t type to bitwise unsigned int
which changes the interfaces registered to struct vm_operations_struct

Linux-commit: 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0

Prefer to match the upstream API and fallback to 'int'
where vm_fault_t is not available.

Test-Parameters: trivial
Cray-bug-id: LUS-7600
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: I7122fb0d4af3ee9a19c1a5d0b77c4f13f6850181
Reviewed-on: https://review.whamcloud.com/35500
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/llite_mmap.c

index 05b0d73..635563f 100644 (file)
@@ -3157,6 +3157,25 @@ i_pages, [
 ]) # LC_I_PAGES
 
 #
+# LC_VM_FAULT_T
+#
+# kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
+# mm: create the new vm_fault_t type
+#
+AC_DEFUN([LC_VM_FAULT_T], [
+LB_CHECK_COMPILE([if vm_fault_t type exists],
+vm_fault_t, [
+       #include <linux/mm_types.h>
+],[
+       vm_fault_t x = VM_FAULT_SIGBUS;
+       (void)x
+],[
+       AC_DEFINE(HAVE_VM_FAULT_T, 1,
+               [if vm_fault_t type exists])
+])
+]) # LC_VM_FAULT_T
+
+#
 # LC_INODE_TIMESPEC64
 #
 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
@@ -3440,6 +3459,7 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_BI_BDEV
 
        # 4.17
+       LC_VM_FAULT_T
        LC_I_PAGES
 
        # 4.18
index 8fb9131..4175c82 100644 (file)
@@ -323,6 +323,10 @@ static inline void set_nlink(struct inode *inode, unsigned int nlink)
 # define ll_umode_t    int
 #endif
 
+#ifndef HAVE_VM_FAULT_T
+#define vm_fault_t int
+#endif
+
 #include <linux/dcache.h>
 #ifndef HAVE_D_MAKE_ROOT
 static inline struct dentry *d_make_root(struct inode *root)
index e9552ae..1009c70 100644 (file)
@@ -261,7 +261,7 @@ static inline int to_fault_error(int result)
  * \retval VM_FAULT_ERROR on general error
  * \retval NOPAGE_OOM not have memory for allocate new page
  */
-static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
+static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct lu_env           *env;
        struct cl_io            *io;
@@ -340,17 +340,17 @@ out:
 }
 
 #ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
-static int ll_fault(struct vm_fault *vmf)
+static vm_fault_t ll_fault(struct vm_fault *vmf)
 {
        struct vm_area_struct *vma = vmf->vma;
 #else
-static int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+static vm_fault_t ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 #endif
        int count = 0;
        bool printed = false;
        bool cached;
-       int result;
+       vm_fault_t result;
        sigset_t set;
 
        ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
@@ -398,18 +398,19 @@ restart:
 }
 
 #ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
-static int ll_page_mkwrite(struct vm_fault *vmf)
+static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf)
 {
        struct vm_area_struct *vma = vmf->vma;
 #else
-static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
+static vm_fault_t ll_page_mkwrite(struct vm_area_struct *vma,
+                                 struct vm_fault *vmf)
 {
 #endif
        int count = 0;
        bool printed = false;
        bool retry;
        bool cached;
-       int result;
+       vm_fault_t result;
 
        ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
                           LPROC_LL_MKWRITE, 1);