aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/vm/frontswap.txt50
-rw-r--r--drivers/staging/ramster/zcache-main.c8
-rw-r--r--drivers/staging/zcache/zcache-main.c10
-rw-r--r--drivers/xen/tmem.c8
-rw-r--r--include/linux/frontswap.h16
-rw-r--r--mm/frontswap.c56
-rw-r--r--mm/page_io.c4
7 files changed, 76 insertions, 76 deletions
diff --git a/Documentation/vm/frontswap.txt b/Documentation/vm/frontswap.txt
index a9f731af0fac..37067cf455f4 100644
--- a/Documentation/vm/frontswap.txt
+++ b/Documentation/vm/frontswap.txt
@@ -21,21 +21,21 @@ frontswap_ops funcs appropriately and the functions it provides must
21conform to certain policies as follows: 21conform to certain policies as follows:
22 22
23An "init" prepares the device to receive frontswap pages associated 23An "init" prepares the device to receive frontswap pages associated
24with the specified swap device number (aka "type"). A "put_page" will 24with the specified swap device number (aka "type"). A "store" will
25copy the page to transcendent memory and associate it with the type and 25copy the page to transcendent memory and associate it with the type and
26offset associated with the page. A "get_page" will copy the page, if found, 26offset associated with the page. A "load" will copy the page, if found,
27from transcendent memory into kernel memory, but will NOT remove the page 27from transcendent memory into kernel memory, but will NOT remove the page
28from from transcendent memory. An "invalidate_page" will remove the page 28from from transcendent memory. An "invalidate_page" will remove the page
29from transcendent memory and an "invalidate_area" will remove ALL pages 29from transcendent memory and an "invalidate_area" will remove ALL pages
30associated with the swap type (e.g., like swapoff) and notify the "device" 30associated with the swap type (e.g., like swapoff) and notify the "device"
31to refuse further puts with that swap type. 31to refuse further stores with that swap type.
32 32
33Once a page is successfully put, a matching get on the page will normally 33Once a page is successfully stored, a matching load on the page will normally
34succeed. So when the kernel finds itself in a situation where it needs 34succeed. So when the kernel finds itself in a situation where it needs
35to swap out a page, it first attempts to use frontswap. If the put returns 35to swap out a page, it first attempts to use frontswap. If the store returns
36success, the data has been successfully saved to transcendent memory and 36success, the data has been successfully saved to transcendent memory and
37a disk write and, if the data is later read back, a disk read are avoided. 37a disk write and, if the data is later read back, a disk read are avoided.
38If a put returns failure, transcendent memory has rejected the data, and the 38If a store returns failure, transcendent memory has rejected the data, and the
39page can be written to swap as usual. 39page can be written to swap as usual.
40 40
41If a backend chooses, frontswap can be configured as a "writethrough 41If a backend chooses, frontswap can be configured as a "writethrough
@@ -44,18 +44,18 @@ in swap device writes is lost (and also a non-trivial performance advantage)
44in order to allow the backend to arbitrarily "reclaim" space used to 44in order to allow the backend to arbitrarily "reclaim" space used to
45store frontswap pages to more completely manage its memory usage. 45store frontswap pages to more completely manage its memory usage.
46 46
47Note that if a page is put and the page already exists in transcendent memory 47Note that if a page is stored and the page already exists in transcendent memory
48(a "duplicate" put), either the put succeeds and the data is overwritten, 48(a "duplicate" store), either the store succeeds and the data is overwritten,
49or the put fails AND the page is invalidated. This ensures stale data may 49or the store fails AND the page is invalidated. This ensures stale data may
50never be obtained from frontswap. 50never be obtained from frontswap.
51 51
52If properly configured, monitoring of frontswap is done via debugfs in 52If properly configured, monitoring of frontswap is done via debugfs in
53the /sys/kernel/debug/frontswap directory. The effectiveness of 53the /sys/kernel/debug/frontswap directory. The effectiveness of
54frontswap can be measured (across all swap devices) with: 54frontswap can be measured (across all swap devices) with:
55 55
56failed_puts - how many put attempts have failed 56failed_stores - how many store attempts have failed
57gets - how many gets were attempted (all should succeed) 57loads - how many loads were attempted (all should succeed)
58succ_puts - how many put attempts have succeeded 58succ_stores - how many store attempts have succeeded
59invalidates - how many invalidates were attempted 59invalidates - how many invalidates were attempted
60 60
61A backend implementation may provide additional metrics. 61A backend implementation may provide additional metrics.
@@ -125,7 +125,7 @@ nothingness and the only overhead is a few extra bytes per swapon'ed
125swap device. If CONFIG_FRONTSWAP is enabled but no frontswap "backend" 125swap device. If CONFIG_FRONTSWAP is enabled but no frontswap "backend"
126registers, there is one extra global variable compared to zero for 126registers, there is one extra global variable compared to zero for
127every swap page read or written. If CONFIG_FRONTSWAP is enabled 127every swap page read or written. If CONFIG_FRONTSWAP is enabled
128AND a frontswap backend registers AND the backend fails every "put" 128AND a frontswap backend registers AND the backend fails every "store"
129request (i.e. provides no memory despite claiming it might), 129request (i.e. provides no memory despite claiming it might),
130CPU overhead is still negligible -- and since every frontswap fail 130CPU overhead is still negligible -- and since every frontswap fail
131precedes a swap page write-to-disk, the system is highly likely 131precedes a swap page write-to-disk, the system is highly likely
@@ -159,13 +159,13 @@ entirely dynamic and random.
159 159
160Whenever a swap-device is swapon'd frontswap_init() is called, 160Whenever a swap-device is swapon'd frontswap_init() is called,
161passing the swap device number (aka "type") as a parameter. 161passing the swap device number (aka "type") as a parameter.
162This notifies frontswap to expect attempts to "put" swap pages 162This notifies frontswap to expect attempts to "store" swap pages
163associated with that number. 163associated with that number.
164 164
165Whenever the swap subsystem is readying a page to write to a swap 165Whenever the swap subsystem is readying a page to write to a swap
166device (c.f swap_writepage()), frontswap_put_page is called. Frontswap 166device (c.f swap_writepage()), frontswap_store is called. Frontswap
167consults with the frontswap backend and if the backend says it does NOT 167consults with the frontswap backend and if the backend says it does NOT
168have room, frontswap_put_page returns -1 and the kernel swaps the page 168have room, frontswap_store returns -1 and the kernel swaps the page
169to the swap device as normal. Note that the response from the frontswap 169to the swap device as normal. Note that the response from the frontswap
170backend is unpredictable to the kernel; it may choose to never accept a 170backend is unpredictable to the kernel; it may choose to never accept a
171page, it could accept every ninth page, or it might accept every 171page, it could accept every ninth page, or it might accept every
@@ -177,7 +177,7 @@ corresponding to the page offset on the swap device to which it would
177otherwise have written the data. 177otherwise have written the data.
178 178
179When the swap subsystem needs to swap-in a page (swap_readpage()), 179When the swap subsystem needs to swap-in a page (swap_readpage()),
180it first calls frontswap_get_page() which checks the frontswap_map to 180it first calls frontswap_load() which checks the frontswap_map to
181see if the page was earlier accepted by the frontswap backend. If 181see if the page was earlier accepted by the frontswap backend. If
182it was, the page of data is filled from the frontswap backend and 182it was, the page of data is filled from the frontswap backend and
183the swap-in is complete. If not, the normal swap-in code is 183the swap-in is complete. If not, the normal swap-in code is
@@ -185,7 +185,7 @@ executed to obtain the page of data from the real swap device.
185 185
186So every time the frontswap backend accepts a page, a swap device read 186So every time the frontswap backend accepts a page, a swap device read
187and (potentially) a swap device write are replaced by a "frontswap backend 187and (potentially) a swap device write are replaced by a "frontswap backend
188put" and (possibly) a "frontswap backend get", which are presumably much 188store" and (possibly) a "frontswap backend loads", which are presumably much
189faster. 189faster.
190 190
1914) Can't frontswap be configured as a "special" swap device that is 1914) Can't frontswap be configured as a "special" swap device that is
@@ -215,8 +215,8 @@ that are inappropriate for a RAM-oriented device including delaying
215the write of some pages for a significant amount of time. Synchrony is 215the write of some pages for a significant amount of time. Synchrony is
216required to ensure the dynamicity of the backend and to avoid thorny race 216required to ensure the dynamicity of the backend and to avoid thorny race
217conditions that would unnecessarily and greatly complicate frontswap 217conditions that would unnecessarily and greatly complicate frontswap
218and/or the block I/O subsystem. That said, only the initial "put" 218and/or the block I/O subsystem. That said, only the initial "store"
219and "get" operations need be synchronous. A separate asynchronous thread 219and "load" operations need be synchronous. A separate asynchronous thread
220is free to manipulate the pages stored by frontswap. For example, 220is free to manipulate the pages stored by frontswap. For example,
221the "remotification" thread in RAMster uses standard asynchronous 221the "remotification" thread in RAMster uses standard asynchronous
222kernel sockets to move compressed frontswap pages to a remote machine. 222kernel sockets to move compressed frontswap pages to a remote machine.
@@ -229,7 +229,7 @@ choose to accept pages only until host-swapping might be imminent,
229then force guests to do their own swapping. 229then force guests to do their own swapping.
230 230
231There is a downside to the transcendent memory specifications for 231There is a downside to the transcendent memory specifications for
232frontswap: Since any "put" might fail, there must always be a real 232frontswap: Since any "store" might fail, there must always be a real
233slot on a real swap device to swap the page. Thus frontswap must be 233slot on a real swap device to swap the page. Thus frontswap must be
234implemented as a "shadow" to every swapon'd device with the potential 234implemented as a "shadow" to every swapon'd device with the potential
235capability of holding every page that the swap device might have held 235capability of holding every page that the swap device might have held
@@ -240,16 +240,16 @@ installation, frontswap is useless. Swapless portable devices
240can still use frontswap but a backend for such devices must configure 240can still use frontswap but a backend for such devices must configure
241some kind of "ghost" swap device and ensure that it is never used. 241some kind of "ghost" swap device and ensure that it is never used.
242 242
2435) Why this weird definition about "duplicate puts"? If a page 2435) Why this weird definition about "duplicate stores"? If a page
244 has been previously successfully put, can't it always be 244 has been previously successfully stored, can't it always be
245 successfully overwritten? 245 successfully overwritten?
246 246
247Nearly always it can, but no, sometimes it cannot. Consider an example 247Nearly always it can, but no, sometimes it cannot. Consider an example
248where data is compressed and the original 4K page has been compressed 248where data is compressed and the original 4K page has been compressed
249to 1K. Now an attempt is made to overwrite the page with data that 249to 1K. Now an attempt is made to overwrite the page with data that
250is non-compressible and so would take the entire 4K. But the backend 250is non-compressible and so would take the entire 4K. But the backend
251has no more space. In this case, the put must be rejected. Whenever 251has no more space. In this case, the store must be rejected. Whenever
252frontswap rejects a put that would overwrite, it also must invalidate 252frontswap rejects a store that would overwrite, it also must invalidate
253the old data and ensure that it is no longer accessible. Since the 253the old data and ensure that it is no longer accessible. Since the
254swap subsystem then writes the new data to the read swap device, 254swap subsystem then writes the new data to the read swap device,
255this is the correct course of action to ensure coherency. 255this is the correct course of action to ensure coherency.
diff --git a/drivers/staging/ramster/zcache-main.c b/drivers/staging/ramster/zcache-main.c
index 68b2e053a0e6..2627b3de0d21 100644
--- a/drivers/staging/ramster/zcache-main.c
+++ b/drivers/staging/ramster/zcache-main.c
@@ -3002,7 +3002,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind)
3002 return oid; 3002 return oid;
3003} 3003}
3004 3004
3005static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, 3005static int zcache_frontswap_store(unsigned type, pgoff_t offset,
3006 struct page *page) 3006 struct page *page)
3007{ 3007{
3008 u64 ind64 = (u64)offset; 3008 u64 ind64 = (u64)offset;
@@ -3025,7 +3025,7 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset,
3025 3025
3026/* returns 0 if the page was successfully gotten from frontswap, -1 if 3026/* returns 0 if the page was successfully gotten from frontswap, -1 if
3027 * was not present (should never happen!) */ 3027 * was not present (should never happen!) */
3028static int zcache_frontswap_get_page(unsigned type, pgoff_t offset, 3028static int zcache_frontswap_load(unsigned type, pgoff_t offset,
3029 struct page *page) 3029 struct page *page)
3030{ 3030{
3031 u64 ind64 = (u64)offset; 3031 u64 ind64 = (u64)offset;
@@ -3080,8 +3080,8 @@ static void zcache_frontswap_init(unsigned ignored)
3080} 3080}
3081 3081
3082static struct frontswap_ops zcache_frontswap_ops = { 3082static struct frontswap_ops zcache_frontswap_ops = {
3083 .put_page = zcache_frontswap_put_page, 3083 .store = zcache_frontswap_store,
3084 .get_page = zcache_frontswap_get_page, 3084 .load = zcache_frontswap_load,
3085 .invalidate_page = zcache_frontswap_flush_page, 3085 .invalidate_page = zcache_frontswap_flush_page,
3086 .invalidate_area = zcache_frontswap_flush_area, 3086 .invalidate_area = zcache_frontswap_flush_area,
3087 .init = zcache_frontswap_init 3087 .init = zcache_frontswap_init
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 2734dacacbaf..784c796b9848 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1835,7 +1835,7 @@ static int zcache_frontswap_poolid = -1;
1835 * Swizzling increases objects per swaptype, increasing tmem concurrency 1835 * Swizzling increases objects per swaptype, increasing tmem concurrency
1836 * for heavy swaploads. Later, larger nr_cpus -> larger SWIZ_BITS 1836 * for heavy swaploads. Later, larger nr_cpus -> larger SWIZ_BITS
1837 * Setting SWIZ_BITS to 27 basically reconstructs the swap entry from 1837 * Setting SWIZ_BITS to 27 basically reconstructs the swap entry from
1838 * frontswap_get_page(), but has side-effects. Hence using 8. 1838 * frontswap_load(), but has side-effects. Hence using 8.
1839 */ 1839 */
1840#define SWIZ_BITS 8 1840#define SWIZ_BITS 8
1841#define SWIZ_MASK ((1 << SWIZ_BITS) - 1) 1841#define SWIZ_MASK ((1 << SWIZ_BITS) - 1)
@@ -1849,7 +1849,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind)
1849 return oid; 1849 return oid;
1850} 1850}
1851 1851
1852static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, 1852static int zcache_frontswap_store(unsigned type, pgoff_t offset,
1853 struct page *page) 1853 struct page *page)
1854{ 1854{
1855 u64 ind64 = (u64)offset; 1855 u64 ind64 = (u64)offset;
@@ -1870,7 +1870,7 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset,
1870 1870
1871/* returns 0 if the page was successfully gotten from frontswap, -1 if 1871/* returns 0 if the page was successfully gotten from frontswap, -1 if
1872 * was not present (should never happen!) */ 1872 * was not present (should never happen!) */
1873static int zcache_frontswap_get_page(unsigned type, pgoff_t offset, 1873static int zcache_frontswap_load(unsigned type, pgoff_t offset,
1874 struct page *page) 1874 struct page *page)
1875{ 1875{
1876 u64 ind64 = (u64)offset; 1876 u64 ind64 = (u64)offset;
@@ -1919,8 +1919,8 @@ static void zcache_frontswap_init(unsigned ignored)
1919} 1919}
1920 1920
1921static struct frontswap_ops zcache_frontswap_ops = { 1921static struct frontswap_ops zcache_frontswap_ops = {
1922 .put_page = zcache_frontswap_put_page, 1922 .store = zcache_frontswap_store,
1923 .get_page = zcache_frontswap_get_page, 1923 .load = zcache_frontswap_load,
1924 .invalidate_page = zcache_frontswap_flush_page, 1924 .invalidate_page = zcache_frontswap_flush_page,
1925 .invalidate_area = zcache_frontswap_flush_area, 1925 .invalidate_area = zcache_frontswap_flush_area,
1926 .init = zcache_frontswap_init 1926 .init = zcache_frontswap_init
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index dcb79521e6c8..89f264c67420 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -269,7 +269,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind)
269} 269}
270 270
271/* returns 0 if the page was successfully put into frontswap, -1 if not */ 271/* returns 0 if the page was successfully put into frontswap, -1 if not */
272static int tmem_frontswap_put_page(unsigned type, pgoff_t offset, 272static int tmem_frontswap_store(unsigned type, pgoff_t offset,
273 struct page *page) 273 struct page *page)
274{ 274{
275 u64 ind64 = (u64)offset; 275 u64 ind64 = (u64)offset;
@@ -295,7 +295,7 @@ static int tmem_frontswap_put_page(unsigned type, pgoff_t offset,
295 * returns 0 if the page was successfully gotten from frontswap, -1 if 295 * returns 0 if the page was successfully gotten from frontswap, -1 if
296 * was not present (should never happen!) 296 * was not present (should never happen!)
297 */ 297 */
298static int tmem_frontswap_get_page(unsigned type, pgoff_t offset, 298static int tmem_frontswap_load(unsigned type, pgoff_t offset,
299 struct page *page) 299 struct page *page)
300{ 300{
301 u64 ind64 = (u64)offset; 301 u64 ind64 = (u64)offset;
@@ -362,8 +362,8 @@ static int __init no_frontswap(char *s)
362__setup("nofrontswap", no_frontswap); 362__setup("nofrontswap", no_frontswap);
363 363
364static struct frontswap_ops __initdata tmem_frontswap_ops = { 364static struct frontswap_ops __initdata tmem_frontswap_ops = {
365 .put_page = tmem_frontswap_put_page, 365 .store = tmem_frontswap_store,
366 .get_page = tmem_frontswap_get_page, 366 .load = tmem_frontswap_load,
367 .invalidate_page = tmem_frontswap_flush_page, 367 .invalidate_page = tmem_frontswap_flush_page,
368 .invalidate_area = tmem_frontswap_flush_area, 368 .invalidate_area = tmem_frontswap_flush_area,
369 .init = tmem_frontswap_init 369 .init = tmem_frontswap_init
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h
index 68ff7af5c5fb..0e4e2eec5c1d 100644
--- a/include/linux/frontswap.h
+++ b/include/linux/frontswap.h
@@ -7,8 +7,8 @@
7 7
8struct frontswap_ops { 8struct frontswap_ops {
9 void (*init)(unsigned); 9 void (*init)(unsigned);
10 int (*put_page)(unsigned, pgoff_t, struct page *); 10 int (*store)(unsigned, pgoff_t, struct page *);
11 int (*get_page)(unsigned, pgoff_t, struct page *); 11 int (*load)(unsigned, pgoff_t, struct page *);
12 void (*invalidate_page)(unsigned, pgoff_t); 12 void (*invalidate_page)(unsigned, pgoff_t);
13 void (*invalidate_area)(unsigned); 13 void (*invalidate_area)(unsigned);
14}; 14};
@@ -21,8 +21,8 @@ extern unsigned long frontswap_curr_pages(void);
21extern void frontswap_writethrough(bool); 21extern void frontswap_writethrough(bool);
22 22
23extern void __frontswap_init(unsigned type); 23extern void __frontswap_init(unsigned type);
24extern int __frontswap_put_page(struct page *page); 24extern int __frontswap_store(struct page *page);
25extern int __frontswap_get_page(struct page *page); 25extern int __frontswap_load(struct page *page);
26extern void __frontswap_invalidate_page(unsigned, pgoff_t); 26extern void __frontswap_invalidate_page(unsigned, pgoff_t);
27extern void __frontswap_invalidate_area(unsigned); 27extern void __frontswap_invalidate_area(unsigned);
28 28
@@ -88,21 +88,21 @@ static inline unsigned long *frontswap_map_get(struct swap_info_struct *p)
88} 88}
89#endif 89#endif
90 90
91static inline int frontswap_put_page(struct page *page) 91static inline int frontswap_store(struct page *page)
92{ 92{
93 int ret = -1; 93 int ret = -1;
94 94
95 if (frontswap_enabled) 95 if (frontswap_enabled)
96 ret = __frontswap_put_page(page); 96 ret = __frontswap_store(page);
97 return ret; 97 return ret;
98} 98}
99 99
100static inline int frontswap_get_page(struct page *page) 100static inline int frontswap_load(struct page *page)
101{ 101{
102 int ret = -1; 102 int ret = -1;
103 103
104 if (frontswap_enabled) 104 if (frontswap_enabled)
105 ret = __frontswap_get_page(page); 105 ret = __frontswap_load(page);
106 return ret; 106 return ret;
107} 107}
108 108
diff --git a/mm/frontswap.c b/mm/frontswap.c
index 8c0a5f8683f0..e25025574a02 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -39,7 +39,7 @@ bool frontswap_enabled __read_mostly;
39EXPORT_SYMBOL(frontswap_enabled); 39EXPORT_SYMBOL(frontswap_enabled);
40 40
41/* 41/*
42 * If enabled, frontswap_put will return failure even on success. As 42 * If enabled, frontswap_store will return failure even on success. As
43 * a result, the swap subsystem will always write the page to swap, in 43 * a result, the swap subsystem will always write the page to swap, in
44 * effect converting frontswap into a writethrough cache. In this mode, 44 * effect converting frontswap into a writethrough cache. In this mode,
45 * there is no direct reduction in swap writes, but a frontswap backend 45 * there is no direct reduction in swap writes, but a frontswap backend
@@ -54,27 +54,27 @@ static bool frontswap_writethrough_enabled __read_mostly;
54 * properly configured). These are for information only so are not protected 54 * properly configured). These are for information only so are not protected
55 * against increment races. 55 * against increment races.
56 */ 56 */
57static u64 frontswap_gets; 57static u64 frontswap_loads;
58static u64 frontswap_succ_puts; 58static u64 frontswap_succ_stores;
59static u64 frontswap_failed_puts; 59static u64 frontswap_failed_stores;
60static u64 frontswap_invalidates; 60static u64 frontswap_invalidates;
61 61
62static inline void inc_frontswap_gets(void) { 62static inline void inc_frontswap_loads(void) {
63 frontswap_gets++; 63 frontswap_loads++;
64} 64}
65static inline void inc_frontswap_succ_puts(void) { 65static inline void inc_frontswap_succ_stores(void) {
66 frontswap_succ_puts++; 66 frontswap_succ_stores++;
67} 67}
68static inline void inc_frontswap_failed_puts(void) { 68static inline void inc_frontswap_failed_stores(void) {
69 frontswap_failed_puts++; 69 frontswap_failed_stores++;
70} 70}
71static inline void inc_frontswap_invalidates(void) { 71static inline void inc_frontswap_invalidates(void) {
72 frontswap_invalidates++; 72 frontswap_invalidates++;
73} 73}
74#else 74#else
75static inline void inc_frontswap_gets(void) { } 75static inline void inc_frontswap_loads(void) { }
76static inline void inc_frontswap_succ_puts(void) { } 76static inline void inc_frontswap_succ_stores(void) { }
77static inline void inc_frontswap_failed_puts(void) { } 77static inline void inc_frontswap_failed_stores(void) { }
78static inline void inc_frontswap_invalidates(void) { } 78static inline void inc_frontswap_invalidates(void) { }
79#endif 79#endif
80/* 80/*
@@ -116,13 +116,13 @@ void __frontswap_init(unsigned type)
116EXPORT_SYMBOL(__frontswap_init); 116EXPORT_SYMBOL(__frontswap_init);
117 117
118/* 118/*
119 * "Put" data from a page to frontswap and associate it with the page's 119 * "Store" data from a page to frontswap and associate it with the page's
120 * swaptype and offset. Page must be locked and in the swap cache. 120 * swaptype and offset. Page must be locked and in the swap cache.
121 * If frontswap already contains a page with matching swaptype and 121 * If frontswap already contains a page with matching swaptype and
122 * offset, the frontswap implmentation may either overwrite the data and 122 * offset, the frontswap implmentation may either overwrite the data and
123 * return success or invalidate the page from frontswap and return failure. 123 * return success or invalidate the page from frontswap and return failure.
124 */ 124 */
125int __frontswap_put_page(struct page *page) 125int __frontswap_store(struct page *page)
126{ 126{
127 int ret = -1, dup = 0; 127 int ret = -1, dup = 0;
128 swp_entry_t entry = { .val = page_private(page), }; 128 swp_entry_t entry = { .val = page_private(page), };
@@ -134,10 +134,10 @@ int __frontswap_put_page(struct page *page)
134 BUG_ON(sis == NULL); 134 BUG_ON(sis == NULL);
135 if (frontswap_test(sis, offset)) 135 if (frontswap_test(sis, offset))
136 dup = 1; 136 dup = 1;
137 ret = (*frontswap_ops.put_page)(type, offset, page); 137 ret = (*frontswap_ops.store)(type, offset, page);
138 if (ret == 0) { 138 if (ret == 0) {
139 frontswap_set(sis, offset); 139 frontswap_set(sis, offset);
140 inc_frontswap_succ_puts(); 140 inc_frontswap_succ_stores();
141 if (!dup) 141 if (!dup)
142 atomic_inc(&sis->frontswap_pages); 142 atomic_inc(&sis->frontswap_pages);
143 } else if (dup) { 143 } else if (dup) {
@@ -147,22 +147,22 @@ int __frontswap_put_page(struct page *page)
147 */ 147 */
148 frontswap_clear(sis, offset); 148 frontswap_clear(sis, offset);
149 atomic_dec(&sis->frontswap_pages); 149 atomic_dec(&sis->frontswap_pages);
150 inc_frontswap_failed_puts(); 150 inc_frontswap_failed_stores();
151 } else 151 } else
152 inc_frontswap_failed_puts(); 152 inc_frontswap_failed_stores();
153 if (frontswap_writethrough_enabled) 153 if (frontswap_writethrough_enabled)
154 /* report failure so swap also writes to swap device */ 154 /* report failure so swap also writes to swap device */
155 ret = -1; 155 ret = -1;
156 return ret; 156 return ret;
157} 157}
158EXPORT_SYMBOL(__frontswap_put_page); 158EXPORT_SYMBOL(__frontswap_store);
159 159
160/* 160/*
161 * "Get" data from frontswap associated with swaptype and offset that were 161 * "Get" data from frontswap associated with swaptype and offset that were
162 * specified when the data was put to frontswap and use it to fill the 162 * specified when the data was put to frontswap and use it to fill the
163 * specified page with data. Page must be locked and in the swap cache. 163 * specified page with data. Page must be locked and in the swap cache.
164 */ 164 */
165int __frontswap_get_page(struct page *page) 165int __frontswap_load(struct page *page)
166{ 166{
167 int ret = -1; 167 int ret = -1;
168 swp_entry_t entry = { .val = page_private(page), }; 168 swp_entry_t entry = { .val = page_private(page), };
@@ -173,12 +173,12 @@ int __frontswap_get_page(struct page *page)
173 BUG_ON(!PageLocked(page)); 173 BUG_ON(!PageLocked(page));
174 BUG_ON(sis == NULL); 174 BUG_ON(sis == NULL);
175 if (frontswap_test(sis, offset)) 175 if (frontswap_test(sis, offset))
176 ret = (*frontswap_ops.get_page)(type, offset, page); 176 ret = (*frontswap_ops.load)(type, offset, page);
177 if (ret == 0) 177 if (ret == 0)
178 inc_frontswap_gets(); 178 inc_frontswap_loads();
179 return ret; 179 return ret;
180} 180}
181EXPORT_SYMBOL(__frontswap_get_page); 181EXPORT_SYMBOL(__frontswap_load);
182 182
183/* 183/*
184 * Invalidate any data from frontswap associated with the specified swaptype 184 * Invalidate any data from frontswap associated with the specified swaptype
@@ -301,10 +301,10 @@ static int __init init_frontswap(void)
301 struct dentry *root = debugfs_create_dir("frontswap", NULL); 301 struct dentry *root = debugfs_create_dir("frontswap", NULL);
302 if (root == NULL) 302 if (root == NULL)
303 return -ENXIO; 303 return -ENXIO;
304 debugfs_create_u64("gets", S_IRUGO, root, &frontswap_gets); 304 debugfs_create_u64("loads", S_IRUGO, root, &frontswap_loads);
305 debugfs_create_u64("succ_puts", S_IRUGO, root, &frontswap_succ_puts); 305 debugfs_create_u64("succ_stores", S_IRUGO, root, &frontswap_succ_stores);
306 debugfs_create_u64("failed_puts", S_IRUGO, root, 306 debugfs_create_u64("failed_stores", S_IRUGO, root,
307 &frontswap_failed_puts); 307 &frontswap_failed_stores);
308 debugfs_create_u64("invalidates", S_IRUGO, 308 debugfs_create_u64("invalidates", S_IRUGO,
309 root, &frontswap_invalidates); 309 root, &frontswap_invalidates);
310#endif 310#endif
diff --git a/mm/page_io.c b/mm/page_io.c
index 651a91259317..34f02923744c 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -99,7 +99,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
99 unlock_page(page); 99 unlock_page(page);
100 goto out; 100 goto out;
101 } 101 }
102 if (frontswap_put_page(page) == 0) { 102 if (frontswap_store(page) == 0) {
103 set_page_writeback(page); 103 set_page_writeback(page);
104 unlock_page(page); 104 unlock_page(page);
105 end_page_writeback(page); 105 end_page_writeback(page);
@@ -129,7 +129,7 @@ int swap_readpage(struct page *page)
129 129
130 VM_BUG_ON(!PageLocked(page)); 130 VM_BUG_ON(!PageLocked(page));
131 VM_BUG_ON(PageUptodate(page)); 131 VM_BUG_ON(PageUptodate(page));
132 if (frontswap_get_page(page) == 0) { 132 if (frontswap_load(page) == 0) {
133 SetPageUptodate(page); 133 SetPageUptodate(page);
134 unlock_page(page); 134 unlock_page(page);
135 goto out; 135 goto out;