]>
Commit | Line | Data |
---|---|---|
42f7b73b AX |
1 | #ifndef _ZFS_PAGE_COMPAT_H |
2 | #define _ZFS_PAGE_COMPAT_H | |
3 | ||
4 | /* | |
5 | * We have various enum members moving between two separate enum types, | |
6 | * and accessed by different functions at various times. Centralise the | |
7 | * insanity. | |
8 | * | |
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() | |
13 | * | |
14 | * The defines used here are created by config/kernel-global_page_state.m4 | |
15 | */ | |
16 | ||
17 | /* | |
18 | * Create our own accessor functions to follow the Linux API changes | |
19 | */ | |
20 | #if defined(ZFS_GLOBAL_ZONE_PAGE_STATE) | |
21 | ||
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) | |
25 | #else | |
26 | #define nr_file_pages() global_zone_page_state(NR_FILE_PAGES) | |
27 | #endif | |
28 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON) | |
29 | #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON) | |
30 | #else | |
31 | #define nr_inactive_anon_pages() global_zone_page_state(NR_INACTIVE_ANON) | |
32 | #endif | |
33 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE) | |
34 | #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE) | |
35 | #else | |
36 | #define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE) | |
37 | #endif | |
38 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE) | |
39 | #define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE) | |
40 | #else | |
41 | #define nr_slab_reclaimable_pages() global_zone_page_state(NR_SLAB_RECLAIMABLE) | |
42 | #endif | |
43 | ||
44 | #elif defined(ZFS_GLOBAL_NODE_PAGE_STATE) | |
45 | ||
46 | /* global_node_page_state() introduced */ | |
47 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES) | |
48 | #define nr_file_pages() global_node_page_state(NR_FILE_PAGES) | |
49 | #else | |
50 | #define nr_file_pages() global_page_state(NR_FILE_PAGES) | |
51 | #endif | |
52 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON) | |
53 | #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON) | |
54 | #else | |
55 | #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) | |
56 | #endif | |
57 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE) | |
58 | #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE) | |
59 | #else | |
60 | #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) | |
61 | #endif | |
62 | #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE) | |
63 | #define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE) | |
64 | #else | |
65 | #define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE) | |
66 | #endif | |
67 | ||
68 | #else | |
69 | ||
70 | /* global_page_state() only */ | |
71 | #define nr_file_pages() global_page_state(NR_FILE_PAGES) | |
72 | #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) | |
73 | #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) | |
74 | #define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE) | |
75 | ||
76 | #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */ | |
77 | ||
78 | #endif /* _ZFS_PAGE_COMPAT_H */ |