From: James Simmons Date: Thu, 27 Jul 2017 18:09:17 +0000 (-0400) Subject: LU-9558 llite: handle struct vm_operations changes X-Git-Tag: 2.10.51~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a1fc8dffef216b71cb4a29a5a8faa2aa7919d2ae;ds=sidebyside 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 Test-Parameters: trivial Change-Id: Ie44dd50de487044e3e2205978b7a36b15f7b0983 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/27651 Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index d6a0ad9..236bd77 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index e91be1c..11217c2 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -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 */ diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 6fc266c..e76f3e4 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -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; diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index c272256..9de5f9b 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -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) {