From: Andrew Morton Date: Fri, 22 Dec 2006 09:04:48 +0000 (-0800) Subject: [PATCH] truncate: dirty memory accounting fix X-Git-Tag: v2.6.20-rc2~64 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2a105d5e33a038a717995d2738434f9c25aed2;p=linux-2.6 [PATCH] truncate: dirty memory accounting fix Only (un)account for IO and page-dirtying for devices which have real backing store (ie: not tmpfs or ramdisks). Cc: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/truncate.c b/mm/truncate.c index 89a5c359b6..4a38dd1a4c 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -60,7 +60,8 @@ void cancel_dirty_page(struct page *page, unsigned int account_size) WARN_ON(++warncount < 5); } - if (TestClearPageDirty(page) && account_size) { + 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); }