summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-12-12 18:12:30 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-12-14 06:38:36 -0800
commit8d64d365aed355b2e2465d19ba61df02462fff4d (patch)
tree7b3924ab7ba6f9d0a71f8085443c62b7f57e1ce2 /fs/f2fs/segment.c
parent2062e0c3daa0bcfc806f4f7331f8bba16dd42632 (diff)
downloadlinux-8d64d365aed355b2e2465d19ba61df02462fff4d.tar.gz
linux-8d64d365aed355b2e2465d19ba61df02462fff4d.tar.bz2
linux-8d64d365aed355b2e2465d19ba61df02462fff4d.zip
f2fs: fix to reorder set_page_dirty and wait_on_page_writeback
This patch reorders flow from - update page - set_page_dirty - wait_on_page_writeback to - wait_on_page_writeback - update page - set_page_dirty The reason is: - set_page_dirty will increase reference of dirty page, the reference should be cleared before wait_on_page_writeback to keep its consistency. - some devices need stable page during page writebacking, so we should not change page's data. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 204d31e58967..e2e971e89b2d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -387,8 +387,9 @@ static int __f2fs_commit_inmem_pages(struct inode *inode)
if (page->mapping == inode->i_mapping) {
trace_f2fs_commit_inmem_page(page, INMEM);
- set_page_dirty(page);
f2fs_wait_on_page_writeback(page, DATA, true);
+
+ set_page_dirty(page);
if (clear_page_dirty_for_io(page)) {
inode_dec_dirty_pages(inode);
f2fs_remove_dirty_inode(inode);