diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-05-23 16:25:09 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-31 20:31:50 +0200 |
commit | f8de4331224513271a99dce967e637cf14f4bc28 (patch) | |
tree | 0ef5fa58946a199ff9dbf6f053e3bc4c4fa225b1 /fs/f2fs | |
parent | f2fs: clean up with is_valid_blkaddr() (diff) | |
download | linux-f8de4331224513271a99dce967e637cf14f4bc28.tar.xz linux-f8de4331224513271a99dce967e637cf14f4bc28.zip |
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 19c3c2180cca..abb45f5653f9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1981,6 +1981,13 @@ retry: 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 @@ continue_unlock: 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; |