Skip to content

Commit

Permalink
frontswap: simplify frontswap_init
Browse files Browse the repository at this point in the history
Just use IS_ENABLED() and remove the __frontswap_init indirection.

Also remove the unused export.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>
Cc: Dan Streetman <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Seth Jennings <[email protected]>
Cc: Vitaly Wool <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and torvalds committed Jan 22, 2022
1 parent 3e8e1af commit 1cf53c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 1 addition & 8 deletions include/linux/frontswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct frontswap_ops {
extern void frontswap_register_ops(struct frontswap_ops *ops);

extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
extern void __frontswap_init(unsigned type, unsigned long *map);
extern void frontswap_init(unsigned type, unsigned long *map);
extern int __frontswap_store(struct page *page);
extern int __frontswap_load(struct page *page);
extern void __frontswap_invalidate_page(unsigned, pgoff_t);
Expand Down Expand Up @@ -107,11 +107,4 @@ static inline void frontswap_invalidate_area(unsigned type)
__frontswap_invalidate_area(type);
}

static inline void frontswap_init(unsigned type, unsigned long *map)
{
#ifdef CONFIG_FRONTSWAP
__frontswap_init(type, map);
#endif
}

#endif /* _LINUX_FRONTSWAP_H */
3 changes: 1 addition & 2 deletions mm/frontswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ EXPORT_SYMBOL(frontswap_register_ops);
/*
* Called when a swap device is swapon'd.
*/
void __frontswap_init(unsigned type, unsigned long *map)
void frontswap_init(unsigned type, unsigned long *map)
{
struct swap_info_struct *sis = swap_info[type];
struct frontswap_ops *ops;
Expand All @@ -179,7 +179,6 @@ void __frontswap_init(unsigned type, unsigned long *map)
for_each_frontswap_ops(ops)
ops->init(type);
}
EXPORT_SYMBOL(__frontswap_init);

bool __frontswap_test(struct swap_info_struct *sis,
pgoff_t offset)
Expand Down
3 changes: 2 additions & 1 deletion mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,8 @@ static void enable_swap_info(struct swap_info_struct *p, int prio,
struct swap_cluster_info *cluster_info,
unsigned long *frontswap_map)
{
frontswap_init(p->type, frontswap_map);
if (IS_ENABLED(CONFIG_FRONTSWAP))
frontswap_init(p->type, frontswap_map);
spin_lock(&swap_lock);
spin_lock(&p->lock);
setup_swap_info(p, prio, swap_map, cluster_info);
Expand Down

0 comments on commit 1cf53c8

Please sign in to comment.