Commit ad9dc5df authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

jfs: convert to ctime accessor functions

In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Acked-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20230705190309.579783-53-jlayton@kernel.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent d8b23c61
...@@ -116,7 +116,7 @@ int jfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, ...@@ -116,7 +116,7 @@ int jfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
if (!rc) { if (!rc) {
if (update_mode) { if (update_mode) {
inode->i_mode = mode; inode->i_mode = mode;
inode->i_ctime = current_time(inode); inode_set_ctime_current(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
rc = txCommit(tid, 1, &inode, 0); rc = txCommit(tid, 1, &inode, 0);
......
...@@ -393,7 +393,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length) ...@@ -393,7 +393,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
break; break;
} }
ip->i_mtime = ip->i_ctime = current_time(ip); ip->i_mtime = inode_set_ctime_current(ip);
mark_inode_dirty(ip); mark_inode_dirty(ip);
txCommit(tid, 1, &ip, 0); txCommit(tid, 1, &ip, 0);
......
...@@ -96,7 +96,7 @@ int jfs_fileattr_set(struct mnt_idmap *idmap, ...@@ -96,7 +96,7 @@ int jfs_fileattr_set(struct mnt_idmap *idmap,
jfs_inode->mode2 = flags; jfs_inode->mode2 = flags;
jfs_set_inode_flags(inode); jfs_set_inode_flags(inode);
inode->i_ctime = current_time(inode); inode_set_ctime_current(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
return 0; return 0;
......
...@@ -3064,8 +3064,8 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) ...@@ -3064,8 +3064,8 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip)
ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec);
ip->i_mtime.tv_sec = le32_to_cpu(dip->di_mtime.tv_sec); ip->i_mtime.tv_sec = le32_to_cpu(dip->di_mtime.tv_sec);
ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec); ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec);
ip->i_ctime.tv_sec = le32_to_cpu(dip->di_ctime.tv_sec); inode_set_ctime(ip, le32_to_cpu(dip->di_ctime.tv_sec),
ip->i_ctime.tv_nsec = le32_to_cpu(dip->di_ctime.tv_nsec); le32_to_cpu(dip->di_ctime.tv_nsec));
ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks)); ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks));
ip->i_generation = le32_to_cpu(dip->di_gen); ip->i_generation = le32_to_cpu(dip->di_gen);
...@@ -3139,8 +3139,8 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip) ...@@ -3139,8 +3139,8 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip)
dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec); dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec);
dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec); dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec);
dip->di_ctime.tv_sec = cpu_to_le32(ip->i_ctime.tv_sec); dip->di_ctime.tv_sec = cpu_to_le32(inode_get_ctime(ip).tv_sec);
dip->di_ctime.tv_nsec = cpu_to_le32(ip->i_ctime.tv_nsec); dip->di_ctime.tv_nsec = cpu_to_le32(inode_get_ctime(ip).tv_nsec);
dip->di_mtime.tv_sec = cpu_to_le32(ip->i_mtime.tv_sec); dip->di_mtime.tv_sec = cpu_to_le32(ip->i_mtime.tv_sec);
dip->di_mtime.tv_nsec = cpu_to_le32(ip->i_mtime.tv_nsec); dip->di_mtime.tv_nsec = cpu_to_le32(ip->i_mtime.tv_nsec);
dip->di_ixpxd = jfs_ip->ixpxd; /* in-memory pxd's are little-endian */ dip->di_ixpxd = jfs_ip->ixpxd; /* in-memory pxd's are little-endian */
......
...@@ -97,8 +97,8 @@ struct inode *ialloc(struct inode *parent, umode_t mode) ...@@ -97,8 +97,8 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
jfs_inode->mode2 |= inode->i_mode; jfs_inode->mode2 |= inode->i_mode;
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_set_ctime_current(inode);
jfs_inode->otime = inode->i_ctime.tv_sec; jfs_inode->otime = inode_get_ctime(inode).tv_sec;
inode->i_generation = JFS_SBI(sb)->gengen++; inode->i_generation = JFS_SBI(sb)->gengen++;
jfs_inode->cflag = 0; jfs_inode->cflag = 0;
......
...@@ -149,7 +149,7 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip, ...@@ -149,7 +149,7 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
mark_inode_dirty(ip); mark_inode_dirty(ip);
dip->i_ctime = dip->i_mtime = current_time(dip); dip->i_mtime = inode_set_ctime_current(dip);
mark_inode_dirty(dip); mark_inode_dirty(dip);
...@@ -284,7 +284,7 @@ static int jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip, ...@@ -284,7 +284,7 @@ static int jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
/* update parent directory inode */ /* update parent directory inode */
inc_nlink(dip); /* for '..' from child directory */ inc_nlink(dip); /* for '..' from child directory */
dip->i_ctime = dip->i_mtime = current_time(dip); dip->i_mtime = inode_set_ctime_current(dip);
mark_inode_dirty(dip); mark_inode_dirty(dip);
rc = txCommit(tid, 2, &iplist[0], 0); rc = txCommit(tid, 2, &iplist[0], 0);
...@@ -390,7 +390,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) ...@@ -390,7 +390,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
/* update parent directory's link count corresponding /* update parent directory's link count corresponding
* to ".." entry of the target directory deleted * to ".." entry of the target directory deleted
*/ */
dip->i_ctime = dip->i_mtime = current_time(dip); dip->i_mtime = inode_set_ctime_current(dip);
inode_dec_link_count(dip); inode_dec_link_count(dip);
/* /*
...@@ -512,7 +512,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -512,7 +512,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
ASSERT(ip->i_nlink); ASSERT(ip->i_nlink);
ip->i_ctime = dip->i_ctime = dip->i_mtime = current_time(ip); dip->i_mtime = inode_set_ctime_to_ts(dip, inode_set_ctime_current(ip));
mark_inode_dirty(dip); mark_inode_dirty(dip);
/* update target's inode */ /* update target's inode */
...@@ -827,8 +827,8 @@ static int jfs_link(struct dentry *old_dentry, ...@@ -827,8 +827,8 @@ static int jfs_link(struct dentry *old_dentry,
/* update object inode */ /* update object inode */
inc_nlink(ip); /* for new link */ inc_nlink(ip); /* for new link */
ip->i_ctime = current_time(ip); inode_set_ctime_current(ip);
dir->i_ctime = dir->i_mtime = current_time(dir); dir->i_mtime = inode_set_ctime_current(dir);
mark_inode_dirty(dir); mark_inode_dirty(dir);
ihold(ip); ihold(ip);
...@@ -1028,7 +1028,7 @@ static int jfs_symlink(struct mnt_idmap *idmap, struct inode *dip, ...@@ -1028,7 +1028,7 @@ static int jfs_symlink(struct mnt_idmap *idmap, struct inode *dip,
mark_inode_dirty(ip); mark_inode_dirty(ip);
dip->i_ctime = dip->i_mtime = current_time(dip); dip->i_mtime = inode_set_ctime_current(dip);
mark_inode_dirty(dip); mark_inode_dirty(dip);
/* /*
* commit update of parent directory and link object * commit update of parent directory and link object
...@@ -1205,7 +1205,7 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1205,7 +1205,7 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
tblk->xflag |= COMMIT_DELETE; tblk->xflag |= COMMIT_DELETE;
tblk->u.ip = new_ip; tblk->u.ip = new_ip;
} else { } else {
new_ip->i_ctime = current_time(new_ip); inode_set_ctime_current(new_ip);
mark_inode_dirty(new_ip); mark_inode_dirty(new_ip);
} }
} else { } else {
...@@ -1268,10 +1268,10 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1268,10 +1268,10 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
/* /*
* Update ctime on changed/moved inodes & mark dirty * Update ctime on changed/moved inodes & mark dirty
*/ */
old_ip->i_ctime = current_time(old_ip); inode_set_ctime_current(old_ip);
mark_inode_dirty(old_ip); mark_inode_dirty(old_ip);
new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); new_dir->i_mtime = inode_set_ctime_current(new_dir);
mark_inode_dirty(new_dir); mark_inode_dirty(new_dir);
/* Build list of inodes modified by this transaction */ /* Build list of inodes modified by this transaction */
...@@ -1283,7 +1283,7 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1283,7 +1283,7 @@ static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
if (old_dir != new_dir) { if (old_dir != new_dir) {
iplist[ipcount++] = new_dir; iplist[ipcount++] = new_dir;
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); old_dir->i_mtime = inode_set_ctime_current(old_dir);
mark_inode_dirty(old_dir); mark_inode_dirty(old_dir);
} }
...@@ -1416,7 +1416,7 @@ static int jfs_mknod(struct mnt_idmap *idmap, struct inode *dir, ...@@ -1416,7 +1416,7 @@ static int jfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
mark_inode_dirty(ip); mark_inode_dirty(ip);
dir->i_ctime = dir->i_mtime = current_time(dir); dir->i_mtime = inode_set_ctime_current(dir);
mark_inode_dirty(dir); mark_inode_dirty(dir);
......
...@@ -818,7 +818,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type, ...@@ -818,7 +818,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
} }
if (inode->i_size < off+len-towrite) if (inode->i_size < off+len-towrite)
i_size_write(inode, off+len-towrite); i_size_write(inode, off+len-towrite);
inode->i_mtime = inode->i_ctime = current_time(inode); inode->i_mtime = inode_set_ctime_current(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
inode_unlock(inode); inode_unlock(inode);
return len - towrite; return len - towrite;
......
...@@ -647,7 +647,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf, ...@@ -647,7 +647,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,
if (old_blocks) if (old_blocks)
dquot_free_block(inode, old_blocks); dquot_free_block(inode, old_blocks);
inode->i_ctime = current_time(inode); inode_set_ctime_current(inode);
return 0; return 0;
} }
......
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