aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-23 12:25:04 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-23 12:25:04 -0500
commit8368e328dfe1c534957051333a87b3210a12743b (patch)
treeeaf180335e684a62c44e9aad42cbe2d07de045f3
parent18ed1c051317ac3a685120cead2adb192b802347 (diff)
Clean up and export cancel_dirty_page() to modules
Make cancel_dirty_page() act more like all the other dirty and writeback accounting functions: test for "mapping" being NULL, and do the NR_FILE_DIRY accounting purely based on mapping_cap_account_dirty()). Also, add it to the exports, so that modular filesystems can use it. Acked-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/truncate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index 4a38dd1a4ce8..ecdfdcc50522 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -60,12 +60,16 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
60 WARN_ON(++warncount < 5); 60 WARN_ON(++warncount < 5);
61 } 61 }
62 62
63 if (TestClearPageDirty(page) && account_size && 63 if (TestClearPageDirty(page)) {
64 mapping_cap_account_dirty(page->mapping)) { 64 struct address_space *mapping = page->mapping;
65 dec_zone_page_state(page, NR_FILE_DIRTY); 65 if (mapping && mapping_cap_account_dirty(mapping)) {
66 task_io_account_cancelled_write(account_size); 66 dec_zone_page_state(page, NR_FILE_DIRTY);
67 if (account_size)
68 task_io_account_cancelled_write(account_size);
69 }
67 } 70 }
68} 71}
72EXPORT_SYMBOL(cancel_dirty_page);
69 73
70/* 74/*
71 * If truncate cannot remove the fs-private metadata from the page, the page 75 * If truncate cannot remove the fs-private metadata from the page, the page