From: Brian Atkinson Date: Fri, 12 Jan 2024 00:36:59 +0000 (-0700) Subject: LU-17421 build: Update check for arc_prune_func_t parameters X-Git-Tag: 2.15.61~18 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=303cfe3372349974ff7cd610ad878b618ce4ee29;p=fs%2Flustre-release.git 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(). Test-Parameters: trivial Signed-off-by: Brian Atkinson Change-Id: Iaa03cc9421f27a8517ce04817f04102de9adb86a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53664 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Alex Zhuravlev Reviewed-by: Akash B Reviewed-by: Shaun Tancheff --- diff --git a/config/lustre-build-zfs.m4 b/config/lustre-build-zfs.m4 index 12d2942..2ac8907 100644 --- a/config/lustre-build-zfs.m4 +++ b/config/lustre-build-zfs.m4 @@ -818,11 +818,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 @@ -836,6 +836,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 9c24dd4..52c50db 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;