aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2013-04-30 18:26:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 20:04:00 -0400
commit4f89849da22db9d0edb378acea65e23fcd546173 (patch)
tree8af95a340c8d8605ad8f492ef0f6f98f2a4e4523 /include
parentf066ea230a65f939afc354beae62716ab5f0e645 (diff)
frontswap: get rid of swap_lock dependency
Frontswap initialization routine depends on swap_lock, which want to be atomic about frontswap's first appearance. IOW, frontswap is not present and will fail all calls OR frontswap is fully functional but if new swap_info_struct isn't registered by enable_swap_info, swap subsystem doesn't start I/O so there is no race between init procedure and page I/O working on frontswap. So let's remove unnecessary swap_lock dependency. Cc: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Minchan Kim <minchan@kernel.org> [v1: Rebased on my branch, reworked to work with backends loading late] [v2: Added a check for !map] [v3: Made the invalidate path follow the init path] [v4: Address comments by Wanpeng Li <liwanp@linux.vnet.ibm.com>] Signed-off-by: Konrad Rzeszutek Wilk <konrad@darnok.org> Signed-off-by: Bob Liu <lliubbo@gmail.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Andor Daam <andor.daam@googlemail.com> Cc: Florian Schmaus <fschmaus@gmail.com> 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')
-rw-r--r--include/linux/frontswap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h
index 6c49e1eba552..8293262401de 100644
--- a/include/linux/frontswap.h
+++ b/include/linux/frontswap.h
@@ -23,7 +23,7 @@ extern void frontswap_writethrough(bool);
23extern void frontswap_tmem_exclusive_gets(bool); 23extern void frontswap_tmem_exclusive_gets(bool);
24 24
25extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); 25extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
26extern void __frontswap_init(unsigned type); 26extern void __frontswap_init(unsigned type, unsigned long *map);
27extern int __frontswap_store(struct page *page); 27extern int __frontswap_store(struct page *page);
28extern int __frontswap_load(struct page *page); 28extern int __frontswap_load(struct page *page);
29extern void __frontswap_invalidate_page(unsigned, pgoff_t); 29extern void __frontswap_invalidate_page(unsigned, pgoff_t);
@@ -98,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type)
98 __frontswap_invalidate_area(type); 98 __frontswap_invalidate_area(type);
99} 99}
100 100
101static inline void frontswap_init(unsigned type) 101static inline void frontswap_init(unsigned type, unsigned long *map)
102{ 102{
103 if (frontswap_enabled) 103 if (frontswap_enabled)
104 __frontswap_init(type); 104 __frontswap_init(type, map);
105} 105}
106 106
107#endif /* _LINUX_FRONTSWAP_H */ 107#endif /* _LINUX_FRONTSWAP_H */