tmpfs: convert shmem_truncate_range to radix-swap
[linux-2.6.git] / mm / filemap.c
index 867d402..76bfb64 100644 (file)
@@ -714,9 +714,12 @@ repeat:
                page = radix_tree_deref_slot(pagep);
                if (unlikely(!page))
                        goto out;
-               if (radix_tree_deref_retry(page))
+               if (radix_tree_exception(page)) {
+                       if (radix_tree_exceptional_entry(page))
+                               goto out;
+                       /* radix_tree_deref_retry(page) */
                        goto repeat;
-
+               }
                if (!page_cache_get_speculative(page))
                        goto repeat;
 
@@ -753,7 +756,7 @@ struct page *find_lock_page(struct address_space *mapping, pgoff_t offset)
 
 repeat:
        page = find_get_page(mapping, offset);
-       if (page) {
+       if (page && !radix_tree_exception(page)) {
                lock_page(page);
                /* Has the page been truncated? */
                if (unlikely(page->mapping != mapping)) {
@@ -840,7 +843,7 @@ unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
        rcu_read_lock();
 restart:
        nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
-                               (void ***)pages, start, nr_pages);
+                               (void ***)pages, NULL, start, nr_pages);
        ret = 0;
        for (i = 0; i < nr_found; i++) {
                struct page *page;
@@ -849,11 +852,14 @@ repeat:
                if (unlikely(!page))
                        continue;
 
-               /*
-                * This can only trigger when the entry at index 0 moves out
-                * of or back to the root: none yet gotten, safe to restart.
-                */
-               if (radix_tree_deref_retry(page)) {
+               if (radix_tree_exception(page)) {
+                       if (radix_tree_exceptional_entry(page))
+                               continue;
+                       /*
+                        * radix_tree_deref_retry(page):
+                        * can only trigger when entry at index 0 moves out of
+                        * or back to root: none yet gotten, safe to restart.
+                        */
                        WARN_ON(start | i);
                        goto restart;
                }
@@ -903,7 +909,7 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
        rcu_read_lock();
 restart:
        nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
-                               (void ***)pages, index, nr_pages);
+                               (void ***)pages, NULL, index, nr_pages);
        ret = 0;
        for (i = 0; i < nr_found; i++) {
                struct page *page;
@@ -912,12 +918,16 @@ repeat:
                if (unlikely(!page))
                        continue;
 
-               /*
-                * This can only trigger when the entry at index 0 moves out
-                * of or back to the root: none yet gotten, safe to restart.
-                */
-               if (radix_tree_deref_retry(page))
+               if (radix_tree_exception(page)) {
+                       if (radix_tree_exceptional_entry(page))
+                               break;
+                       /*
+                        * radix_tree_deref_retry(page):
+                        * can only trigger when entry at index 0 moves out of
+                        * or back to root: none yet gotten, safe to restart.
+                        */
                        goto restart;
+               }
 
                if (!page_cache_get_speculative(page))
                        goto repeat;
@@ -977,12 +987,15 @@ repeat:
                if (unlikely(!page))
                        continue;
 
-               /*
-                * This can only trigger when the entry at index 0 moves out
-                * of or back to the root: none yet gotten, safe to restart.
-                */
-               if (radix_tree_deref_retry(page))
+               if (radix_tree_exception(page)) {
+                       BUG_ON(radix_tree_exceptional_entry(page));
+                       /*
+                        * radix_tree_deref_retry(page):
+                        * can only trigger when entry at index 0 moves out of
+                        * or back to root: none yet gotten, safe to restart.
+                        */
                        goto restart;
+               }
 
                if (!page_cache_get_speculative(page))
                        goto repeat;