summaryrefslogtreecommitdiff
path: root/include/linux/swap.h
diff options
context:
space:
mode:
authorSeth Jennings <sjenning@linux.vnet.ibm.com>2013-04-29 15:08:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 15:54:38 -0700
commit1eec6702a80e04416d528846a5ff2122484d95ec (patch)
treeead36835b194b3253cef6c4391489fef6a574575 /include/linux/swap.h
parent2f772e6cadf8ad8fca38927b17e6be028be669f5 (diff)
downloadlinux-stable-1eec6702a80e04416d528846a5ff2122484d95ec.tar.gz
linux-stable-1eec6702a80e04416d528846a5ff2122484d95ec.tar.bz2
linux-stable-1eec6702a80e04416d528846a5ff2122484d95ec.zip
mm: allow for outstanding swap writeback accounting
To prevent flooding the swap device with writebacks, frontswap backends need to count and limit the number of outstanding writebacks. The incrementing of the counter can be done before the call to __swap_writepage(). However, the caller must receive a notification when the writeback completes in order to decrement the counter. To achieve this functionality, this patch modifies __swap_writepage() to take the bio completion callback function as an argument. end_swap_bio_write(), the normal bio completion function, is also made non-static so that code doing the accounting can call it after the accounting is done. There should be no behavioural change to existing code. 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>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r--include/linux/swap.h4
1 files changed, 3 insertions, 1 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);