aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/swap.h4
-rw-r--r--mm/page_io.c9
2 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 76f6c3b31235..b5b12c71a2af 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -330,7 +330,9 @@ static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
330/* linux/mm/page_io.c */ 330/* linux/mm/page_io.c */
331extern int swap_readpage(struct page *); 331extern int swap_readpage(struct page *);
332extern int swap_writepage(struct page *page, struct writeback_control *wbc); 332extern int swap_writepage(struct page *page, struct writeback_control *wbc);
333extern int __swap_writepage(struct page *page, struct writeback_control *wbc); 333extern void end_swap_bio_write(struct bio *bio, int err);
334extern int __swap_writepage(struct page *page, struct writeback_control *wbc,
335 void (*end_write_func)(struct bio *, int));
334extern int swap_set_page_dirty(struct page *page); 336extern int swap_set_page_dirty(struct page *page);
335extern void end_swap_bio_read(struct bio *bio, int err); 337extern void end_swap_bio_read(struct bio *bio, int err);
336 338
diff --git a/mm/page_io.c b/mm/page_io.c
index 8e6bcf176cfb..8e0e5c0e7cdb 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -42,7 +42,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
42 return bio; 42 return bio;
43} 43}
44 44
45static void end_swap_bio_write(struct bio *bio, int err) 45void end_swap_bio_write(struct bio *bio, int err)
46{ 46{
47 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 47 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
48 struct page *page = bio->bi_io_vec[0].bv_page; 48 struct page *page = bio->bi_io_vec[0].bv_page;
@@ -197,12 +197,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
197 end_page_writeback(page); 197 end_page_writeback(page);
198 goto out; 198 goto out;
199 } 199 }
200 ret = __swap_writepage(page, wbc); 200 ret = __swap_writepage(page, wbc, end_swap_bio_write);
201out: 201out:
202 return ret; 202 return ret;
203} 203}
204 204
205int __swap_writepage(struct page *page, struct writeback_control *wbc) 205int __swap_writepage(struct page *page, struct writeback_control *wbc,
206 void (*end_write_func)(struct bio *, int))
206{ 207{
207 struct bio *bio; 208 struct bio *bio;
208 int ret = 0, rw = WRITE; 209 int ret = 0, rw = WRITE;
@@ -234,7 +235,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc)
234 return ret; 235 return ret;
235 } 236 }
236 237
237 bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); 238 bio = get_swap_bio(GFP_NOIO, page, end_write_func);
238 if (bio == NULL) { 239 if (bio == NULL) {
239 set_page_dirty(page); 240 set_page_dirty(page);
240 unlock_page(page); 241 unlock_page(page);