1*eda14cbcSMatt Macy #ifndef _ZFS_PAGE_COMPAT_H 2*eda14cbcSMatt Macy #define _ZFS_PAGE_COMPAT_H 3*eda14cbcSMatt Macy 4*eda14cbcSMatt Macy /* 5*eda14cbcSMatt Macy * We have various enum members moving between two separate enum types, 6*eda14cbcSMatt Macy * and accessed by different functions at various times. Centralise the 7*eda14cbcSMatt Macy * insanity. 8*eda14cbcSMatt Macy * 9*eda14cbcSMatt Macy * < v4.8: all enums in zone_stat_item, via global_page_state() 10*eda14cbcSMatt Macy * v4.8: some enums moved to node_stat_item, global_node_page_state() introduced 11*eda14cbcSMatt Macy * v4.13: some enums moved from zone_stat_item to node_state_item 12*eda14cbcSMatt Macy * v4.14: global_page_state() rename to global_zone_page_state() 13*eda14cbcSMatt Macy * 14*eda14cbcSMatt Macy * The defines used here are created by config/kernel-global_page_state.m4 15*eda14cbcSMatt Macy */ 16*eda14cbcSMatt Macy 17*eda14cbcSMatt Macy /* 18*eda14cbcSMatt Macy * Create our own accessor functions to follow the Linux API changes 19*eda14cbcSMatt Macy */ 20*eda14cbcSMatt Macy #if defined(ZFS_GLOBAL_ZONE_PAGE_STATE) 21*eda14cbcSMatt Macy 22*eda14cbcSMatt Macy /* global_zone_page_state() introduced */ 23*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES) 24*eda14cbcSMatt Macy #define nr_file_pages() global_node_page_state(NR_FILE_PAGES) 25*eda14cbcSMatt Macy #else 26*eda14cbcSMatt Macy #define nr_file_pages() global_zone_page_state(NR_FILE_PAGES) 27*eda14cbcSMatt Macy #endif 28*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON) 29*eda14cbcSMatt Macy #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON) 30*eda14cbcSMatt Macy #else 31*eda14cbcSMatt Macy #define nr_inactive_anon_pages() global_zone_page_state(NR_INACTIVE_ANON) 32*eda14cbcSMatt Macy #endif 33*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE) 34*eda14cbcSMatt Macy #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE) 35*eda14cbcSMatt Macy #else 36*eda14cbcSMatt Macy #define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE) 37*eda14cbcSMatt Macy #endif 38*eda14cbcSMatt Macy 39*eda14cbcSMatt Macy #elif defined(ZFS_GLOBAL_NODE_PAGE_STATE) 40*eda14cbcSMatt Macy 41*eda14cbcSMatt Macy /* global_node_page_state() introduced */ 42*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES) 43*eda14cbcSMatt Macy #define nr_file_pages() global_node_page_state(NR_FILE_PAGES) 44*eda14cbcSMatt Macy #else 45*eda14cbcSMatt Macy #define nr_file_pages() global_page_state(NR_FILE_PAGES) 46*eda14cbcSMatt Macy #endif 47*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON) 48*eda14cbcSMatt Macy #define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON) 49*eda14cbcSMatt Macy #else 50*eda14cbcSMatt Macy #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) 51*eda14cbcSMatt Macy #endif 52*eda14cbcSMatt Macy #if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE) 53*eda14cbcSMatt Macy #define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE) 54*eda14cbcSMatt Macy #else 55*eda14cbcSMatt Macy #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) 56*eda14cbcSMatt Macy #endif 57*eda14cbcSMatt Macy 58*eda14cbcSMatt Macy #else 59*eda14cbcSMatt Macy 60*eda14cbcSMatt Macy /* global_page_state() only */ 61*eda14cbcSMatt Macy #define nr_file_pages() global_page_state(NR_FILE_PAGES) 62*eda14cbcSMatt Macy #define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON) 63*eda14cbcSMatt Macy #define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE) 64*eda14cbcSMatt Macy 65*eda14cbcSMatt Macy #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */ 66*eda14cbcSMatt Macy 67*eda14cbcSMatt Macy #endif /* _ZFS_PAGE_COMPAT_H */ 68