From 337aafa282d0f1127eef8b7ee4f865171f48bc12 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Fri, 3 Mar 2017 20:11:40 +0300 Subject: [PATCH] LU-9183 llite: handle removal the offset argument of direct_IO In commit c8b8e32d700fe943a935e435ae251364d016c497 the offset argument for ->direct_IO() was removed. Change-Id: I9f1cd5862dfcb40ad6b43b9da3072a852c550c49 Signed-off-by: Dmitry Eremin Reviewed-on: https://review.whamcloud.com/25822 Reviewed-by: James Simmons Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 25 +++++++++++++++++++++++++ lustre/llite/rw26.c | 10 ++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 8ee15f1..a4b33f2 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2309,6 +2309,28 @@ in_compat_syscall, [ ]) # LC_HAVE_IN_COMPAT_SYSCALL # +# LC_DIRECTIO_2ARGS +# +# Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497 +# direct-io: eliminate the offset argument to ->direct_IO +# +AC_DEFUN([LC_DIRECTIO_2ARGS], [ +LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments], +direct_io_2args, [ + #include +],[ + struct address_space_operations ops; + struct iov_iter *iter = NULL; + struct kiocb *iocb = NULL; + int rc; + rc = ops.direct_IO(iocb, iter); +],[ + AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1, + [direct_IO need 2 arguments]) +]) +]) # LC_DIRECTIO_2ARGS + +# # LC_HAVE_POSIX_ACL_VALID_USER_NS # # 4.8 posix_acl_valid takes struct user_namespace @@ -2534,6 +2556,9 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.6 LC_HAVE_IN_COMPAT_SYSCALL + # 4.7 + LC_DIRECTIO_2ARGS + # 4.8 LC_HAVE_POSIX_ACL_VALID_USER_NS LC_D_COMPARE_4ARGS diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 80eb9fc..7dd9510 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -345,9 +345,15 @@ ll_direct_IO( # ifndef HAVE_IOV_ITER_RW int rw, # endif - struct kiocb *iocb, struct iov_iter *iter, - loff_t file_offset) + struct kiocb *iocb, struct iov_iter *iter +# ifndef HAVE_DIRECTIO_2ARGS + , loff_t file_offset +# endif + ) { +#ifdef HAVE_DIRECTIO_2ARGS + loff_t file_offset = iocb->ki_pos; +#endif struct ll_cl_context *lcc; const struct lu_env *env; struct cl_io *io; -- 1.8.3.1