Commit 24b81dfc authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jaegeuk Kim

f2fs: use timespec64 for inode timestamps

The on-disk representation and the vfs both use 64-bit tv_sec values,
so let's change the last missing piece in the middle.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6aead161
...@@ -669,8 +669,8 @@ struct f2fs_inode_info { ...@@ -669,8 +669,8 @@ struct f2fs_inode_info {
int i_extra_isize; /* size of extra space located in i_addr */ int i_extra_isize; /* size of extra space located in i_addr */
kprojid_t i_projid; /* id for project quota */ kprojid_t i_projid; /* id for project quota */
int i_inline_xattr_size; /* inline xattr size */ int i_inline_xattr_size; /* inline xattr size */
struct timespec i_crtime; /* inode creation time */ struct timespec64 i_crtime; /* inode creation time */
struct timespec i_disk_time[4]; /* inode disk times */ struct timespec64 i_disk_time[4];/* inode disk times */
}; };
static inline void get_extent_info(struct extent_info *ext, static inline void get_extent_info(struct extent_info *ext,
...@@ -2519,7 +2519,6 @@ static inline void clear_file(struct inode *inode, int type) ...@@ -2519,7 +2519,6 @@ static inline void clear_file(struct inode *inode, int type)
static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync) static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
{ {
struct timespec ts;
bool ret; bool ret;
if (dsync) { if (dsync) {
...@@ -2535,16 +2534,13 @@ static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync) ...@@ -2535,16 +2534,13 @@ static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
i_size_read(inode) & ~PAGE_MASK) i_size_read(inode) & ~PAGE_MASK)
return false; return false;
ts = timespec64_to_timespec(inode->i_atime); if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &inode->i_atime))
if (!timespec_equal(F2FS_I(inode)->i_disk_time, &ts))
return false; return false;
ts = timespec64_to_timespec(inode->i_ctime); if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &inode->i_ctime))
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 1, &ts))
return false; return false;
ts = timespec64_to_timespec(inode->i_mtime); if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &inode->i_mtime))
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 2, &ts))
return false; return false;
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 3, if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 3,
&F2FS_I(inode)->i_crtime)) &F2FS_I(inode)->i_crtime))
return false; return false;
......
...@@ -304,9 +304,9 @@ static int do_read_inode(struct inode *inode) ...@@ -304,9 +304,9 @@ static int do_read_inode(struct inode *inode)
fi->i_crtime.tv_nsec = le32_to_cpu(ri->i_crtime_nsec); fi->i_crtime.tv_nsec = le32_to_cpu(ri->i_crtime_nsec);
} }
F2FS_I(inode)->i_disk_time[0] = timespec64_to_timespec(inode->i_atime); F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
F2FS_I(inode)->i_disk_time[1] = timespec64_to_timespec(inode->i_ctime); F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
F2FS_I(inode)->i_disk_time[2] = timespec64_to_timespec(inode->i_mtime); F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime; F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
f2fs_put_page(node_page, 1); f2fs_put_page(node_page, 1);
...@@ -477,9 +477,9 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page) ...@@ -477,9 +477,9 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
clear_inline_node(node_page); clear_inline_node(node_page);
F2FS_I(inode)->i_disk_time[0] = timespec64_to_timespec(inode->i_atime); F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
F2FS_I(inode)->i_disk_time[1] = timespec64_to_timespec(inode->i_ctime); F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
F2FS_I(inode)->i_disk_time[2] = timespec64_to_timespec(inode->i_mtime); F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime; F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
#ifdef CONFIG_F2FS_CHECK_FS #ifdef CONFIG_F2FS_CHECK_FS
......
...@@ -51,7 +51,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) ...@@ -51,7 +51,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
inode->i_ino = ino; inode->i_ino = ino;
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
F2FS_I(inode)->i_crtime = timespec64_to_timespec(inode->i_mtime); F2FS_I(inode)->i_crtime = inode->i_mtime;
inode->i_generation = sbi->s_next_generation++; inode->i_generation = sbi->s_next_generation++;
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
......
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