Skip to content

Commit

Permalink
Clean up and export cancel_dirty_page() to modules
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds committed Dec 23, 2006
1 parent 18ed1c0 commit 8368e32
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mm/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
WARN_ON(++warncount < 5);
}

if (TestClearPageDirty(page) && account_size &&
mapping_cap_account_dirty(page->mapping)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
task_io_account_cancelled_write(account_size);
if (TestClearPageDirty(page)) {
struct address_space *mapping = page->mapping;
if (mapping && mapping_cap_account_dirty(mapping)) {
dec_zone_page_state(page, NR_FILE_DIRTY);
if (account_size)
task_io_account_cancelled_write(account_size);
}
}
}
EXPORT_SYMBOL(cancel_dirty_page);

/*
* If truncate cannot remove the fs-private metadata from the page, the page
Expand Down

0 comments on commit 8368e32

Please sign in to comment.