Skip to content

Commit 1cf53c8

Browse files
Christoph Hellwigtorvalds
authored andcommitted
frontswap: simplify frontswap_init
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]>
1 parent 3e8e1af commit 1cf53c8

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

include/linux/frontswap.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct frontswap_ops {
2626
extern void frontswap_register_ops(struct frontswap_ops *ops);
2727

2828
extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
29-
extern void __frontswap_init(unsigned type, unsigned long *map);
29+
extern void frontswap_init(unsigned type, unsigned long *map);
3030
extern int __frontswap_store(struct page *page);
3131
extern int __frontswap_load(struct page *page);
3232
extern void __frontswap_invalidate_page(unsigned, pgoff_t);
@@ -107,11 +107,4 @@ static inline void frontswap_invalidate_area(unsigned type)
107107
__frontswap_invalidate_area(type);
108108
}
109109

110-
static inline void frontswap_init(unsigned type, unsigned long *map)
111-
{
112-
#ifdef CONFIG_FRONTSWAP
113-
__frontswap_init(type, map);
114-
#endif
115-
}
116-
117110
#endif /* _LINUX_FRONTSWAP_H */

mm/frontswap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(frontswap_register_ops);
156156
/*
157157
* Called when a swap device is swapon'd.
158158
*/
159-
void __frontswap_init(unsigned type, unsigned long *map)
159+
void frontswap_init(unsigned type, unsigned long *map)
160160
{
161161
struct swap_info_struct *sis = swap_info[type];
162162
struct frontswap_ops *ops;
@@ -179,7 +179,6 @@ void __frontswap_init(unsigned type, unsigned long *map)
179179
for_each_frontswap_ops(ops)
180180
ops->init(type);
181181
}
182-
EXPORT_SYMBOL(__frontswap_init);
183182

184183
bool __frontswap_test(struct swap_info_struct *sis,
185184
pgoff_t offset)

mm/swapfile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,8 @@ static void enable_swap_info(struct swap_info_struct *p, int prio,
24632463
struct swap_cluster_info *cluster_info,
24642464
unsigned long *frontswap_map)
24652465
{
2466-
frontswap_init(p->type, frontswap_map);
2466+
if (IS_ENABLED(CONFIG_FRONTSWAP))
2467+
frontswap_init(p->type, frontswap_map);
24672468
spin_lock(&swap_lock);
24682469
spin_lock(&p->lock);
24692470
setup_swap_info(p, prio, swap_map, cluster_info);

0 commit comments

Comments
 (0)