mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
fs: Replace CURRENT_TIME with current_time() for inode timestamps
CURRENT_TIME macro is not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Use current_time() instead. CURRENT_TIME is also not y2038 safe. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. As part of the effort current_time() will be extended to do range checks. Hence, it is necessary for all file system timestamps to use current_time(). Also, current_time() will be transitioned along with vfs to be y2038 safe. Note that whenever a single call to current_time() is used to change timestamps in different inodes, it is because they share the same time granularity. Signed-off-by: Deepa Dinamani <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Steven Whitehouse <[email protected]> Acked-by: Ryusuke Konishi <[email protected]> Acked-by: David Sterba <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
2554c72edb
commit
078cd8279e
76 changed files with 182 additions and 182 deletions
|
|
@ -201,7 +201,7 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh,
|
|||
}
|
||||
|
||||
inode->i_mode = new_mode;
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ctime = current_time(inode);
|
||||
di->i_mode = cpu_to_le16(inode->i_mode);
|
||||
di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
|
|
|
|||
|
|
@ -7311,7 +7311,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
|
|||
}
|
||||
|
||||
inode->i_blocks = ocfs2_inode_sector_count(inode);
|
||||
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
|
||||
di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
|
|
|
|||
|
|
@ -2020,7 +2020,7 @@ out_write_size:
|
|||
}
|
||||
inode->i_blocks = ocfs2_inode_sector_count(inode);
|
||||
di->i_size = cpu_to_le64((u64)i_size_read(inode));
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
|
||||
di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
|
||||
ocfs2_update_inode_fsync_trans(handle, inode, 1);
|
||||
|
|
|
|||
|
|
@ -1677,7 +1677,7 @@ int __ocfs2_add_entry(handle_t *handle,
|
|||
offset, ocfs2_dir_trailer_blk_off(dir->i_sb));
|
||||
|
||||
if (ocfs2_dirent_would_fit(de, rec_len)) {
|
||||
dir->i_mtime = dir->i_ctime = CURRENT_TIME;
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh);
|
||||
if (retval < 0) {
|
||||
mlog_errno(retval);
|
||||
|
|
@ -2990,7 +2990,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
|
|||
ocfs2_dinode_new_extent_list(dir, di);
|
||||
|
||||
i_size_write(dir, sb->s_blocksize);
|
||||
dir->i_mtime = dir->i_ctime = CURRENT_TIME;
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
|
||||
di->i_size = cpu_to_le64(sb->s_blocksize);
|
||||
di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec);
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
|
|||
if (inode) {
|
||||
inode->i_ino = get_next_ino();
|
||||
inode_init_owner(inode, NULL, mode);
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
inc_nlink(inode);
|
||||
|
||||
inode->i_fop = &simple_dir_operations;
|
||||
|
|
@ -421,7 +421,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
|
|||
|
||||
inode->i_ino = get_next_ino();
|
||||
inode_init_owner(inode, parent, mode);
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
|
||||
ip = DLMFS_I(inode);
|
||||
ip->ip_conn = DLMFS_I(parent)->ip_conn;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ int ocfs2_should_update_atime(struct inode *inode,
|
|||
return 0;
|
||||
}
|
||||
|
||||
now = CURRENT_TIME;
|
||||
now = current_time(inode);
|
||||
if ((now.tv_sec - inode->i_atime.tv_sec <= osb->s_atime_quantum))
|
||||
return 0;
|
||||
else
|
||||
|
|
@ -287,7 +287,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
|
|||
* have i_mutex to guard against concurrent changes to other
|
||||
* inode fields.
|
||||
*/
|
||||
inode->i_atime = CURRENT_TIME;
|
||||
inode->i_atime = current_time(inode);
|
||||
di->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
|
||||
di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
|
||||
ocfs2_update_inode_fsync_trans(handle, inode, 0);
|
||||
|
|
@ -308,7 +308,7 @@ int ocfs2_set_inode_size(handle_t *handle,
|
|||
|
||||
i_size_write(inode, new_i_size);
|
||||
inode->i_blocks = ocfs2_inode_sector_count(inode);
|
||||
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
|
||||
status = ocfs2_mark_inode_dirty(handle, inode, fe_bh);
|
||||
if (status < 0) {
|
||||
|
|
@ -429,7 +429,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
|
|||
}
|
||||
|
||||
i_size_write(inode, new_i_size);
|
||||
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
|
||||
di = (struct ocfs2_dinode *) fe_bh->b_data;
|
||||
di->i_size = cpu_to_le64(new_i_size);
|
||||
|
|
@ -840,7 +840,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||
i_size_write(inode, abs_to);
|
||||
inode->i_blocks = ocfs2_inode_sector_count(inode);
|
||||
di->i_size = cpu_to_le64((u64)i_size_read(inode));
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
|
||||
di->i_mtime_nsec = di->i_ctime_nsec;
|
||||
|
|
@ -1936,7 +1936,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
|
|||
if (change_size && i_size_read(inode) < size)
|
||||
i_size_write(inode, size);
|
||||
|
||||
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
ret = ocfs2_mark_inode_dirty(handle, inode, di_bh);
|
||||
if (ret < 0)
|
||||
mlog_errno(ret);
|
||||
|
|
|
|||
|
|
@ -953,7 +953,7 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context)
|
|||
}
|
||||
|
||||
di = (struct ocfs2_dinode *)di_bh->b_data;
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ctime = current_time(inode);
|
||||
di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
ocfs2_update_inode_fsync_trans(handle, inode, 0);
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ static int ocfs2_link(struct dentry *old_dentry,
|
|||
}
|
||||
|
||||
inc_nlink(inode);
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ctime = current_time(inode);
|
||||
ocfs2_set_links_count(fe, inode->i_nlink);
|
||||
fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
|
|
@ -1000,7 +1000,7 @@ static int ocfs2_unlink(struct inode *dir,
|
|||
ocfs2_set_links_count(fe, inode->i_nlink);
|
||||
ocfs2_journal_dirty(handle, fe_bh);
|
||||
|
||||
dir->i_ctime = dir->i_mtime = CURRENT_TIME;
|
||||
dir->i_ctime = dir->i_mtime = current_time(dir);
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
drop_nlink(dir);
|
||||
|
||||
|
|
@ -1537,7 +1537,7 @@ static int ocfs2_rename(struct inode *old_dir,
|
|||
new_dir_bh, &target_insert);
|
||||
}
|
||||
|
||||
old_inode->i_ctime = CURRENT_TIME;
|
||||
old_inode->i_ctime = current_time(old_inode);
|
||||
mark_inode_dirty(old_inode);
|
||||
|
||||
status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode),
|
||||
|
|
@ -1586,9 +1586,9 @@ static int ocfs2_rename(struct inode *old_dir,
|
|||
|
||||
if (new_inode) {
|
||||
drop_nlink(new_inode);
|
||||
new_inode->i_ctime = CURRENT_TIME;
|
||||
new_inode->i_ctime = current_time(new_inode);
|
||||
}
|
||||
old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
|
||||
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
|
||||
|
||||
if (update_dot_dot) {
|
||||
status = ocfs2_update_entry(old_inode, handle,
|
||||
|
|
|
|||
|
|
@ -3778,7 +3778,7 @@ static int ocfs2_change_ctime(struct inode *inode,
|
|||
goto out_commit;
|
||||
}
|
||||
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ctime = current_time(inode);
|
||||
di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
|
||||
|
|
@ -4094,7 +4094,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
|
|||
* we want mtime to appear identical to the source and
|
||||
* update ctime.
|
||||
*/
|
||||
t_inode->i_ctime = CURRENT_TIME;
|
||||
t_inode->i_ctime = current_time(t_inode);
|
||||
|
||||
di->i_ctime = cpu_to_le64(t_inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(t_inode->i_ctime.tv_nsec);
|
||||
|
|
|
|||
|
|
@ -3431,7 +3431,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
|
|||
goto out;
|
||||
}
|
||||
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ctime = current_time(inode);
|
||||
di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
ocfs2_journal_dirty(ctxt->handle, xis->inode_bh);
|
||||
|
|
|
|||
Loading…
Reference in a new issue