mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
ceph: 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. Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Message-Id: <20230705190309.579783-28-jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
2a9462de43
commit
7795aef081
@ -93,7 +93,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
char *value = NULL;
|
||||
struct iattr newattrs;
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct timespec64 old_ctime = inode->i_ctime;
|
||||
struct timespec64 old_ctime = inode_get_ctime(inode);
|
||||
umode_t new_mode = inode->i_mode, old_mode = inode->i_mode;
|
||||
|
||||
if (ceph_snap(inode) != CEPH_NOSNAP) {
|
||||
|
@ -1400,7 +1400,7 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
|
||||
|
||||
arg->mtime = inode->i_mtime;
|
||||
arg->atime = inode->i_atime;
|
||||
arg->ctime = inode->i_ctime;
|
||||
arg->ctime = inode_get_ctime(inode);
|
||||
arg->btime = ci->i_btime;
|
||||
arg->change_attr = inode_peek_iversion_raw(inode);
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct inode *ceph_get_snapdir(struct inode *parent)
|
||||
inode->i_uid = parent->i_uid;
|
||||
inode->i_gid = parent->i_gid;
|
||||
inode->i_mtime = parent->i_mtime;
|
||||
inode->i_ctime = parent->i_ctime;
|
||||
inode_set_ctime_to_ts(inode, inode_get_ctime(parent));
|
||||
inode->i_atime = parent->i_atime;
|
||||
ci->i_rbytes = 0;
|
||||
ci->i_btime = ceph_inode(parent)->i_btime;
|
||||
@ -688,6 +688,7 @@ void ceph_fill_file_time(struct inode *inode, int issued,
|
||||
struct timespec64 *mtime, struct timespec64 *atime)
|
||||
{
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct timespec64 ictime = inode_get_ctime(inode);
|
||||
int warn = 0;
|
||||
|
||||
if (issued & (CEPH_CAP_FILE_EXCL|
|
||||
@ -696,11 +697,11 @@ void ceph_fill_file_time(struct inode *inode, int issued,
|
||||
CEPH_CAP_AUTH_EXCL|
|
||||
CEPH_CAP_XATTR_EXCL)) {
|
||||
if (ci->i_version == 0 ||
|
||||
timespec64_compare(ctime, &inode->i_ctime) > 0) {
|
||||
timespec64_compare(ctime, &ictime) > 0) {
|
||||
dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
|
||||
inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
|
||||
ictime.tv_sec, ictime.tv_nsec,
|
||||
ctime->tv_sec, ctime->tv_nsec);
|
||||
inode->i_ctime = *ctime;
|
||||
inode_set_ctime_to_ts(inode, *ctime);
|
||||
}
|
||||
if (ci->i_version == 0 ||
|
||||
ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
|
||||
@ -738,7 +739,7 @@ void ceph_fill_file_time(struct inode *inode, int issued,
|
||||
} else {
|
||||
/* we have no write|excl caps; whatever the MDS says is true */
|
||||
if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) {
|
||||
inode->i_ctime = *ctime;
|
||||
inode_set_ctime_to_ts(inode, *ctime);
|
||||
inode->i_mtime = *mtime;
|
||||
inode->i_atime = *atime;
|
||||
ci->i_time_warp_seq = time_warp_seq;
|
||||
@ -2166,7 +2167,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
|
||||
bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
|
||||
ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
|
||||
dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode,
|
||||
inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
|
||||
inode_get_ctime(inode).tv_sec,
|
||||
inode_get_ctime(inode).tv_nsec,
|
||||
attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
|
||||
only ? "ctime only" : "ignored");
|
||||
if (only) {
|
||||
@ -2191,7 +2193,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
|
||||
if (dirtied) {
|
||||
inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
|
||||
&prealloc_cf);
|
||||
inode->i_ctime = attr->ia_ctime;
|
||||
inode_set_ctime_to_ts(inode, attr->ia_ctime);
|
||||
inode_inc_iversion_raw(inode);
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
|
||||
capsnap->size = i_size_read(inode);
|
||||
capsnap->mtime = inode->i_mtime;
|
||||
capsnap->atime = inode->i_atime;
|
||||
capsnap->ctime = inode->i_ctime;
|
||||
capsnap->ctime = inode_get_ctime(inode);
|
||||
capsnap->btime = ci->i_btime;
|
||||
capsnap->change_attr = inode_peek_iversion_raw(inode);
|
||||
capsnap->time_warp_seq = ci->i_time_warp_seq;
|
||||
|
@ -1238,7 +1238,7 @@ retry:
|
||||
dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL,
|
||||
&prealloc_cf);
|
||||
ci->i_xattrs.dirty = true;
|
||||
inode->i_ctime = current_time(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
}
|
||||
|
||||
spin_unlock(&ci->i_ceph_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user