f2fs: use pagevec_lookup_range_tag()
authorJan Kara <jack@suse.cz>
Thu, 16 Nov 2017 01:34:48 +0000 (17:34 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Nov 2017 02:21:03 +0000 (18:21 -0800)
We want only pages from given range in f2fs_write_cache_pages().  Use
pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove
unnecessary code.

Link: http://lkml.kernel.org/r/20171009151359.31984-6-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/f2fs/data.c

index 36b535207c88906efae946f71195781497be87f5..17d2c2997ddda9c3d0cda16131f501445b2cb05f 100644 (file)
@@ -1669,8 +1669,8 @@ retry:
        while (!done && (index <= end)) {
                int i;
 
        while (!done && (index <= end)) {
                int i;
 
-               nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
-                             min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1);
+               nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
+                               tag, PAGEVEC_SIZE);
                if (nr_pages == 0)
                        break;
 
                if (nr_pages == 0)
                        break;
 
@@ -1678,11 +1678,6 @@ retry:
                        struct page *page = pvec.pages[i];
                        bool submitted = false;
 
                        struct page *page = pvec.pages[i];
                        bool submitted = false;
 
-                       if (page->index > end) {
-                               done = 1;
-                               break;
-                       }
-
                        done_index = page->index;
 retry_write:
                        lock_page(page);
                        done_index = page->index;
 retry_write:
                        lock_page(page);