]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/truncate.c
ath9k_htc: Move debug code to a separate file
[karo-tx-linux.git] / mm / truncate.c
index 7c617b5f03ee15df66da56f2cc380c97095fd3d2..a9566752913596152022f5d22983cb4f2cb4d2cf 100644 (file)
@@ -321,11 +321,12 @@ EXPORT_SYMBOL(truncate_inode_pages);
  * pagetables.
  */
 unsigned long invalidate_mapping_pages(struct address_space *mapping,
-                                      pgoff_t start, pgoff_t end)
+               pgoff_t start, pgoff_t end)
 {
        struct pagevec pvec;
        pgoff_t next = start;
-       unsigned long ret = 0;
+       unsigned long ret;
+       unsigned long count = 0;
        int i;
 
        pagevec_init(&pvec, 0);
@@ -352,9 +353,15 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
                        if (lock_failed)
                                continue;
 
-                       ret += invalidate_inode_page(page);
-
+                       ret = invalidate_inode_page(page);
                        unlock_page(page);
+                       /*
+                        * Invalidation is a hint that the page is no longer
+                        * of interest and try to speed up its reclaim.
+                        */
+                       if (!ret)
+                               deactivate_page(page);
+                       count += ret;
                        if (next > end)
                                break;
                }
@@ -362,7 +369,7 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
                mem_cgroup_uncharge_end();
                cond_resched();
        }
-       return ret;
+       return count;
 }
 EXPORT_SYMBOL(invalidate_mapping_pages);
 
@@ -388,7 +395,7 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
 
        clear_page_mlock(page);
        BUG_ON(page_has_private(page));
-       __remove_from_page_cache(page);
+       __delete_from_page_cache(page);
        spin_unlock_irq(&mapping->tree_lock);
        mem_cgroup_uncharge_cache_page(page);