f2fs: detect synchronous writeback more earlier

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>
This commit is contained in:
Chao Yu 2018-05-23 22:25:09 +08:00 committed by Jaegeuk Kim
parent 7b525dd013
commit f8de433122
1 changed files with 8 additions and 3 deletions

View File

@ -1981,6 +1981,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);
@ -2035,9 +2042,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;