From 3ae5a79d0eab91c1fb7019732febc45d4993cc0e Mon Sep 17 00:00:00 2001 From: Brian Atkinson Date: Thu, 11 Jan 2024 17:36:59 -0700 Subject: [PATCH] LU-17421 build: Update check for arc_prune_func_t parameters In OpenZFS 2.2.1 the code for arc_prune_async() was unified so that FreeBSD and Linux did not have their own implementation versions of the same code. Part of this update changed first parameter for the arc_prune_func_t to be an uint64_t. Without this patch, Lustre would not build with ZFS 2.2.1 because of a failure for incompatible pointer types for the arc_prunte_func_t function pointer passed to arc_add_prune_callback(). Lustre-change: https://review.whamcloud.com/53664 Lustre-commit: 303cfe3372349974ff7cd610ad878b618ce4ee29 Test-Parameters: trivial Signed-off-by: Brian Atkinson Signed-off-by: Eric Carbonneau Change-Id: Iaa03cc9421f27a8517ce04817f04102de9adb86a Reviewed-by: Alex Zhuravlev Reviewed-by: Akash B Reviewed-by: Shaun Tancheff Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54819 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- config/lustre-build-zfs.m4 | 21 ++++++++++++++++++--- lustre/osd-zfs/osd_handler.c | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/config/lustre-build-zfs.m4 b/config/lustre-build-zfs.m4 index e054ded..455aa10 100644 --- a/config/lustre-build-zfs.m4 +++ b/config/lustre-build-zfs.m4 @@ -782,11 +782,11 @@ your distribution. AC_DEFINE(HAVE_ZFS_REFCOUNT_HEADER, 1, [Have zfs_refcount.h]) ]) - dnl # - dnl # ZFS 2.2 nvpair now returns and expects constant args - dnl # old_EXTRA_KCFLAGS=$EXTRA_KCFLAGS EXTRA_KCFLAGS+=" -Werror" + dnl # + dnl # ZFS 2.2.0 nvpair now returns and expects constant args + dnl # LB_CHECK_COMPILE([if ZFS nvlist interfaces require const], zfs_nvpair_const, [ #include @@ -800,6 +800,21 @@ your distribution. AC_DEFINE(HAVE_ZFS_NVLIST_CONST_INTERFACES, 1, [ZFS nvlist interfaces require const]) ]) + dnl # + dnl # ZFS 2.2.1 arc_prune_func_t now uses uint64_t for the + dnl # first parameter + dnl # + LB_CHECK_COMPILE([if ZFS arc_prune_func_t uses uint64_t], + zfs_arc_prune_func_uint64, [ + #include + ], [ + void arc_prune_func(uint64_t bytes, void *priv) {} + arc_prune_t *arc_p __attribute__ ((unused)) = + arc_add_prune_callback(arc_prune_func, NULL); + ], [ + AC_DEFINE(HAVE_ZFS_ARC_PRUNE_FUNC_UINT64, 1, + [ZFS arc_prune_func_t uses uint64_t]) + ]) EXTRA_KCFLAGS=$old_EXTRA_KCFLAGS ]) diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index f4f3ea8..192ce83 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -89,7 +89,11 @@ static struct lu_kmem_descr osd_caches[] = { } }; +#ifdef HAVE_ZFS_ARC_PRUNE_FUNC_UINT64 +static void arc_prune_func(uint64_t bytes, void *private) +#else static void arc_prune_func(int64_t bytes, void *private) +#endif { struct osd_device *od = private; struct lu_site *site = &od->od_site; -- 1.8.3.1