diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-05-23 22:25:09 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-31 11:31:50 -0700 |
commit | f8de4331224513271a99dce967e637cf14f4bc28 (patch) | |
tree | 0ef5fa58946a199ff9dbf6f053e3bc4c4fa225b1 | |
parent | 7b525dd01365c6764018e374d391c92466be1b7a (diff) | |
download | linux-stable-f8de4331224513271a99dce967e637cf14f4bc28.tar.gz linux-stable-f8de4331224513271a99dce967e637cf14f4bc28.tar.bz2 linux-stable-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>
-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; |