Whamcloud - gitweb
LU-16112 build: ki_complete removed unused argument
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 31 Jan 2023 08:16:31 +0000 (00:16 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 16 Feb 2023 21:16:35 +0000 (21:16 +0000)
Linux commit v5.15-rc6-145-g6b19b766e8f0
   fs: get rid of the res2 iocb->ki_complete argument

Prior to 4.1 Linux provided an aio_complete(iocb, res, res2)
which propagated res2 to io_event.res2. This functionality
migrated to iocb->ki_complete().

Provide a wrapper around iocb->ki_complete() to use
aio_complete() or iocb->ki_complete() as appropriate.

Lustre-change: https://review.whamcloud.com/48357
Lustre-commit: c13eccf71ddee4bc8bc8cbee8f927bdba8768735

HPE-bug-id: LUS-11187
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I11d1ee61528d4d89e2a316fd71066824b202dac7
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49834
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/obdclass/cl_io.c

index dfec1f8..30d34b4 100644 (file)
@@ -2661,6 +2661,35 @@ security_dentry_init_security_xattr_name_arg, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
 
+#
+# LC_HAVE_KIOCB_COMPLETE_2ARGS
+#
+# kernel v5.15-rc6-145-g6b19b766e8f0
+# fs: get rid of the res2 iocb->ki_complete argument
+#
+AC_DEFUN([LC_HAVE_KIOCB_COMPLETE_2ARGS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if kiocb->ki_complete() has 2 arguments],
+kiocb_ki_complete_2args, [
+       #include <linux/fs.h>
+
+       static void complete_fn(struct kiocb *iocb, long ret)
+       {
+               (void)iocb;
+               (void)ret;
+       }
+],[
+       struct kiocb *kio = NULL;
+
+       kio->ki_complete = complete_fn;
+],[
+       AC_DEFINE(HAVE_KIOCB_COMPLETE_2ARGS, 1,
+               [kiocb->ki_complete() has 2 arguments])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_HAVE_KIOCB_COMPLETE_2ARGS
+
 AC_DEFUN([LC_PROG_LINUX_SRC], [])
 AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
 
@@ -2863,6 +2892,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 5.16
        LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
 
+       # 5.16
+       LC_HAVE_KIOCB_COMPLETE_2ARGS
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 
index b9e927a..6e16645 100644 (file)
@@ -1195,13 +1195,19 @@ int cl_sync_io_wait(const struct lu_env *env, struct cl_sync_io *anchor,
 }
 EXPORT_SYMBOL(cl_sync_io_wait);
 
-#ifndef HAVE_AIO_COMPLETE
-static inline void aio_complete(struct kiocb *iocb, ssize_t res, ssize_t res2)
+static inline void dio_aio_complete(struct kiocb *iocb, ssize_t res)
 {
+#ifdef HAVE_AIO_COMPLETE
+       aio_complete(iocb, res, 0);
+#else
        if (iocb->ki_complete)
-               iocb->ki_complete(iocb, res, res2);
-}
+# ifdef HAVE_KIOCB_COMPLETE_2ARGS
+               iocb->ki_complete(iocb, res);
+# else
+               iocb->ki_complete(iocb, res, 0);
+# endif
 #endif
+}
 
 static void cl_dio_aio_end(const struct lu_env *env, struct cl_sync_io *anchor)
 {
@@ -1211,7 +1217,7 @@ static void cl_dio_aio_end(const struct lu_env *env, struct cl_sync_io *anchor)
        ENTRY;
 
        if (!aio->cda_no_aio_complete)
-               aio_complete(aio->cda_iocb, ret ?: aio->cda_bytes, 0);
+               dio_aio_complete(aio->cda_iocb, ret ?: aio->cda_bytes);
 
        EXIT;
 }