diff options
-rw-r--r-- | drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h | 4 | ||||
-rw-r--r-- | fs/buffer.c | 4 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | mm/page-writeback.c | 27 | ||||
-rw-r--r-- | mm/truncate.c | 4 |
5 files changed, 25 insertions, 15 deletions
diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h index d72605864b0a..14562788e4e0 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h | |||
@@ -55,9 +55,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page) | |||
55 | if (PagePrivate(page)) | 55 | if (PagePrivate(page)) |
56 | page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); | 56 | page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); |
57 | 57 | ||
58 | if (TestClearPageDirty(page)) | 58 | cancel_dirty_page(page); |
59 | account_page_cleaned(page, mapping); | ||
60 | |||
61 | ClearPageMappedToDisk(page); | 59 | ClearPageMappedToDisk(page); |
62 | ll_delete_from_page_cache(page); | 60 | ll_delete_from_page_cache(page); |
63 | } | 61 | } |
diff --git a/fs/buffer.c b/fs/buffer.c index f96173ad62d9..f21327d1f673 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -3232,8 +3232,8 @@ int try_to_free_buffers(struct page *page) | |||
3232 | * to synchronise against __set_page_dirty_buffers and prevent the | 3232 | * to synchronise against __set_page_dirty_buffers and prevent the |
3233 | * dirty bit from being lost. | 3233 | * dirty bit from being lost. |
3234 | */ | 3234 | */ |
3235 | if (ret && TestClearPageDirty(page)) | 3235 | if (ret) |
3236 | account_page_cleaned(page, mapping); | 3236 | cancel_dirty_page(page); |
3237 | spin_unlock(&mapping->private_lock); | 3237 | spin_unlock(&mapping->private_lock); |
3238 | out: | 3238 | out: |
3239 | if (buffers_to_free) { | 3239 | if (buffers_to_free) { |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 0755b9fd03a7..a83cf3a6f78e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1215,6 +1215,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping); | |||
1215 | void account_page_cleaned(struct page *page, struct address_space *mapping); | 1215 | void account_page_cleaned(struct page *page, struct address_space *mapping); |
1216 | int set_page_dirty(struct page *page); | 1216 | int set_page_dirty(struct page *page); |
1217 | int set_page_dirty_lock(struct page *page); | 1217 | int set_page_dirty_lock(struct page *page); |
1218 | void cancel_dirty_page(struct page *page); | ||
1218 | int clear_page_dirty_for_io(struct page *page); | 1219 | int clear_page_dirty_for_io(struct page *page); |
1219 | 1220 | ||
1220 | int get_cmdline(struct task_struct *task, char *buffer, int buflen); | 1221 | int get_cmdline(struct task_struct *task, char *buffer, int buflen); |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 5daf5568b9e1..227b867598e1 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -2112,12 +2112,6 @@ EXPORT_SYMBOL(account_page_dirtied); | |||
2112 | 2112 | ||
2113 | /* | 2113 | /* |
2114 | * Helper function for deaccounting dirty page without writeback. | 2114 | * Helper function for deaccounting dirty page without writeback. |
2115 | * | ||
2116 | * Doing this should *normally* only ever be done when a page | ||
2117 | * is truncated, and is not actually mapped anywhere at all. However, | ||
2118 | * fs/buffer.c does this when it notices that somebody has cleaned | ||
2119 | * out all the buffers on a page without actually doing it through | ||
2120 | * the VM. Can you say "ext3 is horribly ugly"? Thought you could. | ||
2121 | */ | 2115 | */ |
2122 | void account_page_cleaned(struct page *page, struct address_space *mapping) | 2116 | void account_page_cleaned(struct page *page, struct address_space *mapping) |
2123 | { | 2117 | { |
@@ -2127,7 +2121,6 @@ void account_page_cleaned(struct page *page, struct address_space *mapping) | |||
2127 | task_io_account_cancelled_write(PAGE_CACHE_SIZE); | 2121 | task_io_account_cancelled_write(PAGE_CACHE_SIZE); |
2128 | } | 2122 | } |
2129 | } | 2123 | } |
2130 | EXPORT_SYMBOL(account_page_cleaned); | ||
2131 | 2124 | ||
2132 | /* | 2125 | /* |
2133 | * For address_spaces which do not use buffers. Just tag the page as dirty in | 2126 | * For address_spaces which do not use buffers. Just tag the page as dirty in |
@@ -2266,6 +2259,26 @@ int set_page_dirty_lock(struct page *page) | |||
2266 | EXPORT_SYMBOL(set_page_dirty_lock); | 2259 | EXPORT_SYMBOL(set_page_dirty_lock); |
2267 | 2260 | ||
2268 | /* | 2261 | /* |
2262 | * This cancels just the dirty bit on the kernel page itself, it does NOT | ||
2263 | * actually remove dirty bits on any mmap's that may be around. It also | ||
2264 | * leaves the page tagged dirty, so any sync activity will still find it on | ||
2265 | * the dirty lists, and in particular, clear_page_dirty_for_io() will still | ||
2266 | * look at the dirty bits in the VM. | ||
2267 | * | ||
2268 | * Doing this should *normally* only ever be done when a page is truncated, | ||
2269 | * and is not actually mapped anywhere at all. However, fs/buffer.c does | ||
2270 | * this when it notices that somebody has cleaned out all the buffers on a | ||
2271 | * page without actually doing it through the VM. Can you say "ext3 is | ||
2272 | * horribly ugly"? Thought you could. | ||
2273 | */ | ||
2274 | void cancel_dirty_page(struct page *page) | ||
2275 | { | ||
2276 | if (TestClearPageDirty(page)) | ||
2277 | account_page_cleaned(page, page_mapping(page)); | ||
2278 | } | ||
2279 | EXPORT_SYMBOL(cancel_dirty_page); | ||
2280 | |||
2281 | /* | ||
2269 | * Clear a page's dirty flag, while caring for dirty memory accounting. | 2282 | * Clear a page's dirty flag, while caring for dirty memory accounting. |
2270 | * Returns true if the page was previously dirty. | 2283 | * Returns true if the page was previously dirty. |
2271 | * | 2284 | * |
diff --git a/mm/truncate.c b/mm/truncate.c index 66af9031fae8..0c360259c085 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -116,9 +116,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page) | |||
116 | * the VM has canceled the dirty bit (eg ext3 journaling). | 116 | * the VM has canceled the dirty bit (eg ext3 journaling). |
117 | * Hence dirty accounting check is placed after invalidation. | 117 | * Hence dirty accounting check is placed after invalidation. |
118 | */ | 118 | */ |
119 | if (TestClearPageDirty(page)) | 119 | cancel_dirty_page(page); |
120 | account_page_cleaned(page, mapping); | ||
121 | |||
122 | ClearPageMappedToDisk(page); | 120 | ClearPageMappedToDisk(page); |
123 | delete_from_page_cache(page); | 121 | delete_from_page_cache(page); |
124 | return 0; | 122 | return 0; |