提交 237c0790 编写于 作者: J Jaegeuk Kim

f2fs: call SetPageUptodate if needed

SetPageUptodate() issues memory barrier, resulting in performance degrdation.
Let's avoid that.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 fe76b796
...@@ -48,7 +48,8 @@ struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) ...@@ -48,7 +48,8 @@ struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
goto repeat; goto repeat;
} }
f2fs_wait_on_page_writeback(page, META, true); f2fs_wait_on_page_writeback(page, META, true);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
return page; return page;
} }
...@@ -364,7 +365,8 @@ static int f2fs_set_meta_page_dirty(struct page *page) ...@@ -364,7 +365,8 @@ static int f2fs_set_meta_page_dirty(struct page *page)
{ {
trace_f2fs_set_page_dirty(page, META); trace_f2fs_set_page_dirty(page, META);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
if (!PageDirty(page)) { if (!PageDirty(page)) {
f2fs_set_page_dirty_nobuffers(page); f2fs_set_page_dirty_nobuffers(page);
inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_META); inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_META);
......
...@@ -47,7 +47,8 @@ static void f2fs_read_end_io(struct bio *bio) ...@@ -47,7 +47,8 @@ static void f2fs_read_end_io(struct bio *bio)
struct page *page = bvec->bv_page; struct page *page = bvec->bv_page;
if (!bio->bi_error) { if (!bio->bi_error) {
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
} else { } else {
ClearPageUptodate(page); ClearPageUptodate(page);
SetPageError(page); SetPageError(page);
...@@ -443,7 +444,8 @@ struct page *get_read_data_page(struct inode *inode, pgoff_t index, ...@@ -443,7 +444,8 @@ struct page *get_read_data_page(struct inode *inode, pgoff_t index,
*/ */
if (dn.data_blkaddr == NEW_ADDR) { if (dn.data_blkaddr == NEW_ADDR) {
zero_user_segment(page, 0, PAGE_SIZE); zero_user_segment(page, 0, PAGE_SIZE);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
unlock_page(page); unlock_page(page);
return page; return page;
} }
...@@ -554,7 +556,8 @@ struct page *get_new_data_page(struct inode *inode, ...@@ -554,7 +556,8 @@ struct page *get_new_data_page(struct inode *inode,
if (dn.data_blkaddr == NEW_ADDR) { if (dn.data_blkaddr == NEW_ADDR) {
zero_user_segment(page, 0, PAGE_SIZE); zero_user_segment(page, 0, PAGE_SIZE);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
} else { } else {
f2fs_put_page(page, 1); f2fs_put_page(page, 1);
...@@ -1065,7 +1068,8 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1065,7 +1068,8 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
} }
} else { } else {
zero_user_segment(page, 0, PAGE_SIZE); zero_user_segment(page, 0, PAGE_SIZE);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
unlock_page(page); unlock_page(page);
goto next_page; goto next_page;
} }
...@@ -1659,7 +1663,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -1659,7 +1663,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
} }
} }
out_update: out_update:
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
out_clear: out_clear:
clear_cold_data(page); clear_cold_data(page);
return 0; return 0;
...@@ -1813,7 +1818,8 @@ static int f2fs_set_data_page_dirty(struct page *page) ...@@ -1813,7 +1818,8 @@ static int f2fs_set_data_page_dirty(struct page *page)
trace_f2fs_set_page_dirty(page, DATA); trace_f2fs_set_page_dirty(page, DATA);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
if (f2fs_is_atomic_file(inode)) { if (f2fs_is_atomic_file(inode)) {
if (!IS_ATOMIC_WRITTEN_PAGE(page)) { if (!IS_ATOMIC_WRITTEN_PAGE(page)) {
......
...@@ -81,7 +81,8 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, ...@@ -81,7 +81,8 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
zero_user_segment(page, offset, PAGE_SIZE); zero_user_segment(page, offset, PAGE_SIZE);
} }
set_page_dirty(page); set_page_dirty(page);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
trace_f2fs_vm_page_mkwrite(page, DATA); trace_f2fs_vm_page_mkwrite(page, DATA);
mapped: mapped:
......
...@@ -59,7 +59,8 @@ void read_inline_data(struct page *page, struct page *ipage) ...@@ -59,7 +59,8 @@ void read_inline_data(struct page *page, struct page *ipage)
memcpy(dst_addr, src_addr, MAX_INLINE_DATA); memcpy(dst_addr, src_addr, MAX_INLINE_DATA);
flush_dcache_page(page); flush_dcache_page(page);
kunmap_atomic(dst_addr); kunmap_atomic(dst_addr);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
} }
bool truncate_inline_inode(struct page *ipage, u64 from) bool truncate_inline_inode(struct page *ipage, u64 from)
...@@ -97,7 +98,8 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page) ...@@ -97,7 +98,8 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
else else
read_inline_data(page, ipage); read_inline_data(page, ipage);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
f2fs_put_page(ipage, 1); f2fs_put_page(ipage, 1);
unlock_page(page); unlock_page(page);
return 0; return 0;
...@@ -370,7 +372,8 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, ...@@ -370,7 +372,8 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage,
NR_INLINE_DENTRY * F2FS_SLOT_LEN); NR_INLINE_DENTRY * F2FS_SLOT_LEN);
kunmap_atomic(dentry_blk); kunmap_atomic(dentry_blk);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
set_page_dirty(page); set_page_dirty(page);
/* clear inline dir and flag after data writeback */ /* clear inline dir and flag after data writeback */
......
...@@ -1045,7 +1045,8 @@ struct page *new_node_page(struct dnode_of_data *dn, ...@@ -1045,7 +1045,8 @@ struct page *new_node_page(struct dnode_of_data *dn,
f2fs_wait_on_page_writeback(page, NODE, true); f2fs_wait_on_page_writeback(page, NODE, true);
fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true);
set_cold_node(dn->inode, page); set_cold_node(dn->inode, page);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
if (set_page_dirty(page)) if (set_page_dirty(page))
dn->node_changed = true; dn->node_changed = true;
...@@ -1644,7 +1645,8 @@ static int f2fs_set_node_page_dirty(struct page *page) ...@@ -1644,7 +1645,8 @@ static int f2fs_set_node_page_dirty(struct page *page)
{ {
trace_f2fs_set_page_dirty(page, NODE); trace_f2fs_set_page_dirty(page, NODE);
SetPageUptodate(page); if (!PageUptodate(page))
SetPageUptodate(page);
if (!PageDirty(page)) { if (!PageDirty(page)) {
f2fs_set_page_dirty_nobuffers(page); f2fs_set_page_dirty_nobuffers(page);
inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_NODES); inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_NODES);
...@@ -2015,7 +2017,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) ...@@ -2015,7 +2017,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
/* Should not use this inode from free nid list */ /* Should not use this inode from free nid list */
remove_free_nid(NM_I(sbi), ino); remove_free_nid(NM_I(sbi), ino);
SetPageUptodate(ipage); if (!PageUptodate(ipage))
SetPageUptodate(ipage);
fill_node_footer(ipage, ino, ino, 0, true); fill_node_footer(ipage, ino, ino, 0, true);
src = F2FS_INODE(page); src = F2FS_INODE(page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册