3 dnl # The function percpu_counter_init now must be passed a GFP mask.
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_INIT], [
6 ZFS_LINUX_TEST_SRC([percpu_counter_init_with_gfp], [
8 #include <linux/percpu_counter.h>
10 struct percpu_counter counter;
13 error = percpu_counter_init(&counter, 0, GFP_KERNEL);
17 AC_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], [
21 AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_WITH_GFP, 1,
22 [percpu_counter_init() wants gfp_t])
29 dnl # 4.13 API change,
30 dnl # __percpu_counter_add() was renamed to percpu_counter_add_batch().
32 AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_ADD_BATCH], [
33 ZFS_LINUX_TEST_SRC([percpu_counter_add_batch], [
34 #include <linux/percpu_counter.h>
36 struct percpu_counter counter;
38 percpu_counter_add_batch(&counter, 1, 1);
42 AC_DEFUN([ZFS_AC_KERNEL_PERCPU_COUNTER_ADD_BATCH], [
43 AC_MSG_CHECKING([whether percpu_counter_add_batch() is defined])
44 ZFS_LINUX_TEST_RESULT([percpu_counter_add_batch], [
46 AC_DEFINE(HAVE_PERCPU_COUNTER_ADD_BATCH, 1,
47 [percpu_counter_add_batch() is defined])
54 dnl # 5.10 API change,
55 dnl # The "count" was moved into ref->data, from ref
57 AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_REF_COUNT_IN_DATA], [
58 ZFS_LINUX_TEST_SRC([percpu_ref_count_in_data], [
59 #include <linux/percpu-refcount.h>
61 struct percpu_ref_data d;
63 atomic_long_set(&d.count, 1L);
67 AC_DEFUN([ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA], [
68 AC_MSG_CHECKING([whether is inside percpu_ref.data])
69 ZFS_LINUX_TEST_RESULT([percpu_ref_count_in_data], [
71 AC_DEFINE(ZFS_PERCPU_REF_COUNT_IN_DATA, 1,
72 [count is located in percpu_ref.data])
77 AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU], [
78 ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_INIT
79 ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_ADD_BATCH
80 ZFS_AC_KERNEL_SRC_PERCPU_REF_COUNT_IN_DATA
83 AC_DEFUN([ZFS_AC_KERNEL_PERCPU], [
84 ZFS_AC_KERNEL_PERCPU_COUNTER_INIT
85 ZFS_AC_KERNEL_PERCPU_COUNTER_ADD_BATCH
86 ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA