]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-percpu.m4
Linux 5.11 compat: bdev_whole()
[FreeBSD/FreeBSD.git] / config / kernel-percpu.m4
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;
12
13                 error = percpu_counter_init(&counter, 0, GFP_KERNEL);
14         ])
15 ])
16
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         ])
26 ])
27
28 dnl #
29 dnl # 5.10 API change,
30 dnl # The "count" was moved into ref->data, from ref
31 dnl #
32 AC_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
42 AC_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 ])
52 AC_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
57 AC_DEFUN([ZFS_AC_KERNEL_PERCPU], [
58         ZFS_AC_KERNEL_PERCPU_COUNTER_INIT
59         ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA
60 ])