]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
xio: use ceph clock for timestamps
authorCasey Bodley <casey@cohortfs.com>
Fri, 8 May 2015 16:16:20 +0000 (12:16 -0400)
committerVu Pham <vu@mellanox.com>
Thu, 21 May 2015 14:00:12 +0000 (07:00 -0700)
accelio is using rdtsc to generate xio_msg.timestamp, which can't be
reliably converted to a timeval. now uses ceph_clock_now() to assign
the Message::recv_stamp and recv_complete_stamp

Signed-off-by: Casey Bodley <casey@cohortfs.com>
src/msg/xio/XioConnection.cc

index 83784955c012324bc60c1e8bfb36b917c75a2bd0..950ccfd47c1dca266a3eaf4975aa092c28944f12 100644 (file)
@@ -184,8 +184,6 @@ int XioConnection::passive_setup()
   return (0);
 }
 
-#define uint_to_timeval(tv, s) ((tv).tv_sec = (s), (tv).tv_usec = 0)
-
 static inline XioDispatchHook* pool_alloc_xio_dispatch_hook(
   XioConnection *xcon, Message *m, XioInSeq& msg_seq)
 {
@@ -247,7 +245,7 @@ int XioConnection::on_msg_req(struct xio_session *session,
   ceph_msg_footer footer;
   buffer::list payload, middle, data;
 
-  struct timeval t1, t2;
+  const utime_t recv_stamp = ceph_clock_now(msgr->cct);
 
   ldout(msgr->cct,4) << __func__ << " " << "msg_seq.size()="  << msg_seq.size() <<
     dendl;
@@ -258,8 +256,6 @@ int XioConnection::on_msg_req(struct xio_session *session,
                buffer::create_static(treq->in.header.iov_len,
                                      (char*) treq->in.header.iov_base));
 
-  uint_to_timeval(t1, treq->timestamp);
-
   if (magic & (MSG_MAGIC_TRACE_XCON)) {
     if (hdr.hdr->type == 43) {
       print_xio_msg_hdr(msgr->cct, "on_msg_req", hdr, NULL);
@@ -370,8 +366,6 @@ int XioConnection::on_msg_req(struct xio_session *session,
     }
   }
 
-  uint_to_timeval(t2, treq->timestamp);
-
   /* update connection timestamp */
   recv.set(treq->timestamp);
 
@@ -391,8 +385,8 @@ int XioConnection::on_msg_req(struct xio_session *session,
     m->set_magic(magic);
 
     /* update timestamps */
-    m->set_recv_stamp(t1);
-    m->set_recv_complete_stamp(t2);
+    m->set_recv_stamp(recv_stamp);
+    m->set_recv_complete_stamp(ceph_clock_now(msgr->cct));
     m->set_seq(header.seq);
 
     /* MP-SAFE */