diff options
-rw-r--r-- | include/linux/swap.h | 4 | ||||
-rw-r--r-- | mm/page_io.c | 9 |
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) /* linux/mm/page_io.c */ extern int swap_readpage(struct page *); extern int swap_writepage(struct page *page, struct writeback_control *wbc); -extern int __swap_writepage(struct page *page, struct writeback_control *wbc); +extern void end_swap_bio_write(struct bio *bio, int err); +extern int __swap_writepage(struct page *page, struct writeback_control *wbc, + void (*end_write_func)(struct bio *, int)); extern int swap_set_page_dirty(struct page *page); extern void end_swap_bio_read(struct bio *bio, int err); 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, return bio; } -static void end_swap_bio_write(struct bio *bio, int err) +void end_swap_bio_write(struct bio *bio, int err) { const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct page *page = bio->bi_io_vec[0].bv_page; @@ -197,12 +197,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) end_page_writeback(page); goto out; } - ret = __swap_writepage(page, wbc); + ret = __swap_writepage(page, wbc, end_swap_bio_write); out: return ret; } -int __swap_writepage(struct page *page, struct writeback_control *wbc) +int __swap_writepage(struct page *page, struct writeback_control *wbc, + void (*end_write_func)(struct bio *, int)) { struct bio *bio; int ret = 0, rw = WRITE; @@ -234,7 +235,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc) return ret; } - bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); + bio = get_swap_bio(GFP_NOIO, page, end_write_func); if (bio == NULL) { set_page_dirty(page); unlock_page(page); |