Whamcloud - gitweb
LU-9183 llite: handle removal the pos argument of generic_write_sync 26/25826/11
authorDmitry Eremin <dmitry.eremin@intel.com>
Fri, 3 Mar 2017 18:31:36 +0000 (21:31 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 9 May 2017 03:44:56 +0000 (03:44 +0000)
In commit e259221763a40403d5bb232209998e8c45804ab8 the pos argument
of generic_write_sync() was removed.

Change-Id: Iad76c517e372d7dc5e12670b5a0b8106005b71ff
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/25826
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/llite/vvp_io.c

index b4dceea..395e1cc 100644 (file)
@@ -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 <linux/fs.h>
+],[
+       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
index 809c4a0..7aa3cfd 100644 (file)
@@ -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) {