From 4fd7715fbe33db933555a0ab122df9f178e0e3e4 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 19 Jun 2017 12:36:04 -0400 Subject: [PATCH] LU-9558 llite: handle struct vm_operations changes 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 --- lustre/autoconf/lustre-core.m4 | 26 ++++++++++++++++++++++++++ lustre/llite/llite_mmap.c | 16 ++++++++++++++++ lustre/llite/vvp_io.c | 4 ++++ 3 files changed, 46 insertions(+) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 89a64c5..f1ed50a 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 6fc266c..2adbc52 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -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; diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index c272256..a1fa7fe 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -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) { -- 1.8.3.1