mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
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>
This commit is contained in:
parent
1e01c968db
commit
f066ea230a
2 changed files with 33 additions and 52 deletions
|
@ -22,6 +22,7 @@ extern void frontswap_writethrough(bool);
|
|||
#define FRONTSWAP_HAS_EXCLUSIVE_GETS
|
||||
extern void frontswap_tmem_exclusive_gets(bool);
|
||||
|
||||
extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
|
||||
extern void __frontswap_init(unsigned type);
|
||||
extern int __frontswap_store(struct page *page);
|
||||
extern int __frontswap_load(struct page *page);
|
||||
|
@ -29,26 +30,11 @@ extern void __frontswap_invalidate_page(unsigned, pgoff_t);
|
|||
extern void __frontswap_invalidate_area(unsigned);
|
||||
|
||||
#ifdef CONFIG_FRONTSWAP
|
||||
#define frontswap_enabled (1)
|
||||
|
||||
static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (frontswap_enabled && sis->frontswap_map)
|
||||
ret = test_bit(offset, sis->frontswap_map);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset)
|
||||
{
|
||||
if (frontswap_enabled && sis->frontswap_map)
|
||||
set_bit(offset, sis->frontswap_map);
|
||||
}
|
||||
|
||||
static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset)
|
||||
{
|
||||
if (frontswap_enabled && sis->frontswap_map)
|
||||
clear_bit(offset, sis->frontswap_map);
|
||||
return __frontswap_test(sis, offset);
|
||||
}
|
||||
|
||||
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)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void frontswap_map_set(struct swap_info_struct *p,
|
||||
unsigned long *map)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue