aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-05-15 11:32:15 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-05-15 11:34:08 -0400
commit165c8aed5bbc6bdddbccae0ba9db451732558ff9 (patch)
treea039053eb4bc7cd05096e307368b50426b412659 /mm
parent839a1f79ed0ce026e6d1106f202eaaae929b4200 (diff)
frontswap: s/put_page/store/g s/get_page/load
Sounds so much more natural. Suggested-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/frontswap.c56
-rw-r--r--mm/page_io.c4
2 files changed, 30 insertions, 30 deletions
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;