Whamcloud - gitweb
LU-9558 llite: handle struct vm_operations changes 51/27651/3
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 19 Jun 2017 16:36:04 +0000 (12:36 -0400)
committerJames Simmons <uja.ornl@yahoo.com>
Mon, 19 Jun 2017 16:36:04 +0000 (12:36 -0400)
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

Change-Id: Ie44dd50de487044e3e2205978b7a36b15f7b0983
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
lustre/autoconf/lustre-core.m4
lustre/llite/llite_mmap.c
lustre/llite/vvp_io.c

index 89a64c5..f1ed50a 100644 (file)
@@ -2492,6 +2492,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
@@ -2699,6 +2722,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 6fc266c..2adbc52 100644 (file)
@@ -283,7 +283,11 @@ 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);
+#ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
+               fault_ret = filemap_fault(vmf);
+#else
                fault_ret = filemap_fault(vma, vmf);
+#endif
                ll_cl_remove(vma->vm_file, env);
 
                /* - If there is no error, then the page was found in cache and
@@ -342,8 +346,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 +395,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..a1fa7fe 100644 (file)
@@ -1130,7 +1130,11 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
 {
        struct vm_fault *vmf = cfio->ft_vmf;
 
+#ifdef HAVE_VM_OPS_USE_VM_FAULT_ONLY
+       cfio->ft_flags = filemap_fault(vmf);
+#else
        cfio->ft_flags = filemap_fault(cfio->ft_vma, vmf);
+#endif
        cfio->ft_flags_valid = 1;
 
        if (vmf->page) {