xref: /freebsd/sys/contrib/openzfs/config/kernel-percpu.m4 (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1dnl #
2dnl # 3.18 API change,
3dnl # The function percpu_counter_init now must be passed a GFP mask.
4dnl #
5AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_INIT], [
6	ZFS_LINUX_TEST_SRC([percpu_counter_init_with_gfp], [
7		#include <linux/gfp.h>
8		#include <linux/percpu_counter.h>
9	],[
10		struct percpu_counter counter;
11		int error;
12
13		error = percpu_counter_init(&counter, 0, GFP_KERNEL);
14	])
15])
16
17AC_DEFUN([ZFS_AC_KERNEL_PERCPU_COUNTER_INIT], [
18	AC_MSG_CHECKING([whether percpu_counter_init() wants gfp_t])
19	ZFS_LINUX_TEST_RESULT([percpu_counter_init_with_gfp], [
20		AC_MSG_RESULT(yes)
21		AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_WITH_GFP, 1,
22		    [percpu_counter_init() wants gfp_t])
23	],[
24		AC_MSG_RESULT(no)
25	])
26])
27
28dnl #
29dnl # 5.10 API change,
30dnl # The "count" was moved into ref->data, from ref
31dnl #
32AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_REF_COUNT_IN_DATA], [
33	ZFS_LINUX_TEST_SRC([percpu_ref_count_in_data], [
34		#include <linux/percpu-refcount.h>
35	],[
36		struct percpu_ref_data d;
37
38		atomic_long_set(&d.count, 1L);
39	])
40])
41
42AC_DEFUN([ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA], [
43	AC_MSG_CHECKING([whether is inside percpu_ref.data])
44	ZFS_LINUX_TEST_RESULT([percpu_ref_count_in_data], [
45		AC_MSG_RESULT(yes)
46		AC_DEFINE(ZFS_PERCPU_REF_COUNT_IN_DATA, 1,
47		    [count is located in percpu_ref.data])
48	],[
49		AC_MSG_RESULT(no)
50	])
51])
52AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU], [
53	ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_INIT
54	ZFS_AC_KERNEL_SRC_PERCPU_REF_COUNT_IN_DATA
55])
56
57AC_DEFUN([ZFS_AC_KERNEL_PERCPU], [
58	ZFS_AC_KERNEL_PERCPU_COUNTER_INIT
59	ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA
60])
61