From b5705391d609b7e14335f790998367a6329169f3 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 14 Jun 2017 13:54:13 -0400 Subject: [PATCH] LU-9558 llite: use struct vma_area_struct address field The field virtual_address of struct vma_area_struct was removed since it provided no better benefit than just using the address field directly. Linux-commit: 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e Change-Id: I05068cdf27c93c5b3201c76ec043bc6c0e66df1f Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/27281 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/include/lustre_compat.h | 9 +++++++++ lustre/llite/vvp_io.c | 6 +++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index b9b8a6d..89a64c5 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2473,6 +2473,25 @@ inode_ops_readlink, [ ]) # LC_IOP_GENERIC_READLINK # +# LC_HAVE_VM_FAULT_ADDRESS +# +# Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e +# removed virtual_address field. Need to use address field instead +# +AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [ +LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field], +vm_fault_address, [ + #include +],[ + struct vm_fault vmf; + vmf.address = NULL; +],[ + AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1, + [virtual_address has been replaced by address field]) +]) +]) # LC_HAVE_VM_FAULT_ADDRESS + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -2678,6 +2697,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.10 LC_IOP_GENERIC_READLINK + LC_HAVE_VM_FAULT_ADDRESS # AS_IF([test "x$enable_server" != xno], [ diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index bdd3d78..1de5baf 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -568,4 +568,13 @@ __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *iter) } #endif /* HAVE_FILE_OPERATIONS_READ_WRITE_ITER */ +static inline void __user *get_vmf_address(struct vm_fault *vmf) +{ +#ifdef HAVE_VM_FAULT_ADDRESS + return (void __user *)vmf->address; +#else + return vmf->virtual_address; +#endif +} + #endif /* _LUSTRE_COMPAT_H */ diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index a6c355a..c272256 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1135,7 +1135,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio) if (vmf->page) { LL_CDEBUG_PAGE(D_PAGE, vmf->page, "got addr %p type NOPAGE\n", - vmf->virtual_address); + get_vmf_address(vmf)); if (unlikely(!(cfio->ft_flags & VM_FAULT_LOCKED))) { lock_page(vmf->page); cfio->ft_flags |= VM_FAULT_LOCKED; @@ -1147,12 +1147,12 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio) } if (cfio->ft_flags & VM_FAULT_SIGBUS) { - CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", vmf->virtual_address); + CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", get_vmf_address(vmf)); return -EFAULT; } if (cfio->ft_flags & VM_FAULT_OOM) { - CDEBUG(D_PAGE, "got addr %p - OOM\n", vmf->virtual_address); + CDEBUG(D_PAGE, "got addr %p - OOM\n", get_vmf_address(vmf)); return -ENOMEM; } -- 1.8.3.1