Commit c5667575 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: remove unneeded set_cold_node()

When setting COLD_BIT_SHIFT flag in node block, we only need to call
set_cold_node() in new_node_page() and recover_inode_page() during
node page initialization. So remove unneeded set_cold_node() in other
places.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent b91050a8
...@@ -396,8 +396,6 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir, ...@@ -396,8 +396,6 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
page = get_node_page(F2FS_I_SB(dir), inode->i_ino); page = get_node_page(F2FS_I_SB(dir), inode->i_ino);
if (IS_ERR(page)) if (IS_ERR(page))
return page; return page;
set_cold_node(inode, page);
} }
if (new_name) { if (new_name) {
......
...@@ -439,7 +439,6 @@ void update_inode(struct inode *inode, struct page *node_page) ...@@ -439,7 +439,6 @@ void update_inode(struct inode *inode, struct page *node_page)
} }
__set_inode_rdev(inode, ri); __set_inode_rdev(inode, ri);
set_cold_node(inode, node_page);
/* deleted inode */ /* deleted inode */
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
......
...@@ -1076,7 +1076,7 @@ struct page *new_node_page(struct dnode_of_data *dn, unsigned int ofs) ...@@ -1076,7 +1076,7 @@ struct page *new_node_page(struct dnode_of_data *dn, unsigned int ofs)
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(page, S_ISDIR(dn->inode->i_mode));
if (!PageUptodate(page)) if (!PageUptodate(page))
SetPageUptodate(page); SetPageUptodate(page);
if (set_page_dirty(page)) if (set_page_dirty(page))
...@@ -2291,6 +2291,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) ...@@ -2291,6 +2291,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
if (!PageUptodate(ipage)) if (!PageUptodate(ipage))
SetPageUptodate(ipage); SetPageUptodate(ipage);
fill_node_footer(ipage, ino, ino, 0, true); fill_node_footer(ipage, ino, ino, 0, true);
set_cold_node(page, false);
src = F2FS_INODE(page); src = F2FS_INODE(page);
dst = F2FS_INODE(ipage); dst = F2FS_INODE(ipage);
......
...@@ -422,12 +422,12 @@ static inline void clear_inline_node(struct page *page) ...@@ -422,12 +422,12 @@ static inline void clear_inline_node(struct page *page)
ClearPageChecked(page); ClearPageChecked(page);
} }
static inline void set_cold_node(struct inode *inode, struct page *page) static inline void set_cold_node(struct page *page, bool is_dir)
{ {
struct f2fs_node *rn = F2FS_NODE(page); struct f2fs_node *rn = F2FS_NODE(page);
unsigned int flag = le32_to_cpu(rn->footer.flag); unsigned int flag = le32_to_cpu(rn->footer.flag);
if (S_ISDIR(inode->i_mode)) if (is_dir)
flag &= ~(0x1 << COLD_BIT_SHIFT); flag &= ~(0x1 << COLD_BIT_SHIFT);
else else
flag |= (0x1 << COLD_BIT_SHIFT); flag |= (0x1 << COLD_BIT_SHIFT);
......
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