diff options
Diffstat (limited to 'include/linux/frontswap.h')
-rw-r--r-- | include/linux/frontswap.h | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index 30442547b9e6..8293262401de 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h | |||
@@ -14,7 +14,7 @@ struct frontswap_ops { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | extern bool frontswap_enabled; | 16 | extern bool frontswap_enabled; |
17 | extern struct frontswap_ops | 17 | extern struct frontswap_ops * |
18 | frontswap_register_ops(struct frontswap_ops *ops); | 18 | frontswap_register_ops(struct frontswap_ops *ops); |
19 | extern void frontswap_shrink(unsigned long); | 19 | extern void frontswap_shrink(unsigned long); |
20 | extern unsigned long frontswap_curr_pages(void); | 20 | extern unsigned long frontswap_curr_pages(void); |
@@ -22,33 +22,19 @@ extern void frontswap_writethrough(bool); | |||
22 | #define FRONTSWAP_HAS_EXCLUSIVE_GETS | 22 | #define FRONTSWAP_HAS_EXCLUSIVE_GETS |
23 | extern void frontswap_tmem_exclusive_gets(bool); | 23 | extern void frontswap_tmem_exclusive_gets(bool); |
24 | 24 | ||
25 | extern void __frontswap_init(unsigned type); | 25 | extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); |
26 | extern void __frontswap_init(unsigned type, unsigned long *map); | ||
26 | extern int __frontswap_store(struct page *page); | 27 | extern int __frontswap_store(struct page *page); |
27 | extern int __frontswap_load(struct page *page); | 28 | extern int __frontswap_load(struct page *page); |
28 | extern void __frontswap_invalidate_page(unsigned, pgoff_t); | 29 | extern void __frontswap_invalidate_page(unsigned, pgoff_t); |
29 | extern void __frontswap_invalidate_area(unsigned); | 30 | extern void __frontswap_invalidate_area(unsigned); |
30 | 31 | ||
31 | #ifdef CONFIG_FRONTSWAP | 32 | #ifdef CONFIG_FRONTSWAP |
33 | #define frontswap_enabled (1) | ||
32 | 34 | ||
33 | static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) | 35 | static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) |
34 | { | 36 | { |
35 | bool ret = false; | 37 | return __frontswap_test(sis, offset); |
36 | |||
37 | if (frontswap_enabled && sis->frontswap_map) | ||
38 | ret = test_bit(offset, sis->frontswap_map); | ||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) | ||
43 | { | ||
44 | if (frontswap_enabled && sis->frontswap_map) | ||
45 | set_bit(offset, sis->frontswap_map); | ||
46 | } | ||
47 | |||
48 | static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) | ||
49 | { | ||
50 | if (frontswap_enabled && sis->frontswap_map) | ||
51 | clear_bit(offset, sis->frontswap_map); | ||
52 | } | 38 | } |
53 | 39 | ||
54 | static inline void frontswap_map_set(struct swap_info_struct *p, | 40 | static inline void frontswap_map_set(struct swap_info_struct *p, |
@@ -71,14 +57,6 @@ static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) | |||
71 | return false; | 57 | return false; |
72 | } | 58 | } |
73 | 59 | ||
74 | static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | static inline void frontswap_map_set(struct swap_info_struct *p, | 60 | static inline void frontswap_map_set(struct swap_info_struct *p, |
83 | unsigned long *map) | 61 | unsigned long *map) |
84 | { | 62 | { |
@@ -120,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type) | |||
120 | __frontswap_invalidate_area(type); | 98 | __frontswap_invalidate_area(type); |
121 | } | 99 | } |
122 | 100 | ||
123 | static inline void frontswap_init(unsigned type) | 101 | static inline void frontswap_init(unsigned type, unsigned long *map) |
124 | { | 102 | { |
125 | if (frontswap_enabled) | 103 | if (frontswap_enabled) |
126 | __frontswap_init(type); | 104 | __frontswap_init(type, map); |
127 | } | 105 | } |
128 | 106 | ||
129 | #endif /* _LINUX_FRONTSWAP_H */ | 107 | #endif /* _LINUX_FRONTSWAP_H */ |