Whamcloud - gitweb
LU-9558 llite: handle struct vm_operations changes 51/27651/8
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 27 Jul 2017 18:09:17 +0000 (14:09 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 1 Aug 2017 05:34:14 +0000 (05:34 +0000)
For the linux 4.11 kernel passing in struct vm_area_struct
to struct vm_operations members has been removed since
struct vm_area_struct has been merged into struct vm_fault.
Handle these changes in the llite layer.

Linux-commit: 11bac80004499ea59f361ef2a5516c84b6eab675

Test-Parameters: trivial

Change-Id: Ie44dd50de487044e3e2205978b7a36b15f7b0983
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/27651
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/llite_mmap.c
lustre/llite/vvp_io.c

index d6a0ad9..236bd77 100644 (file)
@@ -2633,6 +2633,29 @@ vm_fault_address, [
 ]) # LC_HAVE_VM_FAULT_ADDRESS
 
 #
+# LC_VM_OPERATIONS_REMOVE_VMF_ARG
+#
+# Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
+# removed struct vm_area_struct as an argument for vm_operations since
+# in the same kernel version struct vma_area_struct was folded into
+# struct vm_fault.
+#
+AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
+LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
+vm_operations_no_vm_area_struct, [
+       #include <linux/mm.h>
+],[
+       struct vm_fault vmf;
+
+       ((struct vm_operations_struct *)0)->fault(&vmf);
+       ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
+],[
+       AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
+               ['struct vm_operations' remove struct vm_area_struct argument])
+])
+]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2848,6 +2871,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_IOP_GENERIC_READLINK
        LC_HAVE_VM_FAULT_ADDRESS
 
+       # 4.11
+       LC_VM_OPERATIONS_REMOVE_VMF_ARG
+
        #
        AS_IF([test "x$enable_server" != xno], [
                LC_STACK_SIZE
index e91be1c..11217c2 100644 (file)
@@ -627,4 +627,10 @@ static inline void __user *get_vmf_address(struct vm_fault *vmf)
 #endif
 }
 
+#ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
+# define ll_filemap_fault(vma, vmf) filemap_fault(vmf)
+#else
+# define ll_filemap_fault(vma, vmf) filemap_fault(vma, vmf)
+#endif
+
 #endif /* _LUSTRE_COMPAT_H */
index 6fc266c..e76f3e4 100644 (file)
@@ -283,7 +283,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (ll_sbi_has_fast_read(ll_i2sbi(file_inode(vma->vm_file)))) {
                /* do fast fault */
                ll_cl_add(vma->vm_file, env, NULL, LCC_MMAP);
-               fault_ret = filemap_fault(vma, vmf);
+               fault_ret = ll_filemap_fault(vma, vmf);
                ll_cl_remove(vma->vm_file, env);
 
                /* - If there is no error, then the page was found in cache and
@@ -342,8 +342,14 @@ out:
        RETURN(fault_ret);
 }
 
+#ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
+static int 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)
 {
+#endif
        int count = 0;
        bool printed = false;
        int result;
@@ -385,8 +391,14 @@ restart:
         return result;
 }
 
+#ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
+static int 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)
 {
+#endif
        int count = 0;
        bool printed = false;
        bool retry;
index c272256..9de5f9b 100644 (file)
@@ -1130,7 +1130,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
 {
        struct vm_fault *vmf = cfio->ft_vmf;
 
-       cfio->ft_flags = filemap_fault(cfio->ft_vma, vmf);
+       cfio->ft_flags = ll_filemap_fault(cfio->ft_vma, vmf);
        cfio->ft_flags_valid = 1;
 
        if (vmf->page) {