summaryrefslogtreecommitdiff
path: root/fs/f2fs/gc.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/gc.c
parent2062e0c3daa0bcfc806f4f7331f8bba16dd42632 (diff)
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/gc.c')
-rw-r--r--fs/f2fs/gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 71462f2e47d4..666518eb7293 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -829,8 +829,8 @@ static int move_data_block(struct inode *inode, block_t bidx,
}
write_page:
- set_page_dirty(fio.encrypted_page);
f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true);
+ set_page_dirty(fio.encrypted_page);
if (clear_page_dirty_for_io(fio.encrypted_page))
dec_page_count(fio.sbi, F2FS_DIRTY_META);
@@ -924,8 +924,9 @@ static int move_data_page(struct inode *inode, block_t bidx, int gc_type,
bool is_dirty = PageDirty(page);
retry:
- 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);