]> err.no Git - linux-2.6/blobdiff - mm/truncate.c
Clean up and export cancel_dirty_page() to modules
[linux-2.6] / mm / truncate.c
index 89a5c359b6e821ec00e0fd8e8d189f3d9152e45a..ecdfdcc50522976b88d307e0123f15ca771b2c5e 100644 (file)
@@ -60,11 +60,16 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
                WARN_ON(++warncount < 5);
        }
                
-       if (TestClearPageDirty(page) && account_size) {
-               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