* [f2fs-dev] [PATCH -next] f2fs: add static init_idisk_time function to reduce the code
@ 2022-08-31 9:48 Zhang Qilong via Linux-f2fs-devel
2022-09-06 2:55 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong via Linux-f2fs-devel @ 2022-08-31 9:48 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel
We can use a inner function to init the disk time
of f2fs_inode_info for cleaning redundant code.
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
fs/f2fs/inode.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 1feb0a8a699e..57669f51be83 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -333,6 +333,16 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
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)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
@@ -465,10 +475,7 @@ static int do_read_inode(struct inode *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;
+ init_idisk_time(inode);
f2fs_put_page(node_page, 1);
stat_inc_inline_xattr(inode);
@@ -679,11 +686,7 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
if (inode->i_nlink == 0)
clear_page_private_inline(node_page);
- F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
- 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;
-
+ init_idisk_time(inode);
#ifdef CONFIG_F2FS_CHECK_FS
f2fs_inode_chksum_set(F2FS_I_SB(inode), node_page);
#endif
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH -next] f2fs: add static init_idisk_time function to reduce the code
2022-08-31 9:48 [f2fs-dev] [PATCH -next] f2fs: add static init_idisk_time function to reduce the code Zhang Qilong via Linux-f2fs-devel
@ 2022-09-06 2:55 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-09-06 2:55 UTC (permalink / raw)
To: Zhang Qilong, jaegeuk; +Cc: linux-f2fs-devel
On 2022/8/31 17:48, Zhang Qilong wrote:
> We can use a inner function to init the disk time
> of f2fs_inode_info for cleaning redundant code.
>
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-06 2:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-31 9:48 [f2fs-dev] [PATCH -next] f2fs: add static init_idisk_time function to reduce the code Zhang Qilong via Linux-f2fs-devel
2022-09-06 2:55 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).