Whamcloud - gitweb
LU-16112 build: ki_complete removed unused argument 84/49784/2
authorShaun Tancheff <shaun.tancheff@hpe.com>
Thu, 26 Jan 2023 06:24:24 +0000 (22:24 -0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Mar 2023 06:44:46 +0000 (06:44 +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/fs/lustre-release/+/49784
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/obdclass/cl_io.c

index dcaddac..5164f34 100644 (file)
@@ -2686,6 +2686,35 @@ get_acl_rcu_argument, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAVE_GET_ACL_RCU_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], [])
 
@@ -2890,6 +2919,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 5.15
        LC_HAVE_GET_ACL_RCU_ARG
 
+       # 5.16
+       LC_HAVE_KIOCB_COMPLETE_2ARGS
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 
index 764205e..295622f 100644 (file)
@@ -1205,13 +1205,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)
 {
@@ -1221,7 +1227,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;
 }