diff options
| -rw-r--r-- | include/linux/swap.h | 2 | ||||
| -rw-r--r-- | mm/page_io.c | 14 | ||||
| -rw-r--r-- | mm/swap_state.c | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 2818a123f3ea..76f6c3b31235 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -330,6 +330,7 @@ static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | |||
| 330 | /* linux/mm/page_io.c */ | 330 | /* linux/mm/page_io.c */ |
| 331 | extern int swap_readpage(struct page *); | 331 | extern int swap_readpage(struct page *); |
| 332 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); | 332 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); |
| 333 | extern int __swap_writepage(struct page *page, struct writeback_control *wbc); | ||
| 333 | extern int swap_set_page_dirty(struct page *page); | 334 | extern int swap_set_page_dirty(struct page *page); |
| 334 | extern void end_swap_bio_read(struct bio *bio, int err); | 335 | extern void end_swap_bio_read(struct bio *bio, int err); |
| 335 | 336 | ||
| @@ -345,6 +346,7 @@ extern unsigned long total_swapcache_pages(void); | |||
| 345 | extern void show_swap_cache_info(void); | 346 | extern void show_swap_cache_info(void); |
| 346 | extern int add_to_swap(struct page *); | 347 | extern int add_to_swap(struct page *); |
| 347 | extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); | 348 | extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); |
| 349 | extern int __add_to_swap_cache(struct page *page, swp_entry_t entry); | ||
| 348 | extern void __delete_from_swap_cache(struct page *); | 350 | extern void __delete_from_swap_cache(struct page *); |
| 349 | extern void delete_from_swap_cache(struct page *); | 351 | extern void delete_from_swap_cache(struct page *); |
| 350 | extern void free_page_and_swap_cache(struct page *); | 352 | extern void free_page_and_swap_cache(struct page *); |
diff --git a/mm/page_io.c b/mm/page_io.c index 78eee32ee486..8e6bcf176cfb 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
| @@ -185,9 +185,7 @@ bad_bmap: | |||
| 185 | */ | 185 | */ |
| 186 | int swap_writepage(struct page *page, struct writeback_control *wbc) | 186 | int swap_writepage(struct page *page, struct writeback_control *wbc) |
| 187 | { | 187 | { |
| 188 | struct bio *bio; | 188 | int ret = 0; |
| 189 | int ret = 0, rw = WRITE; | ||
| 190 | struct swap_info_struct *sis = page_swap_info(page); | ||
| 191 | 189 | ||
| 192 | if (try_to_free_swap(page)) { | 190 | if (try_to_free_swap(page)) { |
| 193 | unlock_page(page); | 191 | unlock_page(page); |
| @@ -199,6 +197,16 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) | |||
| 199 | end_page_writeback(page); | 197 | end_page_writeback(page); |
| 200 | goto out; | 198 | goto out; |
| 201 | } | 199 | } |
| 200 | ret = __swap_writepage(page, wbc); | ||
| 201 | out: | ||
| 202 | return ret; | ||
| 203 | } | ||
| 204 | |||
| 205 | int __swap_writepage(struct page *page, struct writeback_control *wbc) | ||
| 206 | { | ||
| 207 | struct bio *bio; | ||
| 208 | int ret = 0, rw = WRITE; | ||
| 209 | struct swap_info_struct *sis = page_swap_info(page); | ||
| 202 | 210 | ||
| 203 | if (sis->flags & SWP_FILE) { | 211 | if (sis->flags & SWP_FILE) { |
| 204 | struct kiocb kiocb; | 212 | struct kiocb kiocb; |
diff --git a/mm/swap_state.c b/mm/swap_state.c index 7efcf1525921..fe43fd5578cf 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
| @@ -78,7 +78,7 @@ void show_swap_cache_info(void) | |||
| 78 | * __add_to_swap_cache resembles add_to_page_cache_locked on swapper_space, | 78 | * __add_to_swap_cache resembles add_to_page_cache_locked on swapper_space, |
| 79 | * but sets SwapCache flag and private instead of mapping and index. | 79 | * but sets SwapCache flag and private instead of mapping and index. |
| 80 | */ | 80 | */ |
| 81 | static int __add_to_swap_cache(struct page *page, swp_entry_t entry) | 81 | int __add_to_swap_cache(struct page *page, swp_entry_t entry) |
| 82 | { | 82 | { |
| 83 | int error; | 83 | int error; |
| 84 | struct address_space *address_space; | 84 | struct address_space *address_space; |
