summaryrefslogtreecommitdiff
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2011-01-31 16:27:49 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2011-01-31 16:27:49 +1100
commitc1649b726419416c31771b5b816d74270da45c2b (patch)
tree29fd7295ce803b7d24bee89fbd35542257c5976f /mm/filemap.c
parent0c22e887a03a8bacf2c1d1914256979139e4684f (diff)
parent5231e92e133d6db6681a4485b1794a01469ca9ad (diff)
Merge remote branch 'cleancache/linux-next'
Conflicts: fs/ocfs2/super.c fs/super.c include/linux/fs.h mm/Kconfig
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 83a45d35468b..1f5a66f194be 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -34,6 +34,7 @@
#include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
#include <linux/memcontrol.h>
#include <linux/mm_inline.h> /* for page_is_file_cache() */
+#include <linux/cleancache.h>
#include "internal.h"
/*
@@ -116,6 +117,16 @@ void __remove_from_page_cache(struct page *page)
{
struct address_space *mapping = page->mapping;
+ /*
+ * if we're uptodate, flush out into the cleancache, otherwise
+ * invalidate any existing cleancache entries. We can't leave
+ * stale data around in the cleancache once our page is gone
+ */
+ if (PageUptodate(page))
+ cleancache_put_page(page);
+ else
+ cleancache_flush_page(mapping, page);
+
radix_tree_delete(&mapping->page_tree, page->index);
page->mapping = NULL;
mapping->nrpages--;