Commit 049ea86c authored by Zhang Qilong's avatar Zhang Qilong Committed by Jaegeuk Kim

f2fs: add static init_idisk_time function to reduce the code

We can use a inner function to init the disk time
of f2fs_inode_info for cleaning redundant code.
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent d382e369
...@@ -333,6 +333,16 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) ...@@ -333,6 +333,16 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
return true; return true;
} }
static void init_idisk_time(struct inode *inode)
{
struct f2fs_inode_info *fi = F2FS_I(inode);
fi->i_disk_time[0] = inode->i_atime;
fi->i_disk_time[1] = inode->i_ctime;
fi->i_disk_time[2] = inode->i_mtime;
fi->i_disk_time[3] = fi->i_crtime;
}
static int do_read_inode(struct inode *inode) static int do_read_inode(struct inode *inode)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
...@@ -465,10 +475,7 @@ static int do_read_inode(struct inode *inode) ...@@ -465,10 +475,7 @@ static int do_read_inode(struct inode *inode)
} }
} }
fi->i_disk_time[0] = inode->i_atime; init_idisk_time(inode);
fi->i_disk_time[1] = inode->i_ctime;
fi->i_disk_time[2] = inode->i_mtime;
fi->i_disk_time[3] = fi->i_crtime;
f2fs_put_page(node_page, 1); f2fs_put_page(node_page, 1);
stat_inc_inline_xattr(inode); stat_inc_inline_xattr(inode);
...@@ -676,11 +683,7 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page) ...@@ -676,11 +683,7 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
clear_page_private_inline(node_page); clear_page_private_inline(node_page);
F2FS_I(inode)->i_disk_time[0] = inode->i_atime; init_idisk_time(inode);
F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
#ifdef CONFIG_F2FS_CHECK_FS #ifdef CONFIG_F2FS_CHECK_FS
f2fs_inode_chksum_set(F2FS_I_SB(inode), node_page); f2fs_inode_chksum_set(F2FS_I_SB(inode), node_page);
#endif #endif
......
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