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 39 #elif defined(ZFS_GLOBAL_NODE_PAGE_STATE) 40 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) 44 #else 45 #define nr_file_pages() global_page_state(NR_FILE_PAGES) 46 #endif 47 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON) 48 #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON) 49 #else 50 #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) 51 #endif 52 #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE) 53 #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE) 54 #else 55 #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) 56 #endif 57 58 #else 59 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) 64 65 #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */ 66 67 #endif /* _ZFS_PAGE_COMPAT_H */ 68