f2fs: simplify page iteration loops
[sfrench/cifs-2.6.git] / fs / f2fs / checkpoint.c
index 04fe1df052b2b9e6a0c3f662797c3f46727ccdbe..fb74ec4ed9d256540b1d5d626451adf75dc4cee0 100644 (file)
@@ -305,9 +305,10 @@ 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,
        };
@@ -317,13 +318,9 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
 
        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, PAGEVEC_SIZE))) {
+               int i;
 
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];