]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/truncate.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
[karo-tx-linux.git] / mm / truncate.c
index dc459014f777291c2d95c6fe6e30898758b27b4f..b40ac6d4e86e7ea7d1df670e709452948a1dcb74 100644 (file)
@@ -269,7 +269,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
                        index = start;
                        continue;
                }
-               if (pvec.pages[0]->index > end) {
+               if (index == start && pvec.pages[0]->index > end) {
                        pagevec_release(&pvec);
                        break;
                }
@@ -336,6 +336,14 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
        unsigned long count = 0;
        int i;
 
+       /*
+        * Note: this function may get called on a shmem/tmpfs mapping:
+        * pagevec_lookup() might then return 0 prematurely (because it
+        * got a gangful of swap entries); but it's hardly worth worrying
+        * about - it can rarely have anything to free from such a mapping
+        * (most pages are dirty), and already skips over any difficulties.
+        */
+
        pagevec_init(&pvec, 0);
        while (index <= end && pagevec_lookup(&pvec, mapping, index,
                        min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {