Skip to content

Commit

Permalink
f2fs: detect synchronous writeback more earlier
Browse files Browse the repository at this point in the history
This patch changes to detect synchronous writeback more earlier before,
in order to avoid unnecessary page writeback before exiting asynchronous
writeback.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: khusika <khusikadhamar@gmail.com>
  • Loading branch information
chaseyu authored and khusika committed Aug 9, 2018
1 parent 37e5199 commit 891f36d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,13 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
struct page *page = pvec.pages[i];
bool submitted = false;

/* give a priority to WB_SYNC threads */
if (atomic_read(&F2FS_M_SB(mapping)->wb_sync_req) &&
wbc->sync_mode == WB_SYNC_NONE) {
done = 1;
break;
}

done_index = page->index;
retry_write:
lock_page(page);
Expand Down Expand Up @@ -2017,9 +2024,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
last_idx = page->index;
}

/* give a priority to WB_SYNC threads */
if ((atomic_read(&F2FS_M_SB(mapping)->wb_sync_req) ||
--wbc->nr_to_write <= 0) &&
if (--wbc->nr_to_write <= 0 &&
wbc->sync_mode == WB_SYNC_NONE) {
done = 1;
break;
Expand Down

0 comments on commit 891f36d

Please sign in to comment.