From c13eccf71ddee4bc8bc8cbee8f927bdba8768735 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Wed, 30 Nov 2022 06:12:51 -0600 Subject: [PATCH] LU-16112 build: ki_complete removed unused argument 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. HPE-bug-id: LUS-11187 Signed-off-by: Shaun Tancheff Change-Id: I11d1ee61528d4d89e2a316fd71066824b202dac7 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48357 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Petros Koutoupis Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 32 ++++++++++++++++++++++++++++++++ lustre/obdclass/cl_io.c | 16 +++++++++++----- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 355e7af..aa0e174 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2761,6 +2761,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 + + 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], []) @@ -2969,6 +2998,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 diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index bd78143..e7a6fbd 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -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; } -- 1.8.3.1