ZIL: Assert record sizes in different places
[zfs.git] / config / kernel-global_page_state.m4
blob76f2bba202a11218c378bd2021e1d25a98f3dc15
1 dnl #
2 dnl # 4.8 API change
3 dnl #
4 dnl # 75ef71840539 mm, vmstat: add infrastructure for per-node vmstats
5 dnl # 599d0c954f91 mm, vmscan: move LRU lists to node
6 dnl #
7 AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE], [
8         ZFS_LINUX_TEST_SRC([global_node_page_state], [
9                 #include <linux/mm.h>
10                 #include <linux/vmstat.h>
11         ],[
12                 (void) global_node_page_state(0);
13         ])
16 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
17         AC_MSG_CHECKING([whether global_node_page_state() exists])
18         ZFS_LINUX_TEST_RESULT([global_node_page_state], [
19                 AC_MSG_RESULT(yes)
20                 AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1,
21                     [global_node_page_state() exists])
22         ],[
23                 AC_MSG_RESULT(no)
24         ])
27 dnl #
28 dnl # 4.14 API change
29 dnl #
30 dnl # c41f012ade0b mm: rename global_page_state to global_zone_page_state
31 dnl #
32 AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE], [
33         ZFS_LINUX_TEST_SRC([global_zone_page_state], [
34                 #include <linux/mm.h>
35                 #include <linux/vmstat.h>
36         ],[
37                 (void) global_zone_page_state(0);
38         ])
41 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
42         AC_MSG_CHECKING([whether global_zone_page_state() exists])
43         ZFS_LINUX_TEST_RESULT([global_zone_page_state], [
44                 AC_MSG_RESULT(yes)
45                 AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1,
46                     [global_zone_page_state() exists])
47         ],[
48                 AC_MSG_RESULT(no)
49         ])
52 dnl #
53 dnl # Create a define and autoconf variable for an enum member
54 dnl #
55 AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
56         AC_MSG_CHECKING([whether enum $2 contains $1])
57         AS_IF([AC_TRY_COMMAND(
58             "${srcdir}/scripts/enum-extract.pl" "$2" "$3" | grep -Eqx $1)],[
59                 AC_MSG_RESULT([yes])
60                 AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
61                     [enum $2 contains $1])
62                 m4_join([_], [ZFS_ENUM], m4_toupper($2), $1)=1
63         ],[
64                 AC_MSG_RESULT([no])
65         ])
68 dnl #
69 dnl # Sanity check helpers
70 dnl #
71 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
72         AC_MSG_RESULT(no)
73         AC_MSG_RESULT([$1 in either node_stat_item or zone_stat_item: $2])
74         ZFS_LINUX_TEST_ERROR([global page state])
77 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
78         enum_check_a="m4_join([_], [$ZFS_ENUM_NODE_STAT_ITEM], $1)"
79         enum_check_b="m4_join([_], [$ZFS_ENUM_ZONE_STAT_ITEM], $1)"
80         AS_IF([test -n "$enum_check_a" -a -n "$enum_check_b"],[
81                 ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [DUPLICATE])
82         ])
83         AS_IF([test -z "$enum_check_a" -a -z "$enum_check_b"],[
84                 ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [NOT FOUND])
85         ])
88 dnl #
89 dnl # Ensure the config tests are finding one and only one of each enum.
90 dnl #
91 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
92         AC_MSG_CHECKING([whether global_page_state enums are sane])
94         ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
95         ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
96         ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE])
98         AC_MSG_RESULT(yes)
101 AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE], [
102         ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE
103         ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE
106 dnl #
107 dnl # enum members in which we're interested
108 dnl #
109 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
110         ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE
111         ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE
113         ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
114             [node_stat_item], [$LINUX/include/linux/mmzone.h])
115         ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
116             [node_stat_item], [$LINUX/include/linux/mmzone.h])
117         ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
118             [node_stat_item], [$LINUX/include/linux/mmzone.h])
120         ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
121             [zone_stat_item], [$LINUX/include/linux/mmzone.h])
122         ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
123             [zone_stat_item], [$LINUX/include/linux/mmzone.h])
124         ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
125             [zone_stat_item], [$LINUX/include/linux/mmzone.h])
127         ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY