diff options
| author | Bob Liu <lliubbo@gmail.com> | 2013-04-30 18:26:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:04:00 -0400 |
| commit | f066ea230a65f939afc354beae62716ab5f0e645 (patch) | |
| tree | 1056e57d4b0c9819c74bd929006cf352994230d2 /include/linux | |
| parent | 1e01c968db3d0aebd48e31db15f24516b03128df (diff) | |
mm: frontswap: cleanup code
After allowing tmem backends to build/run as modules, frontswap_enabled
always true if defined CONFIG_FRONTSWAP. But frontswap_test() depends on
whether backend is registered, mv it into frontswap.c using fronstswap_ops
to make the decision.
frontswap_set/clear are not used outside frontswap, so don't export them.
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Andor Daam <andor.daam@googlemail.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Florian Schmaus <fschmaus@gmail.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Stefan Hengelein <ilendir@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/frontswap.h | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index d4f29875c7cc..6c49e1eba552 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h | |||
| @@ -22,6 +22,7 @@ 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 bool __frontswap_test(struct swap_info_struct *, pgoff_t); | ||
| 25 | extern void __frontswap_init(unsigned type); | 26 | extern void __frontswap_init(unsigned type); |
| 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); |
| @@ -29,26 +30,11 @@ 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 | { |
