Whamcloud - gitweb
LU-17421 build: Update check for arc_prune_func_t parameters 64/53664/6
authorBrian Atkinson <batkinson@lanl.gov>
Fri, 12 Jan 2024 00:36:59 +0000 (17:36 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 Feb 2024 07:09:28 +0000 (07:09 +0000)
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 <batkinson@lanl.gov>
Change-Id: Iaa03cc9421f27a8517ce04817f04102de9adb86a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53664
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Akash B <akash-b@hpe.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
config/lustre-build-zfs.m4
lustre/osd-zfs/osd_handler.c

index 12d2942..2ac8907 100644 (file)
@@ -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 <sys/nvpair.h>
@@ -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 <sys/arc.h>
+               ], [
+                       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
        ])
 
index 9c24dd4..52c50db 100644 (file)
@@ -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;