ZTS: Fix send_partial_dataset.ksh
[zfs.git] / config / kernel-percpu.m4
blob5125dd5c5bb8d6a2a68839901f98359fe1cedf3c
1 dnl #
2 dnl # 3.18 API change,
3 dnl # The function percpu_counter_init now must be passed a GFP mask.
4 dnl #
5 AC_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;
13                 error = percpu_counter_init(&counter, 0, GFP_KERNEL);
14         ])
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], [
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         ])
28 dnl #
29 dnl # 4.13 API change,
30 dnl # __percpu_counter_add() was renamed to percpu_counter_add_batch().
31 dnl #
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>
35         ],[
36                 struct percpu_counter counter;
38                 percpu_counter_add_batch(&counter, 1, 1);
39         ])
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], [
45                 AC_MSG_RESULT(yes)
46                 AC_DEFINE(HAVE_PERCPU_COUNTER_ADD_BATCH, 1,
47                     [percpu_counter_add_batch() is defined])
48         ],[
49                 AC_MSG_RESULT(no)
50         ])
53 dnl #
54 dnl # 5.10 API change,
55 dnl # The "count" was moved into ref->data, from ref
56 dnl #
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>
60         ],[
61                 struct percpu_ref_data d;
63                 atomic_long_set(&d.count, 1L);
64         ])
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], [
70                 AC_MSG_RESULT(yes)
71                 AC_DEFINE(ZFS_PERCPU_REF_COUNT_IN_DATA, 1,
72                     [count is located in percpu_ref.data])
73         ],[
74                 AC_MSG_RESULT(no)
75         ])
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