mm: rcu-protected get_mm_exe_file()
[linux-2.6-block.git] / mm / truncate.c
index ddec5a5966d74a90c1e88b53d260e119b0a5f097..66af9031fae8071c6d7a8c0b7e2a3da2c90684c7 100644 (file)
@@ -92,35 +92,6 @@ void do_invalidatepage(struct page *page, unsigned int offset,
                (*invalidatepage)(page, offset, length);
 }
 
-/*
- * This cancels just the dirty bit on the kernel page itself, it
- * does NOT actually remove dirty bits on any mmap's that may be
- * around. It also leaves the page tagged dirty, so any sync
- * activity will still find it on the dirty lists, and in particular,
- * clear_page_dirty_for_io() will still look at the dirty bits in
- * the VM.
- *
- * Doing this should *normally* only ever be done when a page
- * is truncated, and is not actually mapped anywhere at all. However,
- * fs/buffer.c does this when it notices that somebody has cleaned
- * out all the buffers on a page without actually doing it through
- * the VM. Can you say "ext3 is horribly ugly"? Tought you could.
- */
-void cancel_dirty_page(struct page *page, unsigned int 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);
-                       dec_bdi_stat(inode_to_bdi(mapping->host),
-                                       BDI_RECLAIMABLE);
-                       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
  * becomes orphaned.  It will be left on the LRU and may even be mapped into
@@ -140,7 +111,13 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
        if (page_has_private(page))
                do_invalidatepage(page, 0, PAGE_CACHE_SIZE);
 
-       cancel_dirty_page(page, PAGE_CACHE_SIZE);
+       /*
+        * Some filesystems seem to re-dirty the page even after
+        * the VM has canceled the dirty bit (eg ext3 journaling).
+        * Hence dirty accounting check is placed after invalidation.
+        */
+       if (TestClearPageDirty(page))
+               account_page_cleaned(page, mapping);
 
        ClearPageMappedToDisk(page);
        delete_from_page_cache(page);
@@ -513,7 +490,7 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
                         * of interest and try to speed up its reclaim.
                         */
                        if (!ret)
-                               deactivate_page(page);
+                               deactivate_file_page(page);
                        count += ret;
                }
                pagevec_remove_exceptionals(&pvec);