diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 11 | ||||
-rw-r--r-- | mm/truncate.c | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index c641edf553a9..ec6fa2d7e200 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */ | 34 | #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */ |
35 | #include <linux/memcontrol.h> | 35 | #include <linux/memcontrol.h> |
36 | #include <linux/mm_inline.h> /* for page_is_file_cache() */ | 36 | #include <linux/mm_inline.h> /* for page_is_file_cache() */ |
37 | #include <linux/cleancache.h> | ||
37 | #include "internal.h" | 38 | #include "internal.h" |
38 | 39 | ||
39 | /* | 40 | /* |
@@ -118,6 +119,16 @@ void __delete_from_page_cache(struct page *page) | |||
118 | { | 119 | { |
119 | struct address_space *mapping = page->mapping; | 120 | struct address_space *mapping = page->mapping; |
120 | 121 | ||
122 | /* | ||
123 | * if we're uptodate, flush out into the cleancache, otherwise | ||
124 | * invalidate any existing cleancache entries. We can't leave | ||
125 | * stale data around in the cleancache once our page is gone | ||
126 | */ | ||
127 | if (PageUptodate(page) && PageMappedToDisk(page)) | ||
128 | cleancache_put_page(page); | ||
129 | else | ||
130 | cleancache_flush_page(mapping, page); | ||
131 | |||
121 | radix_tree_delete(&mapping->page_tree, page->index); | 132 | radix_tree_delete(&mapping->page_tree, page->index); |
122 | page->mapping = NULL; | 133 | page->mapping = NULL; |
123 | mapping->nrpages--; | 134 | mapping->nrpages--; |
diff --git a/mm/truncate.c b/mm/truncate.c index a95667529135..3a29a6180212 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/task_io_accounting_ops.h> | 19 | #include <linux/task_io_accounting_ops.h> |
20 | #include <linux/buffer_head.h> /* grr. try_to_release_page, | 20 | #include <linux/buffer_head.h> /* grr. try_to_release_page, |
21 | do_invalidatepage */ | 21 | do_invalidatepage */ |
22 | #include <linux/cleancache.h> | ||
22 | #include "internal.h" | 23 | #include "internal.h" |
23 | 24 | ||
24 | 25 | ||
@@ -51,6 +52,7 @@ void do_invalidatepage(struct page *page, unsigned long offset) | |||
51 | static inline void truncate_partial_page(struct page *page, unsigned partial) | 52 | static inline void truncate_partial_page(struct page *page, unsigned partial) |
52 | { | 53 | { |
53 | zero_user_segment(page, partial, PAGE_CACHE_SIZE); | 54 | zero_user_segment(page, partial, PAGE_CACHE_SIZE); |
55 | cleancache_flush_page(page->mapping, page); | ||
54 | if (page_has_private(page)) | 56 | if (page_has_private(page)) |
55 | do_invalidatepage(page, partial); | 57 | do_invalidatepage(page, partial); |
56 | } | 58 | } |
@@ -214,6 +216,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
214 | pgoff_t next; | 216 | pgoff_t next; |
215 | int i; | 217 | int i; |
216 | 218 | ||
219 | cleancache_flush_inode(mapping); | ||
217 | if (mapping->nrpages == 0) | 220 | if (mapping->nrpages == 0) |
218 | return; | 221 | return; |
219 | 222 | ||
@@ -291,6 +294,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
291 | pagevec_release(&pvec); | 294 | pagevec_release(&pvec); |
292 | mem_cgroup_uncharge_end(); | 295 | mem_cgroup_uncharge_end(); |
293 | } | 296 | } |
297 | cleancache_flush_inode(mapping); | ||
294 | } | 298 | } |
295 | EXPORT_SYMBOL(truncate_inode_pages_range); | 299 | EXPORT_SYMBOL(truncate_inode_pages_range); |
296 | 300 | ||
@@ -440,6 +444,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
440 | int did_range_unmap = 0; | 444 | int did_range_unmap = 0; |
441 | int wrapped = 0; | 445 | int wrapped = 0; |
442 | 446 | ||
447 | cleancache_flush_inode(mapping); | ||
443 | pagevec_init(&pvec, 0); | 448 | pagevec_init(&pvec, 0); |
444 | next = start; | 449 | next = start; |
445 | while (next <= end && !wrapped && | 450 | while (next <= end && !wrapped && |
@@ -498,6 +503,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
498 | mem_cgroup_uncharge_end(); | 503 | mem_cgroup_uncharge_end(); |
499 | cond_resched(); | 504 | cond_resched(); |
500 | } | 505 | } |
506 | cleancache_flush_inode(mapping); | ||
501 | return ret; | 507 | return ret; |
502 | } | 508 | } |
503 | EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range); | 509 | EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range); |