mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
make ceph_timeval nsec, to match linux timespec
This commit is contained in:
parent
3b854bb3be
commit
1dbaebbc75
@ -59,9 +59,9 @@ struct ceph_object {
|
||||
|
||||
#define CEPH_INO_ROOT 1
|
||||
|
||||
struct ceph_timeval {
|
||||
struct ceph_timespec {
|
||||
__le32 tv_sec;
|
||||
__le32 tv_usec;
|
||||
__le32 tv_nsec;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -357,7 +357,7 @@ enum {
|
||||
struct ceph_mds_session_head {
|
||||
__le32 op;
|
||||
__le64 seq;
|
||||
struct ceph_timeval stamp;
|
||||
struct ceph_timespec stamp;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* client_request */
|
||||
@ -407,8 +407,8 @@ struct ceph_mds_request_head {
|
||||
ceph_frag_t frag;
|
||||
} readdir;
|
||||
struct {
|
||||
struct ceph_timeval mtime;
|
||||
struct ceph_timeval atime;
|
||||
struct ceph_timespec mtime;
|
||||
struct ceph_timespec atime;
|
||||
} utime;
|
||||
struct {
|
||||
__u32 mode;
|
||||
@ -453,7 +453,7 @@ struct ceph_frag_tree_head {
|
||||
struct ceph_mds_reply_inode {
|
||||
ceph_ino_t ino;
|
||||
struct ceph_file_layout layout;
|
||||
struct ceph_timeval ctime, mtime, atime;
|
||||
struct ceph_timespec ctime, mtime, atime;
|
||||
__u32 mode, uid, gid;
|
||||
__u32 nlink;
|
||||
__u64 size, max_size;
|
||||
@ -502,7 +502,7 @@ struct ceph_mds_file_caps {
|
||||
__le64 ino;
|
||||
__le64 size, max_size;
|
||||
__le32 migrate_mds, migrate_seq;
|
||||
struct ceph_timeval mtime, atime;
|
||||
struct ceph_timespec mtime, atime;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -522,7 +522,7 @@ struct ceph_mds_cap_reconnect {
|
||||
__le32 wanted;
|
||||
__le32 issued;
|
||||
__le64 size;
|
||||
struct ceph_timeval mtime, atime;
|
||||
struct ceph_timespec mtime, atime;
|
||||
} __attribute__ ((packed));
|
||||
/* followed by encoded string */
|
||||
|
||||
@ -567,7 +567,7 @@ enum {
|
||||
};
|
||||
|
||||
struct ceph_osd_peer_stat {
|
||||
struct ceph_timeval stamp;
|
||||
struct ceph_timespec stamp;
|
||||
float oprate;
|
||||
float qlen;
|
||||
float recent_qlen;
|
||||
|
@ -45,7 +45,7 @@ class utime_t {
|
||||
utime_t() { tv.tv_sec = 0; tv.tv_usec = 0; normalize(); }
|
||||
//utime_t(time_t s) { tv.tv_sec = s; tv.tv_usec = 0; }
|
||||
utime_t(time_t s, int u) { tv.tv_sec = s; tv.tv_usec = u; normalize(); }
|
||||
utime_t(const struct ceph_timeval &v) {
|
||||
utime_t(const struct ceph_timespec &v) {
|
||||
decode_timeval(&v);
|
||||
}
|
||||
utime_t(const struct timeval &v) {
|
||||
@ -78,13 +78,13 @@ class utime_t {
|
||||
tv.tv_usec = v->tv_usec;
|
||||
}
|
||||
|
||||
void encode_timeval(struct ceph_timeval *t) const {
|
||||
void encode_timeval(struct ceph_timespec *t) const {
|
||||
t->tv_sec = cpu_to_le32(tv.tv_sec);
|
||||
t->tv_usec = cpu_to_le32(tv.tv_usec);
|
||||
t->tv_nsec = cpu_to_le32(tv.tv_usec*1000);
|
||||
}
|
||||
void decode_timeval(const struct ceph_timeval *t) {
|
||||
void decode_timeval(const struct ceph_timespec *t) {
|
||||
tv.tv_sec = le32_to_cpu(t->tv_sec);
|
||||
tv.tv_usec = le32_to_cpu(t->tv_usec);
|
||||
tv.tv_usec = le32_to_cpu(t->tv_nsec) / 1000;
|
||||
}
|
||||
void _encode(bufferlist &bl) {
|
||||
::_encode_simple(tv.tv_sec, bl);
|
||||
|
@ -66,19 +66,17 @@
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* struct ceph_timeval <-> struct timespec
|
||||
* struct ceph_timespec <-> struct timespec
|
||||
*/
|
||||
#define ceph_decode_timespec(ts, tv) \
|
||||
do { \
|
||||
(ts)->tv_sec = le32_to_cpu((tv)->tv_sec); \
|
||||
(ts)->tv_nsec = 1000*le32_to_cpu((tv)->tv_usec); \
|
||||
(ts)->tv_nsec = le32_to_cpu((tv)->tv_nsec); \
|
||||
} while (0)
|
||||
#define ceph_encode_timespec(tv, ts, usec) \
|
||||
#define ceph_encode_timespec(tv, ts) \
|
||||
do { \
|
||||
usec = (ts)->tv_nsec; \
|
||||
do_div(usec, 1000); \
|
||||
(tv)->tv_sec = cpu_to_le32((ts)->tv_sec); \
|
||||
(tv)->tv_usec = cpu_to_le32(usec); \
|
||||
(tv)->tv_nsec = cpu_to_le32((ts)->tv_nsec); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -699,7 +699,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
const unsigned int ia_valid = attr->ia_valid;
|
||||
struct ceph_mds_request *req;
|
||||
struct ceph_mds_request_head *reqh;
|
||||
int usectmp, err;
|
||||
int err;
|
||||
|
||||
/* gratuitous debug output */
|
||||
if (ia_valid & ATTR_UID)
|
||||
@ -774,10 +774,8 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
if (IS_ERR(req))
|
||||
return PTR_ERR(req);
|
||||
reqh = req->r_request->front.iov_base;
|
||||
ceph_encode_timespec(&reqh->args.utime.mtime, &attr->ia_mtime,
|
||||
usectmp);
|
||||
ceph_encode_timespec(&reqh->args.utime.atime, &attr->ia_atime,
|
||||
usectmp);
|
||||
ceph_encode_timespec(&reqh->args.utime.mtime, &attr->ia_mtime);
|
||||
ceph_encode_timespec(&reqh->args.utime.atime, &attr->ia_atime);
|
||||
err = ceph_mdsc_do_request(mdsc, req);
|
||||
ceph_mdsc_put_request(req);
|
||||
dout(10, "utime result %d\n", err);
|
||||
|
@ -1027,7 +1027,6 @@ void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
|
||||
struct ceph_inode_cap *cap;
|
||||
char *path;
|
||||
int pathlen, err;
|
||||
int tmp; /* for timespec encoding */
|
||||
struct dentry *dentry;
|
||||
struct ceph_inode_info *ci;
|
||||
struct ceph_mds_cap_reconnect *rec;
|
||||
@ -1092,8 +1091,8 @@ retry:
|
||||
rec->wanted = cpu_to_le32(ceph_caps_wanted(ci));
|
||||
rec->issued = cpu_to_le32(ceph_caps_issued(ci));
|
||||
rec->size = cpu_to_le64(ci->vfs_inode.i_size);
|
||||
ceph_encode_timespec(&rec->mtime, &ci->vfs_inode.i_mtime, tmp);
|
||||
ceph_encode_timespec(&rec->atime, &ci->vfs_inode.i_atime, tmp);
|
||||
ceph_encode_timespec(&rec->mtime, &ci->vfs_inode.i_mtime);
|
||||
ceph_encode_timespec(&rec->atime, &ci->vfs_inode.i_atime);
|
||||
dentry = d_find_alias(&ci->vfs_inode);
|
||||
path = ceph_build_dentry_path(dentry, &pathlen);
|
||||
if (IS_ERR(path)) {
|
||||
@ -1199,7 +1198,8 @@ void check_new_map(struct ceph_mds_client *mdsc,
|
||||
/* caps */
|
||||
|
||||
void send_cap_ack(struct ceph_mds_client *mdsc, __u64 ino, int caps,
|
||||
int wanted, __u32 seq, __u64 size, __u64 max_size, int mds)
|
||||
int wanted, __u32 seq, __u64 size, __u64 max_size,
|
||||
int mds)
|
||||
{
|
||||
struct ceph_mds_file_caps *fc;
|
||||
struct ceph_msg *msg;
|
||||
|
@ -66,7 +66,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
|
||||
ceph_decode_32(p, m->m_epoch);
|
||||
ceph_decode_32(p, m->m_client_epoch);
|
||||
ceph_decode_32(p, m->m_created.tv_sec);
|
||||
ceph_decode_32(p, m->m_created.tv_usec);
|
||||
ceph_decode_32(p, m->m_created.tv_nsec);
|
||||
ceph_decode_32(p, m->m_anchortable);
|
||||
ceph_decode_32(p, m->m_root);
|
||||
ceph_decode_32(p, m->m_cap_bit_timeout);
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
struct ceph_mdsmap {
|
||||
ceph_epoch_t m_epoch, m_client_epoch;
|
||||
struct ceph_timeval m_created;
|
||||
struct ceph_timespec m_created;
|
||||
__u32 m_anchortable;
|
||||
__u32 m_root;
|
||||
__u32 m_cap_bit_timeout;
|
||||
|
@ -314,9 +314,9 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
|
||||
ceph_decode_64(p, map->fsid.minor);
|
||||
ceph_decode_32(p, map->epoch);
|
||||
ceph_decode_32(p, map->ctime.tv_sec);
|
||||
ceph_decode_32(p, map->ctime.tv_usec);
|
||||
ceph_decode_32(p, map->ctime.tv_nsec);
|
||||
ceph_decode_32(p, map->mtime.tv_sec);
|
||||
ceph_decode_32(p, map->mtime.tv_usec);
|
||||
ceph_decode_32(p, map->mtime.tv_nsec);
|
||||
ceph_decode_32(p, map->pg_num);
|
||||
ceph_decode_32(p, map->pgp_num);
|
||||
ceph_decode_32(p, map->lpg_num);
|
||||
@ -389,7 +389,7 @@ struct ceph_osdmap *apply_incremental(void **p, void *end,
|
||||
struct crush_map *newcrush = 0;
|
||||
struct ceph_fsid fsid;
|
||||
__u32 epoch;
|
||||
struct ceph_timeval ctime;
|
||||
struct ceph_timespec ctime;
|
||||
__u32 len;
|
||||
__u32 max;
|
||||
int err = -EINVAL;
|
||||
@ -400,7 +400,7 @@ struct ceph_osdmap *apply_incremental(void **p, void *end,
|
||||
ceph_decode_32(p, epoch);
|
||||
BUG_ON(epoch != map->epoch+1);
|
||||
ceph_decode_32(p, ctime.tv_sec);
|
||||
ceph_decode_32(p, ctime.tv_usec);
|
||||
ceph_decode_32(p, ctime.tv_nsec);
|
||||
|
||||
/* full map? */
|
||||
ceph_decode_32(p, len);
|
||||
|
@ -9,7 +9,7 @@ struct ceph_osdmap {
|
||||
struct ceph_fsid fsid;
|
||||
ceph_epoch_t epoch;
|
||||
ceph_epoch_t mkfs_epoch;
|
||||
struct ceph_timeval ctime, mtime;
|
||||
struct ceph_timespec ctime, mtime;
|
||||
|
||||
__u32 pg_num, pg_num_mask;
|
||||
__u32 pgp_num, pgp_num_mask;
|
||||
|
Loading…
Reference in New Issue
Block a user