[PATCH] truncate: dirty memory accounting fix
authorAndrew Morton <akpm@osdl.org>
Fri, 22 Dec 2006 09:04:48 +0000 (01:04 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:45 +0000 (08:55 -0800)
Only (un)account for IO and page-dirtying for devices which have real backing
store (ie: not tmpfs or ramdisks).

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/truncate.c

index 89a5c359b6e821ec00e0fd8e8d189f3d9152e45a..4a38dd1a4ce85efffaa8275ccaaf1b42251f0ae9 100644 (file)
@@ -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);
        }