Commit fa3d2bdf authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: wait on page's writeback in writepages path

Likewise f2fs_write_cache_pages, let's do for node and meta pages too.
Especially, for node blocks, we should do this before marking its fsync
and dentry flags.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 479c8bc4
...@@ -232,7 +232,6 @@ static int f2fs_write_meta_page(struct page *page, ...@@ -232,7 +232,6 @@ static int f2fs_write_meta_page(struct page *page,
if (unlikely(f2fs_cp_error(sbi))) if (unlikely(f2fs_cp_error(sbi)))
goto redirty_out; goto redirty_out;
f2fs_wait_on_page_writeback(page, META, true);
write_meta_page(sbi, page); write_meta_page(sbi, page);
dec_page_count(sbi, F2FS_DIRTY_META); dec_page_count(sbi, F2FS_DIRTY_META);
unlock_page(page); unlock_page(page);
...@@ -315,6 +314,9 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, ...@@ -315,6 +314,9 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
goto continue_unlock; goto continue_unlock;
} }
f2fs_wait_on_page_writeback(page, META, true);
BUG_ON(PageWriteback(page));
if (!clear_page_dirty_for_io(page)) if (!clear_page_dirty_for_io(page))
goto continue_unlock; goto continue_unlock;
......
...@@ -1297,6 +1297,9 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino, ...@@ -1297,6 +1297,9 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,
continue; continue;
} }
f2fs_wait_on_page_writeback(page, NODE, true);
BUG_ON(PageWriteback(page));
if (!clear_page_dirty_for_io(page)) if (!clear_page_dirty_for_io(page))
goto continue_unlock; goto continue_unlock;
...@@ -1402,8 +1405,6 @@ static int f2fs_write_node_page(struct page *page, ...@@ -1402,8 +1405,6 @@ static int f2fs_write_node_page(struct page *page,
if (unlikely(f2fs_cp_error(sbi))) if (unlikely(f2fs_cp_error(sbi)))
goto redirty_out; goto redirty_out;
f2fs_wait_on_page_writeback(page, NODE, true);
/* get old block addr of this node page */ /* get old block addr of this node page */
nid = nid_of_node(page); nid = nid_of_node(page);
f2fs_bug_on(sbi, page->index != nid); f2fs_bug_on(sbi, page->index != nid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment