Merge tag 'f2fs-for-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeu...
[sfrench/cifs-2.6.git] / fs / f2fs / checkpoint.c
index a30024f2a567a9a34c95bd7c3f3506e8aae319fd..dd2e73e10857a33428c6bfd35eba738d4d232e45 100644 (file)
@@ -304,25 +304,22 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
                                long nr_to_write, enum iostat_type io_type)
 {
        struct address_space *mapping = META_MAPPING(sbi);
-       pgoff_t index = 0, end = ULONG_MAX, prev = ULONG_MAX;
+       pgoff_t index = 0, prev = ULONG_MAX;
        struct pagevec pvec;
        long nwritten = 0;
+       int nr_pages;
        struct writeback_control wbc = {
                .for_reclaim = 0,
        };
        struct blk_plug plug;
 
-       pagevec_init(&pvec, 0);
+       pagevec_init(&pvec);
 
        blk_start_plug(&plug);
 
-       while (index <= end) {
-               int i, nr_pages;
-               nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
-                               PAGECACHE_TAG_DIRTY,
-                               min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
-               if (unlikely(nr_pages == 0))
-                       break;
+       while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+                               PAGECACHE_TAG_DIRTY))) {
+               int i;
 
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];