Merge branch 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
[linux-2.6-microblaze.git] / mm / fadvise.c
index 0e66f2a..d6baa4f 100644 (file)
@@ -141,7 +141,7 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
                }
 
                if (end_index >= start_index) {
-                       unsigned long count;
+                       unsigned long nr_pagevec = 0;
 
                        /*
                         * It's common to FADV_DONTNEED right after
@@ -154,8 +154,9 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
                         */
                        lru_add_drain();
 
-                       count = invalidate_mapping_pages(mapping,
-                                               start_index, end_index);
+                       invalidate_mapping_pagevec(mapping,
+                                               start_index, end_index,
+                                               &nr_pagevec);
 
                        /*
                         * If fewer pages were invalidated than expected then
@@ -163,7 +164,7 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
                         * a per-cpu pagevec for a remote CPU. Drain all
                         * pagevecs and try again.
                         */
-                       if (count < (end_index - start_index + 1)) {
+                       if (nr_pagevec) {
                                lru_add_drain_all();
                                invalidate_mapping_pages(mapping, start_index,
                                                end_index);