From: Jian Yu Date: Wed, 13 Oct 2021 07:12:03 +0000 (-0700) Subject: LU-14195 obdclass: change list_sort to use const pointers X-Git-Tag: 2.14.56~129 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e612dcbbdd208ff0919a8c108448bbfa846e8ee6 LU-14195 obdclass: change list_sort to use const pointers Kernel 5.10.70 commit 4f0f586bf0c898233d8f316f471a21db2abd522d defines the list_cmp_func_t type and changes the comparison function types of all list_sort() callers to use const pointers to avoid type mismatches. Change-Id: I40d37ec0f0d485d0deebaa9dc3493f2865f76ec9 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/45219 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 07c4de9..64ade1b 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1684,6 +1684,26 @@ LB_CHECK_LINUX_HEADER([crypto/sha2.h], [ [crypto/sha2.h is present])]) ]) # LIBCFS_HAVE_CRYPTO_SHA2_HEADER +# +# LIBCFS_HAVE_LIST_CMP_FUNC_T +# +# kernel 5.10.70 commit 4f0f586bf0c898233d8f316f471a21db2abd522d +# treewide: Change list_sort to use const pointers +AC_DEFUN([LIBCFS_HAVE_LIST_CMP_FUNC_T], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror -Wno-unused-variable" +LB_CHECK_COMPILE([if list_cmp_func_t type is defined], +list_cmp_func_t, [ + #include +],[ + list_cmp_func_t cmp; +],[ + AC_DEFINE(HAVE_LIST_CMP_FUNC_T, 1, + [list_cmp_func_t type is defined]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LIBCFS_HAVE_LIST_CMP_FUNC_T + AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [ LIBCFS_SRC_HAVE_PROC_OPS @@ -1825,6 +1845,7 @@ LIBCFS_SEC_RELEASE_SECCTX # 5.10 LIBCFS_HAVE_KFREE_SENSITIVE LIBCFS_HAVE_CRYPTO_SHA2_HEADER +LIBCFS_HAVE_LIST_CMP_FUNC_T ]) # LIBCFS_PROG_LINUX # diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index caf4701..dc2be4a 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -221,8 +221,14 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io, } EXPORT_SYMBOL(cl_io_rw_init); +#ifdef HAVE_LIST_CMP_FUNC_T +static int cl_lock_descr_cmp(void *priv, + const struct list_head *a, + const struct list_head *b) +#else /* !HAVE_LIST_CMP_FUNC_T */ static int cl_lock_descr_cmp(void *priv, struct list_head *a, struct list_head *b) +#endif /* HAVE_LIST_CMP_FUNC_T */ { const struct cl_io_lock_link *l0 = list_entry(a, struct cl_io_lock_link, cill_linkage);