Skip to content

Commit

Permalink
f2fs: use find_get_pages_tag() for looking up single page
Browse files Browse the repository at this point in the history
__get_first_dirty_index() wants to lookup only the first dirty page
after given index.  There's no point in using pagevec_lookup_tag() for
that.  Just use find_get_pages_tag() directly.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Cc: Jaegeuk Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jankara authored and torvalds committed Nov 16, 2017
1 parent 028a63a commit 8faab64
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,19 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
static pgoff_t __get_first_dirty_index(struct address_space *mapping,
pgoff_t pgofs, int whence)
{
struct pagevec pvec;
struct page *page;
int nr_pages;

if (whence != SEEK_DATA)
return 0;

/* find first dirty page index */
pagevec_init(&pvec, 0);
nr_pages = pagevec_lookup_tag(&pvec, mapping, &pgofs,
PAGECACHE_TAG_DIRTY, 1);
pgofs = nr_pages ? pvec.pages[0]->index : ULONG_MAX;
pagevec_release(&pvec);
nr_pages = find_get_pages_tag(mapping, &pgofs, PAGECACHE_TAG_DIRTY,
1, &page);
if (!nr_pages)
return ULONG_MAX;
pgofs = page->index;
put_page(page);
return pgofs;
}

Expand Down

0 comments on commit 8faab64

Please sign in to comment.