1 #ifndef _ZFS_PAGE_COMPAT_H
2 #define _ZFS_PAGE_COMPAT_H
5 * We have various enum members moving between two separate enum types,
6 * and accessed by different functions at various times. Centralise the
9 * < v4.8: all enums in zone_stat_item, via global_page_state()
10 * v4.8: some enums moved to node_stat_item, global_node_page_state() introduced
11 * v4.13: some enums moved from zone_stat_item to node_state_item
12 * v4.14: global_page_state() rename to global_zone_page_state()
14 * The defines used here are created by config/kernel-global_page_state.m4
18 * Create our own accessor functions to follow the Linux API changes
20 #if defined(ZFS_GLOBAL_ZONE_PAGE_STATE)
22 /* global_zone_page_state() introduced */
23 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES)
24 #define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
26 #define nr_file_pages() global_zone_page_state(NR_FILE_PAGES)
28 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON)
29 #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
31 #define nr_inactive_anon_pages() global_zone_page_state(NR_INACTIVE_ANON)
33 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE)
34 #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
36 #define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE)
39 #elif defined(ZFS_GLOBAL_NODE_PAGE_STATE)
41 /* global_node_page_state() introduced */
42 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES)
43 #define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
45 #define nr_file_pages() global_page_state(NR_FILE_PAGES)
47 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON)
48 #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
50 #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON)
52 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE)
53 #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
55 #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE)
60 /* global_page_state() only */
61 #define nr_file_pages() global_page_state(NR_FILE_PAGES)
62 #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON)
63 #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE)
65 #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */
67 #endif /* _ZFS_PAGE_COMPAT_H */