From e9a1d3d02df1c444e8f5190ad730817ce2506eea Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Fri, 3 Mar 2017 21:31:36 +0300 Subject: [PATCH] LU-9183 llite: handle removal the pos argument of generic_write_sync In commit e259221763a40403d5bb232209998e8c45804ab8 the pos argument of generic_write_sync() was removed. Change-Id: Iad76c517e372d7dc5e12670b5a0b8106005b71ff Signed-off-by: Dmitry Eremin Reviewed-on: https://review.whamcloud.com/25826 Tested-by: Jenkins Reviewed-by: Bob Glossman Reviewed-by: Bobi Jam Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++ lustre/llite/vvp_io.c | 11 ++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index b4dceea..395e1cc 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2352,6 +2352,26 @@ direct_io_2args, [ ]) # LC_DIRECTIO_2ARGS # +# LC_GENERIC_WRITE_SYNC_2ARGS +# +# Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497 +# direct-io: eliminate the offset argument to ->direct_IO +# +AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [ +LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments], +generic_write_sync_2args, [ + #include +],[ + struct kiocb *iocb = NULL; + ssize_t rc; + rc = generic_write_sync(iocb, 0); +],[ + AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1, + [generic_write_sync need 2 arguments]) +]) +]) # LC_GENERIC_WRITE_SYNC_2ARGS + +# # LC_HAVE_POSIX_ACL_VALID_USER_NS # # 4.8 posix_acl_valid takes struct user_namespace @@ -2599,6 +2619,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.7 LC_DIRECTIO_2ARGS + LC_GENERIC_WRITE_SYNC_2ARGS # 4.8 LC_HAVE_POSIX_ACL_VALID_USER_NS diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 809c4a0..7aa3cfd 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1066,14 +1066,19 @@ static int vvp_io_write_start(const struct lu_env *env, if (lock_node) inode_unlock(inode); - if (result > 0 || result == -EIOCBQUEUED) { + if (result > 0 || result == -EIOCBQUEUED) +#ifdef HAVE_GENERIC_WRITE_SYNC_2ARGS + result = generic_write_sync(vio->vui_iocb, result); +#else + { ssize_t err; - err = generic_write_sync(vio->vui_iocb->ki_filp, - pos, result); + err = generic_write_sync(vio->vui_iocb->ki_filp, pos, + result); if (err < 0 && result > 0) result = err; } +#endif } if (result > 0) { -- 1.8.3.1