diff options
Diffstat (limited to 'mm/truncate.c')
-rw-r--r-- | mm/truncate.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index 6c79ca4a1ca7..3262740aa059 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -51,15 +51,22 @@ static inline void truncate_partial_page(struct page *page, unsigned partial) | |||
51 | do_invalidatepage(page, partial); | 51 | do_invalidatepage(page, partial); |
52 | } | 52 | } |
53 | 53 | ||
54 | /* | ||
55 | * This cancels just the dirty bit on the kernel page itself, it | ||
56 | * does NOT actually remove dirty bits on any mmap's that may be | ||
57 | * around. It also leaves the page tagged dirty, so any sync | ||
58 | * activity will still find it on the dirty lists, and in particular, | ||
59 | * clear_page_dirty_for_io() will still look at the dirty bits in | ||
60 | * the VM. | ||
61 | * | ||
62 | * Doing this should *normally* only ever be done when a page | ||
63 | * is truncated, and is not actually mapped anywhere at all. However, | ||
64 | * fs/buffer.c does this when it notices that somebody has cleaned | ||
65 | * out all the buffers on a page without actually doing it through | ||
66 | * the VM. Can you say "ext3 is horribly ugly"? Tought you could. | ||
67 | */ | ||
54 | void cancel_dirty_page(struct page *page, unsigned int account_size) | 68 | void cancel_dirty_page(struct page *page, unsigned int account_size) |
55 | { | 69 | { |
56 | /* If we're cancelling the page, it had better not be mapped any more */ | ||
57 | if (page_mapped(page)) { | ||
58 | static unsigned int warncount; | ||
59 | |||
60 | WARN_ON(++warncount < 5); | ||
61 | } | ||
62 | |||
63 | if (TestClearPageDirty(page)) { | 70 | if (TestClearPageDirty(page)) { |
64 | struct address_space *mapping = page->mapping; | 71 | struct address_space *mapping = page->mapping; |
65 | if (mapping && mapping_cap_account_dirty(mapping)) { | 72 | if (mapping && mapping_cap_account_dirty(mapping)) { |