mm: break up swap_writepage() for frontswap backends
swap_writepage() is currently where frontswap hooks into the swap write path to capture pages with the frontswap_store() function. However, if a frontswap backend wants to "resume" the writeback of a page to the swap device, it can't call swap_writepage() as the page will simply reenter the backend. This patch separates swap_writepage() into a top and bottom half, the bottom half named __swap_writepage() to allow a frontswap backend, like zswap, to resume writeback beyond the frontswap_store() hook. __add_to_swap_cache() is also made non-static so that the page for which writeback is to be resumed can be added to the swap cache. Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Signed-off-by: Bob Liu <bob.liu@oracle.com> Acked-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Dan Magenheimer <dan.magenheimer@oracle.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e8420a8ece
commit
2f772e6cad
3 changed files with 14 additions and 4 deletions
|
@ -330,6 +330,7 @@ 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 int swap_set_page_dirty(struct page *page);
|
||||
extern void end_swap_bio_read(struct bio *bio, int err);
|
||||
|
||||
|
@ -345,6 +346,7 @@ extern unsigned long total_swapcache_pages(void);
|
|||
extern void show_swap_cache_info(void);
|
||||
extern int add_to_swap(struct page *);
|
||||
extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
|
||||
extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);
|
||||
extern void __delete_from_swap_cache(struct page *);
|
||||
extern void delete_from_swap_cache(struct page *);
|
||||
extern void free_page_and_swap_cache(struct page *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue