diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-07-13 16:18:36 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-08-02 15:26:12 -0400 |
commit | 9bbeab41ce50542624ef381e7852d70f2f39a2b1 (patch) | |
tree | 147627de0ce6b954c2848a93b54ef398a25a1ee0 /fs/ceph/caps.c | |
parent | 63ecae7e439f766e88c91da56955bca4db06802a (diff) |
ceph: use timespec64 for inode timestamp
Since the vfs structures are all using timespec64, we can now
change the internal representation, using ceph_encode_timespec64 and
ceph_decode_timespec64.
In case of ceph_aux_inode however, we need to avoid doing a memcmp()
on uninitialized padding data, so the members of the i_mtime field get
copied individually into 64-bit integers.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 990258cbd836..f50cc008632a 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1125,7 +1125,7 @@ struct cap_msg_args { | |||
1125 | u64 flush_tid, oldest_flush_tid, size, max_size; | 1125 | u64 flush_tid, oldest_flush_tid, size, max_size; |
1126 | u64 xattr_version; | 1126 | u64 xattr_version; |
1127 | struct ceph_buffer *xattr_buf; | 1127 | struct ceph_buffer *xattr_buf; |
1128 | struct timespec atime, mtime, ctime; | 1128 | struct timespec64 atime, mtime, ctime; |
1129 | int op, caps, wanted, dirty; | 1129 | int op, caps, wanted, dirty; |
1130 | u32 seq, issue_seq, mseq, time_warp_seq; | 1130 | u32 seq, issue_seq, mseq, time_warp_seq; |
1131 | u32 flags; | 1131 | u32 flags; |
@@ -1146,7 +1146,7 @@ static int send_cap_msg(struct cap_msg_args *arg) | |||
1146 | struct ceph_msg *msg; | 1146 | struct ceph_msg *msg; |
1147 | void *p; | 1147 | void *p; |
1148 | size_t extra_len; | 1148 | size_t extra_len; |
1149 | struct timespec zerotime = {0}; | 1149 | struct timespec64 zerotime = {0}; |
1150 | struct ceph_osd_client *osdc = &arg->session->s_mdsc->fsc->client->osdc; | 1150 | struct ceph_osd_client *osdc = &arg->session->s_mdsc->fsc->client->osdc; |
1151 | 1151 | ||
1152 | dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s" | 1152 | dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s" |
@@ -1186,9 +1186,9 @@ static int send_cap_msg(struct cap_msg_args *arg) | |||
1186 | 1186 | ||
1187 | fc->size = cpu_to_le64(arg->size); | 1187 | fc->size = cpu_to_le64(arg->size); |
1188 | fc->max_size = cpu_to_le64(arg->max_size); | 1188 | fc->max_size = cpu_to_le64(arg->max_size); |
1189 | ceph_encode_timespec(&fc->mtime, &arg->mtime); | 1189 | ceph_encode_timespec64(&fc->mtime, &arg->mtime); |
1190 | ceph_encode_timespec(&fc->atime, &arg->atime); | 1190 | ceph_encode_timespec64(&fc->atime, &arg->atime); |
1191 | ceph_encode_timespec(&fc->ctime, &arg->ctime); | 1191 | ceph_encode_timespec64(&fc->ctime, &arg->ctime); |
1192 | fc->time_warp_seq = cpu_to_le32(arg->time_warp_seq); | 1192 | fc->time_warp_seq = cpu_to_le32(arg->time_warp_seq); |
1193 | 1193 | ||
1194 | fc->uid = cpu_to_le32(from_kuid(&init_user_ns, arg->uid)); | 1194 | fc->uid = cpu_to_le32(from_kuid(&init_user_ns, arg->uid)); |
@@ -1237,7 +1237,7 @@ static int send_cap_msg(struct cap_msg_args *arg) | |||
1237 | * We just zero these out for now, as the MDS ignores them unless | 1237 | * We just zero these out for now, as the MDS ignores them unless |
1238 | * the requisite feature flags are set (which we don't do yet). | 1238 | * the requisite feature flags are set (which we don't do yet). |
1239 | */ | 1239 | */ |
1240 | ceph_encode_timespec(p, &zerotime); | 1240 | ceph_encode_timespec64(p, &zerotime); |
1241 | p += sizeof(struct ceph_timespec); | 1241 | p += sizeof(struct ceph_timespec); |
1242 | ceph_encode_64(&p, 0); | 1242 | ceph_encode_64(&p, 0); |
1243 | 1243 | ||
@@ -1360,9 +1360,9 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1360 | arg.xattr_buf = NULL; | 1360 | arg.xattr_buf = NULL; |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | arg.mtime = timespec64_to_timespec(inode->i_mtime); | 1363 | arg.mtime = inode->i_mtime; |
1364 | arg.atime = timespec64_to_timespec(inode->i_atime); | 1364 | arg.atime = inode->i_atime; |
1365 | arg.ctime = timespec64_to_timespec(inode->i_ctime); | 1365 | arg.ctime = inode->i_ctime; |
1366 | 1366 | ||
1367 | arg.op = op; | 1367 | arg.op = op; |
1368 | arg.caps = cap->implemented; | 1368 | arg.caps = cap->implemented; |
@@ -3148,11 +3148,11 @@ static void handle_cap_grant(struct inode *inode, | |||
3148 | } | 3148 | } |
3149 | 3149 | ||
3150 | if (newcaps & CEPH_CAP_ANY_RD) { | 3150 | if (newcaps & CEPH_CAP_ANY_RD) { |
3151 | struct timespec mtime, atime, ctime; | 3151 | struct timespec64 mtime, atime, ctime; |
3152 | /* ctime/mtime/atime? */ | 3152 | /* ctime/mtime/atime? */ |
3153 | ceph_decode_timespec(&mtime, &grant->mtime); | 3153 | ceph_decode_timespec64(&mtime, &grant->mtime); |
3154 | ceph_decode_timespec(&atime, &grant->atime); | 3154 | ceph_decode_timespec64(&atime, &grant->atime); |
3155 | ceph_decode_timespec(&ctime, &grant->ctime); | 3155 | ceph_decode_timespec64(&ctime, &grant->ctime); |
3156 | ceph_fill_file_time(inode, extra_info->issued, | 3156 | ceph_fill_file_time(inode, extra_info->issued, |
3157 | le32_to_cpu(grant->time_warp_seq), | 3157 | le32_to_cpu(grant->time_warp_seq), |
3158 | &ctime, &mtime, &atime); | 3158 | &ctime, &mtime, &atime); |