]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
g_clock.now -> ceph_clock_now
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 14 Jun 2011 21:14:15 +0000 (14:14 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 20 Jun 2011 23:34:17 +0000 (16:34 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
76 files changed:
src/auth/Crypto.cc
src/auth/cephx/CephxKeyServer.cc
src/auth/cephx/CephxProtocol.cc
src/auth/cephx/CephxServiceHandler.cc
src/client/Client.cc
src/client/Client.h
src/client/SyntheticClient.cc
src/client/SyntheticClient.h
src/common/Clock.cc
src/common/Clock.h
src/common/Cond.h
src/common/DecayCounter.h
src/common/LogClient.cc
src/common/ProfLogger.cc
src/common/Timer.cc
src/common/config.cc
src/include/utime.h
src/librados.cc
src/mds/CDentry.cc
src/mds/CDir.cc
src/mds/CInode.cc
src/mds/CInode.h
src/mds/Dumper.cc
src/mds/Locker.cc
src/mds/MDBalancer.cc
src/mds/MDCache.cc
src/mds/MDLog.cc
src/mds/MDS.cc
src/mds/MDSTable.cc
src/mds/Migrator.cc
src/mds/Server.cc
src/mds/SessionMap.cc
src/mds/SessionMap.h
src/mds/mdstypes.h
src/messages/MMonPaxos.h
src/mon/Elector.cc
src/mon/LogMonitor.cc
src/mon/MDSMonitor.cc
src/mon/MonClient.cc
src/mon/MonMap.h
src/mon/Monitor.cc
src/mon/MonmapMonitor.cc
src/mon/OSDMonitor.cc
src/mon/PGMonitor.cc
src/mon/Paxos.cc
src/mon/PaxosService.cc
src/msg/Dispatcher.h
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h
src/os/FileJournal.cc
src/os/FileStore.cc
src/osd/Ager.cc
src/osd/OSD.cc
src/osd/OSD.h
src/osd/OSDMap.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osdc/Journaler.cc
src/osdc/ObjectCacher.cc
src/osdc/ObjectCacher.h
src/osdc/Objecter.cc
src/osdc/rados_bencher.h
src/rgw/rgw_log.cc
src/rgw/rgw_op.cc
src/rgw/rgw_os_auth.cc
src/streamtest.cc
src/test/TestTimers.cc
src/test/old/test_disk_bw.cc
src/test/old/test_seek_read.c
src/test/old/test_short_seek_read.c
src/test/old/testcounter.cc
src/testcrypto.cc
src/testkeys.cc
src/tools/common.cc
src/tools/gui.cc

index dd678c879b798ea346290a4109d5540d02fcc408..9ab83419533e00f007b5e290913764a3fe39a1f2 100644 (file)
@@ -341,7 +341,7 @@ CryptoHandler *get_crypto_handler(int type)
 int CryptoKey::set_secret(int type, bufferptr& s)
 {
   this->type = type;
-  created = g_clock.now();
+  created = ceph_clock_now(&g_ceph_context);
 
   CryptoHandler *h = get_crypto_handler(type);
   if (!h)
@@ -359,7 +359,7 @@ int CryptoKey::set_secret(int type, bufferptr& s)
 int CryptoKey::create(int t)
 {
   type = t;
-  created = g_clock.now();
+  created = ceph_clock_now(&g_ceph_context);
 
   CryptoHandler *h = get_crypto_handler(type);
   if (!h)
index c034feb7661bac9167e359a877a86664326289ae..ea7fa330cc6963d70829deeb3ac32f2f3f39d985 100644 (file)
@@ -41,7 +41,7 @@ bool KeyServerData::get_service_secret(uint32_t service_id,
   if (secrets.secrets.size() > 1)
     ++riter;
 
-  if (riter->second.expiration < g_clock.now())
+  if (riter->second.expiration < ceph_clock_now(&g_ceph_context))
     ++riter;   // "current" key has expired, use "next" key instead
 
   secret_id = riter->first;
@@ -155,7 +155,7 @@ bool KeyServer::_check_rotating_secrets()
 
   if (added) {
     data.rotating_ver++;
-    //data.next_rotating_time = g_clock.now();
+    //data.next_rotating_time = ceph_clock_now(&g_ceph_context);
     //data.next_rotating_time += MIN(g_conf->auth_mon_ticket_ttl, g_conf->auth_service_ticket_ttl);
     _dump_rotating_secrets();
     return true;
@@ -184,7 +184,7 @@ int KeyServer::_rotate_secret(uint32_t service_id)
 {
   RotatingSecrets& r = data.rotating_secrets[service_id];
   int added = 0;
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   double ttl = service_id == CEPH_ENTITY_TYPE_AUTH ? g_conf->auth_mon_ticket_ttl : g_conf->auth_service_ticket_ttl;
 
   while (r.need_new_secrets(now)) {
@@ -380,7 +380,7 @@ int KeyServer::_build_session_auth_info(uint32_t service_id, CephXServiceTicketI
 {
   info.service_id = service_id;
   info.ticket = auth_ticket_info.ticket;
-  info.ticket.init_timestamps(g_clock.now(), g_conf->auth_service_ticket_ttl);
+  info.ticket.init_timestamps(ceph_clock_now(&g_ceph_context), g_conf->auth_service_ticket_ttl);
 
   generate_secret(info.session_key);
 
index 92e1c4db7f4a2f2a910b91d5fa6b900c9cca6d34..97cc30f59f81d41bf063f63b37bc56f735b73abf 100644 (file)
@@ -160,7 +160,7 @@ bool CephXTicketHandler::verify_service_ticket_reply(CryptoKey& secret,
            << " validity=" << msg_a.validity << dendl;
   session_key = msg_a.session_key;
   if (!msg_a.validity.is_zero()) {
-    expires = g_clock.now();
+    expires = ceph_clock_now(cct);
     expires += msg_a.validity;
     renew_after = expires;
     renew_after -= ((double)msg_a.validity.sec() / 4);
@@ -174,8 +174,7 @@ bool CephXTicketHandler::verify_service_ticket_reply(CryptoKey& secret,
 bool CephXTicketHandler::have_key()
 {
   if (have_key_flag) {
-    //dout(20) << "have_key: g_clock.now()=" << g_clock.now() << " renew_after=" << renew_after << " expires=" << expires << dendl;
-    have_key_flag = g_clock.now() < expires;
+    have_key_flag = ceph_clock_now(cct) < expires;
   }
 
   return have_key_flag;
@@ -184,8 +183,7 @@ bool CephXTicketHandler::have_key()
 bool CephXTicketHandler::need_key()
 {
   if (have_key_flag) {
-    //dout(20) << "need_key: g_clock.now()=" << g_clock.now() << " renew_after=" << renew_after << " expires=" << expires << dendl;
-    return (!expires.is_zero()) && (g_clock.now() >= renew_after);
+    return (!expires.is_zero()) && (ceph_clock_now(cct) >= renew_after);
   }
 
   return true;
index 08035a34bf085f3dbdc3f5d4615fe219e5192b40..7ee707ada0a312edd345378a151bc5c471053c24 100644 (file)
@@ -95,14 +95,14 @@ int CephxServiceHandler::handle_request(bufferlist::iterator& indata, bufferlist
       }
       CephXServiceTicketInfo old_ticket_info;
 
-      if (cephx_decode_ticket(&g_ceph_context, key_server, CEPH_ENTITY_TYPE_AUTH,
+      if (cephx_decode_ticket(cct, key_server, CEPH_ENTITY_TYPE_AUTH,
                              req.old_ticket, old_ticket_info)) {
         global_id = old_ticket_info.ticket.global_id;
         ldout(cct, 10) << "decoded old_ticket with global_id=" << global_id << dendl;
         should_enc_ticket = true;
       }
 
-      info.ticket.init_timestamps(g_clock.now(), cct->_conf->auth_mon_ticket_ttl);
+      info.ticket.init_timestamps(ceph_clock_now(cct), cct->_conf->auth_mon_ticket_ttl);
       info.ticket.name = entity_name;
       info.ticket.global_id = global_id;
       info.ticket.auid = eauth.auid;
@@ -141,7 +141,7 @@ int CephxServiceHandler::handle_request(bufferlist::iterator& indata, bufferlist
 
       bufferlist tmp_bl;
       CephXServiceTicketInfo auth_ticket_info;
-      if (!cephx_verify_authorizer(&g_ceph_context, key_server, indata, auth_ticket_info, tmp_bl)) {
+      if (!cephx_verify_authorizer(cct, key_server, indata, auth_ticket_info, tmp_bl)) {
         ret = -EPERM;
        break;
       }
index b521d4eecc9fbe14cd0070e43103548384b40b96..36f4c6a5acae34b4aa8024767f14271227ae2ace 100644 (file)
@@ -961,7 +961,7 @@ int Client::make_request(MetaRequest *request,
                         bufferlist *pdirbl)
 {
   // time the call
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
   
   bool nojournal = false;
   int op = request->get_op();
@@ -1066,7 +1066,7 @@ int Client::make_request(MetaRequest *request,
   
   // -- log times --
   if (client_logger) {
-    utime_t lat = g_clock.now();
+    utime_t lat = ceph_clock_now(&g_ceph_context);
     lat -= request->sent_stamp;
     dout(20) << "lat " << lat << dendl;
     client_logger->favg(l_c_lat,(double)lat);
@@ -1249,7 +1249,7 @@ void Client::send_request(MetaRequest *request, int mds)
   r->releases = request->cap_releases;
 
   if (request->mds == -1) {
-    request->sent_stamp = g_clock.now();
+    request->sent_stamp = ceph_clock_now(&g_ceph_context);
     dout(20) << "send_request set sent_stamp to " << request->sent_stamp << dendl;
   }
   request->mds = mds;
@@ -1691,7 +1691,7 @@ void Client::handle_lease(MClientLease *m)
 
 void Client::release_lease(Inode *in, Dentry *dn, int mask)
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   assert(dn);
 
@@ -1846,7 +1846,7 @@ int Client::get_caps(Inode *in, int need, int want, int *got, loff_t endoff)
 void Client::cap_delay_requeue(Inode *in)
 {
   dout(10) << "cap_delay_requeue on " << *in << dendl;
-  in->hold_caps_until = g_clock.now();
+  in->hold_caps_until = ceph_clock_now(&g_ceph_context);
   in->hold_caps_until += 5.0;
 
   delayed_caps.push_back(&in->cap_item);
@@ -1956,7 +1956,7 @@ void Client::check_caps(Inode *in, bool is_delayed)
   else
     in->hold_caps_until = utime_t();
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   map<int,InodeCap*>::iterator it = in->caps.begin();
   while (it != in->caps.end()) {
@@ -3190,7 +3190,7 @@ void Client::tick()
   tick_event = new C_C_Tick(this);
   timer.add_event_after(g_conf->client_tick_interval, tick_event);
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   if (mdsmap->get_epoch()) {
     // renew caps?
@@ -3226,7 +3226,7 @@ void Client::tick()
 void Client::renew_caps()
 {
   dout(10) << "renew_caps()" << dendl;
-  last_cap_renew = g_clock.now();
+  last_cap_renew = ceph_clock_now(&g_ceph_context);
   
   for (map<int,MDSSession*>::iterator p = mds_sessions.begin();
        p != mds_sessions.end();
@@ -3240,7 +3240,7 @@ void Client::renew_caps()
 void Client::renew_caps(const int mds) {
   dout(10) << "renew_caps mds" << mds << dendl;
   MDSSession *session = mds_sessions[mds];
-  session->last_cap_renew_request = g_clock.now();
+  session->last_cap_renew_request = ceph_clock_now(&g_ceph_context);
   uint64_t seq = ++session->cap_renew_seq;
   messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_RENEWCAPS, seq),
                          mdsmap->get_inst(mds));
@@ -3310,7 +3310,7 @@ int Client::_lookup(Inode *dir, const string& dname, Inode **target)
             << dendl;
 
     // is dn lease valid?
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if (dn->lease_mds >= 0 && 
        dn->lease_ttl > now &&
        mds_sessions.count(dn->lease_mds)) {
@@ -3357,7 +3357,7 @@ int Client::get_or_create(Inode *dir, const char* name,
     Dentry *dn = *pdn = dir->dir->dentries[name];
     
     // is dn lease valid?
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if (dn->inode &&
        dn->lease_mds >= 0 && 
        dn->lease_ttl > now &&
@@ -3673,7 +3673,7 @@ int Client::_setattr(Inode *in, struct stat *attr, int mask, int uid, int gid)
 
   if (!mask) {
     // caller just needs us to bump the ctime
-    in->ctime = g_clock.now();
+    in->ctime = ceph_clock_now(&g_ceph_context);
     if (issued & CEPH_CAP_AUTH_EXCL)
       mark_caps_dirty(in, CEPH_CAP_AUTH_EXCL);
     else if (issued & CEPH_CAP_FILE_EXCL)
@@ -3686,19 +3686,19 @@ int Client::_setattr(Inode *in, struct stat *attr, int mask, int uid, int gid)
 
   if (in->caps_issued_mask(CEPH_CAP_AUTH_EXCL)) {
     if (mask & CEPH_SETATTR_MODE) {
-      in->ctime = g_clock.now();
+      in->ctime = ceph_clock_now(&g_ceph_context);
       in->mode = (in->mode & ~07777) | (attr->st_mode & 07777);
       mark_caps_dirty(in, CEPH_CAP_AUTH_EXCL);
       mask &= ~CEPH_SETATTR_MODE;
     }
     if (mask & CEPH_SETATTR_UID) {
-      in->ctime = g_clock.now();
+      in->ctime = ceph_clock_now(&g_ceph_context);
       in->uid = attr->st_uid;
       mark_caps_dirty(in, CEPH_CAP_AUTH_EXCL);
       mask &= ~CEPH_SETATTR_UID;
     }
     if (mask & CEPH_SETATTR_GID) {
-      in->ctime = g_clock.now();
+      in->ctime = ceph_clock_now(&g_ceph_context);
       in->gid = attr->st_gid;
       mark_caps_dirty(in, CEPH_CAP_AUTH_EXCL);
       mask &= ~CEPH_SETATTR_GID;
@@ -3710,7 +3710,7 @@ int Client::_setattr(Inode *in, struct stat *attr, int mask, int uid, int gid)
        in->mtime = utime_t(attr->st_mtim.tv_sec, attr->st_mtim.tv_nsec);
       if (mask & CEPH_SETATTR_ATIME)
        in->atime = utime_t(attr->st_atim.tv_sec, attr->st_atim.tv_nsec);
-      in->ctime = g_clock.now();
+      in->ctime = ceph_clock_now(&g_ceph_context);
       in->time_warp_seq++;
       mark_caps_dirty(in, CEPH_CAP_FILE_EXCL);
       mask &= ~(CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME);
@@ -5055,7 +5055,7 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
   dout(10) << "cur file size is " << in->size << dendl;
 
   // time it.
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
     
   // copy into fresh buffer (since our write may be resub, async)
   bufferptr bp;
@@ -5083,14 +5083,14 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
     
     // async, caching, non-blocking.
     objectcacher->file_write(&in->oset, &in->layout, in->snaprealm->get_snap_context(),
-                            offset, size, bl, g_clock.now(), 0);
+                            offset, size, bl, ceph_clock_now(&g_ceph_context), 0);
 
     put_cap_ref(in, CEPH_CAP_FILE_BUFFER);
   } else {
     /*
       // atomic, synchronous, blocking.
       objectcacher->file_atomic_sync_write(in->ino, &in->layout, in->snaprealm->get_snap_context(),
-                                          offset, size, bl, g_clock.now(), 0, client_lock);
+                                          offset, size, bl, ceph_clock_now(&g_ceph_context), 0, client_lock);
     */
     // simple, non-atomic sync write
     Mutex flock("Client::_write flock");
@@ -5103,7 +5103,7 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
     get_cap_ref(in, CEPH_CAP_FILE_BUFFER);  // released by onsafe callback
     
     filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(),
-                      offset, size, bl, g_clock.now(), filer_flags,
+                      offset, size, bl, ceph_clock_now(&g_ceph_context), filer_flags,
                       in->truncate_size, in->truncate_seq,
                       onfinish, onsafe);
     
@@ -5112,7 +5112,7 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
   }
 
   // time
-  utime_t lat = g_clock.now();
+  utime_t lat = ceph_clock_now(&g_ceph_context);
   lat -= start;
   if (client_logger)
     client_logger->favg(l_c_wrlat,(double)lat);
@@ -5135,7 +5135,7 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
   }
 
   // mtime
-  in->mtime = g_clock.now();
+  in->mtime = ceph_clock_now(&g_ceph_context);
   mark_caps_dirty(in, CEPH_CAP_FILE_WR);
 
   put_cap_ref(in, CEPH_CAP_FILE_WR);
@@ -5474,7 +5474,7 @@ int Client::ll_lookup(vinodeno_t parent, const char *name, struct stat *attr, in
   Inode *diri = 0;
   Inode *in = 0;
   int r = 0;
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   if (inode_map.count(parent) == 0) {
     dout(1) << "ll_lookup " << parent << " " << name << " -> ENOENT (parent DNE... WTF)" << dendl;
index 11db91ded17ee2b7d7be0484492e34b96fbdaa7a..ff5c0557a6eb8f970c4f4220d26e57ba26a976bf 100644 (file)
@@ -559,9 +559,9 @@ class Inode {
     /*cout << "cap_gen     " << cap->session-> cap_gen << std::endl
         << "session gen " << cap->gen << std::endl
         << "cap expire  " << cap->session->cap_ttl << std::endl
-        << "cur time    " << g_clock.now() << std::endl;*/
+        << "cur time    " << ceph_clock_now(&g_ceph_context) << std::endl;*/
     if ((cap->session->cap_gen <= cap->gen)
-       && (g_clock.now() < cap->session->cap_ttl)) {
+       && (ceph_clock_now(&g_ceph_context) < cap->session->cap_ttl)) {
       return true;
     }
     //if we make it here, the capabilities aren't up-to-date
index 540b226c990951b559becaad8fe2c79802e15681..f05342f0952e68ae0821446193a70a95c2a9837f 100644 (file)
@@ -283,7 +283,7 @@ SyntheticClient::SyntheticClient(Client *client, int w)
   this->iargs = syn_iargs;
   this->sargs = syn_sargs;
 
-  run_start = g_clock.now();
+  run_start = ceph_clock_now(&g_ceph_context);
 }
 
 
@@ -327,7 +327,7 @@ int SyntheticClient::run()
     return -1;
   }
 
-  //run_start = g_clock.now();
+  //run_start = ceph_clock_now(&g_ceph_context);
   run_until = utime_t(0,0);
   dout(5) << "run" << dendl;
 
@@ -437,7 +437,7 @@ int SyntheticClient::run()
         iargs.pop_front();
         if (iarg1 && run_me()) {
           dout(2) << "sleepuntil " << iarg1 << dendl;
-          utime_t at = g_clock.now() - run_start;
+          utime_t at = ceph_clock_now(&g_ceph_context) - run_start;
           if (at.sec() < iarg1) 
             sleep(iarg1 - at.sec());
         }
@@ -791,14 +791,14 @@ int SyntheticClient::run()
          if (iarg1 == 0) iarg1 = 1; // play trace at least once!
 
           for (int i=0; i<iarg1; i++) {
-            utime_t start = g_clock.now();
+            utime_t start = ceph_clock_now(&g_ceph_context);
             
             if (time_to_stop()) break;
             play_trace(t, prefix, !playdata);
             if (time_to_stop()) break;
             if (iarg1 > 1) clean_dir(prefix);  // clean only if repeat
             
-            utime_t lat = g_clock.now();
+            utime_t lat = ceph_clock_now(&g_ceph_context);
             lat -= start;
             
             dout(0) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << dendl;
@@ -1006,7 +1006,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
   char buf[1024];
   char buf2[1024];
 
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
 
   hash_map<int64_t, int64_t> open_files;
   hash_map<int64_t, dir_result_t*>    open_dirs;
@@ -1430,7 +1430,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
       bufferlist bl;
       bl.push_back(bp);
       SnapContext snapc;
-      client->objecter->write(oid, oloc, off, len, snapc, bl, g_clock.now(), 0,
+      client->objecter->write(oid, oloc, off, len, snapc, bl, ceph_clock_now(&g_ceph_context), 0,
                              new C_SafeCond(&lock, &cond, &ack),
                              safeg->new_sub());
       while (!ack) cond.Wait(lock);
@@ -1445,7 +1445,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
       object_locator_t oloc(CEPH_DATA_RULE);
       lock.Lock();
       SnapContext snapc;
-      client->objecter->zero(oid, oloc, off, len, snapc, g_clock.now(), 0,
+      client->objecter->zero(oid, oloc, off, len, snapc, ceph_clock_now(&g_ceph_context), 0,
                             new C_SafeCond(&lock, &cond, &ack),
                             safeg->new_sub());
       while (!ack) cond.Wait(lock);
@@ -1756,9 +1756,9 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep
   dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
 
   list<string> contents;
-  utime_t s = g_clock.now();
+  utime_t s = ceph_clock_now(&g_ceph_context);
   int r = client->getdir(basedir, contents);
-  utime_t e = g_clock.now();
+  utime_t e = ceph_clock_now(&g_ceph_context);
   e -= s;
   if (r < 0) {
     dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << dendl;
@@ -1767,12 +1767,12 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep
 
   for (int i=0; i<files; i++) {
     snprintf(d, sizeof(d), "%s/file.%d", basedir, i);
-    utime_t s = g_clock.now();
+    utime_t s = ceph_clock_now(&g_ceph_context);
     if (client->lstat(d, &st) < 0) {
       dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
       return -1;
     }
-    utime_t e = g_clock.now();
+    utime_t e = ceph_clock_now(&g_ceph_context);
     e -= s;
   }
 
@@ -1810,7 +1810,7 @@ int SyntheticClient::make_files(int num, int count, int priv, bool more)
   
   // files
   struct stat st;
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
   for (int c=0; c<count; c++) {
     for (int n=0; n<num; n++) {
       snprintf(d, sizeof(d), "dir.%d.run%d/file.client%d.%d", priv ? whoami:0, c, whoami, n);
@@ -1827,7 +1827,7 @@ int SyntheticClient::make_files(int num, int count, int priv, bool more)
       if (time_to_stop()) return 0;
     }
   }
-  utime_t end = g_clock.now();
+  utime_t end = ceph_clock_now(&g_ceph_context);
   end -= start;
   dout(0) << "makefiles time is " << end << " or " << ((double)end / (double)num) <<" per file" << dendl;
   
@@ -1845,24 +1845,24 @@ int SyntheticClient::link_test()
   client->mkdir("orig", 0755);
   client->mkdir("copy", 0755);
 
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
   for (int i=0; i<num; i++) {
     snprintf(d, sizeof(d), "orig/file.%d", i);
     client->mknod(d, 0755);
   }
-  utime_t end = g_clock.now();
+  utime_t end = ceph_clock_now(&g_ceph_context);
   end -= start;
 
   dout(0) << "orig " << end << dendl;
 
   // link
-  start = g_clock.now();
+  start = ceph_clock_now(&g_ceph_context);
   for (int i=0; i<num; i++) {
     snprintf(d, sizeof(d), "orig/file.%d", i);
     snprintf(e, sizeof(e), "copy/file.%d", i);
     client->link(d, e);
   }
-  end = g_clock.now();
+  end = ceph_clock_now(&g_ceph_context);
   end -= start;
   dout(0) << "copy " << end << dendl;
 
@@ -1973,7 +1973,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize)   // size i
   dout(5) << "writing to " << fn << " fd " << fd << dendl;
   if (fd < 0) return fd;
   
-  utime_t from = g_clock.now();
+  utime_t from = ceph_clock_now(&g_ceph_context);
   utime_t start = from;
   uint64_t bytes = 0, total = 0;
 
@@ -2001,7 +2001,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize)   // size i
     bytes += wrsize;
     total += wrsize;
 
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if (now - from >= 1.0) {
       double el = now - from;
       dout(0) << "write " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
@@ -2012,7 +2012,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize)   // size i
 
   client->fsync(fd, true);
   
-  utime_t stop = g_clock.now();
+  utime_t stop = ceph_clock_now(&g_ceph_context);
   double el = stop - start;
   dout(0) << "write total " << (total / el / 1048576.0) << " MB/sec ("
          << total << " bytes in " << el << " seconds)" << dendl;
@@ -2083,7 +2083,7 @@ int SyntheticClient::read_file(const std::string& fn, int size,
   dout(5) << "reading from " << fn << " fd " << fd << dendl;
   if (fd < 0) return fd;
 
-  utime_t from = g_clock.now();
+  utime_t from = ceph_clock_now(&g_ceph_context);
   utime_t start = from;
   uint64_t bytes = 0, total = 0;
 
@@ -2099,7 +2099,7 @@ int SyntheticClient::read_file(const std::string& fn, int size,
     bytes += rdsize;
     total += rdsize;
 
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if (now - from >= 1.0) {
       double el = now - from;
       dout(0) << "read " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
@@ -2131,7 +2131,7 @@ int SyntheticClient::read_file(const std::string& fn, int size,
       dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
   }
 
-  utime_t stop = g_clock.now();
+  utime_t stop = ceph_clock_now(&g_ceph_context);
   double el = stop - start;
   dout(0) << "read total " << (total / el / 1048576.0) << " MB/sec ("
          << total << " bytes in " << el << " seconds)" << dendl;
@@ -2211,9 +2211,9 @@ int SyntheticClient::create_objects(int nobj, int osize, int inflight)
     }
     dout(10) << "writing " << oid << dendl;
     
-    starts.push_back(g_clock.now());
+    starts.push_back(ceph_clock_now(&g_ceph_context));
     client->client_lock.Lock();
-    client->objecter->write(oid, oloc, 0, osize, snapc, bl, g_clock.now(), 0,
+    client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(&g_ceph_context), 0,
                            new C_Ref(lock, cond, &unack),
                            new C_Ref(lock, cond, &unsafe));
     client->client_lock.Unlock();
@@ -2225,7 +2225,7 @@ int SyntheticClient::create_objects(int nobj, int osize, int inflight)
     }
     lock.Unlock();
     
-    utime_t lat = g_clock.now();
+    utime_t lat = ceph_clock_now(&g_ceph_context);
     lat -= starts.front();
     starts.pop_front();
   }
@@ -2308,7 +2308,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc,
     SnapContext snapc;
     
     client->client_lock.Lock();
-    utime_t start = g_clock.now();
+    utime_t start = ceph_clock_now(&g_ceph_context);
     if (write) {
       dout(10) << "write to " << oid << dendl;
 
@@ -2324,7 +2324,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc,
         op.op.op = CEPH_OSD_OP_STARTSYNC;
        m.ops.push_back(op);
       }
-      client->objecter->mutate(oid, oloc, m, snapc, g_clock.now(), 0,
+      client->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(&g_ceph_context), 0,
                               NULL, new C_Ref(lock, cond, &unack));
       /*client->objecter->write(oid, layout, 0, osize, snapc, bl, 0,
                              new C_Ref(lock, cond, &unack),
@@ -2344,7 +2344,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc,
     }
     lock.Unlock();
 
-    utime_t lat = g_clock.now();
+    utime_t lat = ceph_clock_now(&g_ceph_context);
     lat -= start;
     if (client_logger) {
       if (write) 
index e3fcc136bebe2a15924b42c435f7c23dbc56d628..09f739596e02940cec46b888342bf4514e90fbf8 100644 (file)
@@ -205,7 +205,7 @@ class SyntheticClient {
   }
 
   bool time_to_stop() {
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if (0) cout << "time_to_stop .. now " << now 
                << " until " << run_until 
                << " start " << run_start 
index b303303852067b3f323a4e2a93c4c00ec13eafec..cb59044e96cc863ab28debc97f16a0da355c18a3 100644 (file)
@@ -13,8 +13,9 @@
  */
 
 
-#include "common/config.h"
 #include "common/Clock.h"
+#include "common/config.h"
+#include "include/utime.h"
 
 #include <time.h>
 
@@ -33,33 +34,3 @@ time_t ceph_clock_gettime(CephContext *cct)
   ret += ((time_t)cct->_conf->clock_offset);
   return ret;
 }
-
-// old global clock stuff
-// TODO: remove
-Clock g_clock;
-
-Clock::Clock() {
-}
-
-Clock::~Clock() {
-}
-
-void Clock::make_timespec(utime_t& t, struct timespec *ts) {
-  utime_t time = t;
-
-  memset(ts, 0, sizeof(*ts));
-  ts->tv_sec = time.sec();
-  ts->tv_nsec = time.nsec();
-}
-
-utime_t Clock::now() {
-  struct timeval tv;
-  gettimeofday(&tv, NULL);
-  utime_t n(&tv);
-  n += g_conf->clock_offset;
-  return n;
-}
-
-time_t Clock::gettime() {
-  return now().sec();
-}
index 92054490ce18dea9ccfbbffe30562e1ad70adfa3..bdcb0d1553014942647acb1a1be8b8e04e98e43b 100644 (file)
 
 #include <time.h>
 
-struct timespec;
-struct utime_t;
+class CephContext;
 
 extern utime_t ceph_clock_now(CephContext *cct);
 extern time_t ceph_clock_gettime(CephContext *cct);
 
-class Clock {
- public:
-  Clock();
-  ~Clock();
-
-  utime_t now();
-  void make_timespec(utime_t& t, struct timespec *ts);
-  time_t gettime();
-};
-
-extern Clock g_clock;
-
 #endif
index f20d3407e7667b924444dea352a9dea3abea0538..2990525c653e169111f41c7d0e4d05bf5f2996d5 100644 (file)
@@ -55,13 +55,12 @@ class Cond {
 
   int WaitUntil(Mutex &mutex, utime_t when) {
     struct timespec ts;
-    g_clock.make_timespec(when, &ts);
-    //cout << "timedwait for " << ts.tv_sec << " sec " << ts.tv_nsec << " nsec" << endl;
+    when.to_timespec(&ts);
     int r = pthread_cond_timedwait(&_c, &mutex._m, &ts);
     return r;
   }
-  int WaitInterval(Mutex &mutex, utime_t interval) {
-    utime_t when = g_clock.now();
+  int WaitInterval(CephContext *cct, Mutex &mutex, utime_t interval) {
+    utime_t when = ceph_clock_now(cct);
     when += interval;
     return WaitUntil(mutex, when);
   }
index 0f20fb884b7c467c771f65234a89c32f3762ad58..9c32df4654a113e69080749a4e20c51718c6c9a2 100644 (file)
@@ -128,10 +128,10 @@ public:
    */
 
   void reset() {
-    reset(g_clock.now());
+    reset(ceph_clock_now(&g_ceph_context));
   }
   void reset(utime_t now) {
-    last_decay = g_clock.now();
+    last_decay = ceph_clock_now(&g_ceph_context);
     val = delta = 0;
   }
   
index eabd5a14a27f074b923698bb4403c531fdeb4819..ac7753ec7eb1949d55fc42b172a455eb9eb6e89a 100644 (file)
@@ -101,7 +101,7 @@ void LogClient::do_log(clog_type type, const std::string& s)
   dout(0) << "log " << type << " : " << s << dendl;
   LogEntry e;
   e.who = messenger->get_myinst();
-  e.stamp = g_clock.now();
+  e.stamp = ceph_clock_now(cct);
   e.seq = ++last_log;
   e.type = type;
   e.msg = s;
index 30e8fc71d798388114266da34dbcf66a9a991eba..918f45d7a89558006c37e8b73bb66fcceb2efe56 100644 (file)
@@ -108,7 +108,7 @@ void logger_tare(utime_t s)
 
   start = s;
 
-  utime_t fromstart = g_clock.now();
+  utime_t fromstart = ceph_clock_now(&g_ceph_context);
   if (fromstart < start) {
     derr << "logger_tare time jumped backwards from "
         << start << " to " << fromstart << dendl;
@@ -124,7 +124,7 @@ void logger_add(ProfLogger *logger)
 
   if (logger_list.empty()) {
     if (start == utime_t())
-      start = g_clock.now();
+      start = ceph_clock_now(&g_ceph_context);
     last_flush = 0;
   }
   logger_list.push_back(logger);
@@ -151,7 +151,7 @@ static void flush_all_loggers()
   if (!g_conf->profiling_logger)
     return;
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t fromstart = now;
   if (fromstart < start) {
     derr << "logger time jumped backwards from " << start << " to "
index 01ee16379ddb394ab3db18c1fb7ad3e0771c8c23..98c1939697fc20fe7a2fcdba6fe0598da6c4908d 100644 (file)
@@ -85,7 +85,7 @@ void SafeTimer::timer_thread()
   lock.Lock();
   dout(10) << "timer_thread starting" << dendl;
   while (!stopping) {
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     
     while (!schedule.empty()) {
       scheduled_map_t::iterator p = schedule.begin();
@@ -118,7 +118,7 @@ void SafeTimer::add_event_after(double seconds, Context *callback)
 {
   assert(lock.is_locked());
 
-  utime_t when = g_clock.now();
+  utime_t when = ceph_clock_now(&g_ceph_context);
   when += seconds;
   add_event_at(when, callback);
 }
index 2ea00635b420c42b742ea579f9657a3e913d2de0..59c4989bc1bebbd48caf64f424411ca7f97c5665 100644 (file)
@@ -209,7 +209,7 @@ struct config_option config_optionsp[] = {
   OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0),  // gather updates for this long before proposing a map update
   OPTION(paxos_min_wait, OPT_DOUBLE, 0.05),  // min time to gather updates for after period of inactivity
   OPTION(paxos_observer_timeout, OPT_DOUBLE, 5*60), // gather updates for this long before proposing a map update
-  OPTION(clock_offset, OPT_DOUBLE, 0), // how much to offset the system clock by with g_clock
+  OPTION(clock_offset, OPT_DOUBLE, 0), // how much to offset the system clock in Clock.cc
   OPTION(auth_supported, OPT_STR, "none"),
   OPTION(auth_mon_ticket_ttl, OPT_DOUBLE, 60*60*12),
   OPTION(auth_service_ticket_ttl, OPT_DOUBLE, 60*60),
index 87606fb8fbf0bd584cda4e74451b382dd2489e85..8df9ef4487261d0c048f8ec0c172d74f8c8ddb19 100644 (file)
@@ -54,7 +54,10 @@ public:
   utime_t(const struct timeval *v) {
     set_from_timeval(v);
   }
-
+  void to_timespec(struct timespec *ts) const {
+    ts->tv_sec = tv.tv_sec;
+    ts->tv_nsec = tv.tv_nsec;
+  }
   void set_from_double(double d) { 
     tv.tv_sec = (__u32)trunc(d);
     tv.tv_nsec = (__u32)((d - (double)tv.tv_sec) * (double)1000000000.0);
index c53936a922d16d0e124f0865dc75a1f64023b46a..88176bd3691d27ed97e977fb23500e125a2fdffa 100644 (file)
@@ -1098,7 +1098,7 @@ selfmanaged_snap_rollback_object(rados_ioctx_t io,
 
   lock.Lock();
   objecter->rollback_object(oid, ctx->oloc, snapc, snapid,
-                    g_clock.now(), onack, NULL);
+                    ceph_clock_now(cct), onack, NULL);
   lock.Unlock();
 
   mylock.Lock();
@@ -1331,7 +1331,7 @@ list(Objecter::ListContext *context, int max_entries)
 int librados::RadosClient::
 create(IoCtxImpl& io, const object_t& oid, bool exclusive)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1364,7 +1364,7 @@ create(IoCtxImpl& io, const object_t& oid, bool exclusive)
 int librados::RadosClient::
 write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len, uint64_t off)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1407,7 +1407,7 @@ write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len, uint64_t o
 int librados::RadosClient::
 append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1450,7 +1450,7 @@ append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len)
 int librados::RadosClient::
 write_full(IoCtxImpl& io, const object_t& oid, bufferlist& bl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1490,7 +1490,7 @@ write_full(IoCtxImpl& io, const object_t& oid, bufferlist& bl)
 int librados::RadosClient::
 clone_range(IoCtxImpl& io, const object_t& dst_oid, uint64_t dst_offset, const object_t& src_oid, uint64_t src_offset, uint64_t len)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1529,7 +1529,7 @@ clone_range(IoCtxImpl& io, const object_t& dst_oid, uint64_t dst_offset, const o
 int librados::RadosClient::
 operate(IoCtxImpl& io, const object_t& oid, ::ObjectOperation *o, bufferlist *pbl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1563,7 +1563,7 @@ int librados::RadosClient::
 aio_operate(IoCtxImpl& io, const object_t& oid, ::ObjectOperation *o, AioCompletionImpl *c,
            bufferlist *pbl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
   Context *onack = new C_aio_Ack(c);
   Context *oncommit = new C_aio_Safe(c);
 
@@ -1635,7 +1635,7 @@ int librados::RadosClient::
 aio_write(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
           const bufferlist& bl, size_t len, uint64_t off)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1658,7 +1658,7 @@ int librados::RadosClient::
 aio_append(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
           const bufferlist& bl, size_t len)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1681,7 +1681,7 @@ int librados::RadosClient::
 aio_write_full(IoCtxImpl& io, const object_t &oid,
                AioCompletionImpl *c, const bufferlist& bl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1704,7 +1704,7 @@ int librados::RadosClient::
 remove(IoCtxImpl& io, const object_t& oid)
 {
   ::SnapContext snapc;
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1743,7 +1743,7 @@ remove(IoCtxImpl& io, const object_t& oid)
 int librados::RadosClient::
 trunc(IoCtxImpl& io, const object_t& oid, uint64_t size)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1784,7 +1784,7 @@ trunc(IoCtxImpl& io, const object_t& oid, uint64_t size)
 int librados::RadosClient::
 tmap_update(IoCtxImpl& io, const object_t& oid, bufferlist& cmdbl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -1825,7 +1825,7 @@ int librados::RadosClient::
 exec(IoCtxImpl& io, const object_t& oid, const char *cls, const char *method,
      bufferlist& inbl, bufferlist& outbl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   Mutex mylock("RadosClient::exec::mylock");
   Cond cond;
@@ -2044,7 +2044,7 @@ getxattr(IoCtxImpl& io, const object_t& oid, const char *name, bufferlist& bl)
 int librados::RadosClient::
 rmxattr(IoCtxImpl& io, const object_t& oid, const char *name)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -2086,7 +2086,7 @@ rmxattr(IoCtxImpl& io, const object_t& oid, const char *name)
 int librados::RadosClient::
 setxattr(IoCtxImpl& io, const object_t& oid, const char *name, bufferlist& bl)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   /* can't write to a snapshot */
   if (io.snap_seq != CEPH_NOSNAP)
@@ -2186,7 +2186,7 @@ int librados::RadosClient::
 watch(IoCtxImpl& io, const object_t& oid, uint64_t ver,
       uint64_t *cookie, librados::WatchCtx *ctx)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   ::ObjectOperation rd;
   Mutex mylock("RadosClient::watch::mylock");
@@ -2231,7 +2231,7 @@ watch(IoCtxImpl& io, const object_t& oid, uint64_t ver,
 int librados::RadosClient::
 _notify_ack(IoCtxImpl& io, const object_t& oid, uint64_t notify_id, uint64_t ver)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
 
   Mutex mylock("RadosClient::watch::mylock");
   Cond cond;
@@ -2251,7 +2251,7 @@ _notify_ack(IoCtxImpl& io, const object_t& oid, uint64_t notify_id, uint64_t ver
 int librados::RadosClient::
 unwatch(IoCtxImpl& io, const object_t& oid, uint64_t cookie)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
   bufferlist inbl, outbl;
 
   Mutex mylock("RadosClient::watch::mylock");
@@ -2286,7 +2286,7 @@ unwatch(IoCtxImpl& io, const object_t& oid, uint64_t cookie)
 int librados::RadosClient::
 notify(IoCtxImpl& io, const object_t& oid, uint64_t ver)
 {
-  utime_t ut = g_clock.now();
+  utime_t ut = ceph_clock_now(cct);
   bufferlist inbl, outbl;
 
   Mutex mylock("RadosClient::notify::mylock");
index 2e0b40bcc6389ab53891bbc99cf72dd3e5aea750..4fb85475f0c8efbd0b30793db9af22ecc9a636bc 100644 (file)
@@ -33,7 +33,7 @@
 
 ostream& CDentry::print_db_line_prefix(ostream& out) 
 {
-  return out << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->ino() << " " << name << ") ";
+  return out << ceph_clock_now(&g_ceph_context) << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->ino() << " " << name << ") ";
 }
 
 boost::pool<> CDentry::pool(sizeof(CDentry));
index f40e70ed05caeb85bbda9981b679b6e32ff55bc2..bd00dfd5a759df6324470a524c11fc2a25d1d224 100644 (file)
@@ -143,7 +143,7 @@ void CDir::print(ostream& out)
 
 ostream& CDir::print_db_line_prefix(ostream& out) 
 {
-  return out << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") ";
+  return out << ceph_clock_now(&g_ceph_context) << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") ";
 }
 
 
@@ -1571,7 +1571,7 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn)
            in->mark_dirty_rstat();
 
          //in->hack_accessed = false;
-         //in->hack_load_stamp = g_clock.now();
+         //in->hack_load_stamp = ceph_clock_now(&g_ceph_context);
          //num_new_inodes_loaded++;
        }
       }
@@ -1952,7 +1952,7 @@ void CDir::_commit(version_t want)
   m.priority = CEPH_MSG_PRIO_LOW;  // set priority lower than journal!
 
   if (committed_dn == items.end())
-    cache->mds->objecter->mutate(oid, oloc, m, snapc, g_clock.now(), 0, NULL,
+    cache->mds->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(&g_ceph_context), 0, NULL,
                                  new C_Dir_Committed(this, get_version(),
                                        inode->inode.last_renamed_version));
   else { // send in a different Context
@@ -1961,7 +1961,7 @@ void CDir::_commit(version_t want)
     while (committed_dn != items.end()) {
       ObjectOperation n = ObjectOperation();
       committed_dn = _commit_partial(n, snaps, max_write_size, committed_dn);
-      cache->mds->objecter->mutate(oid, oloc, n, snapc, g_clock.now(), 0, NULL,
+      cache->mds->objecter->mutate(oid, oloc, n, snapc, ceph_clock_now(&g_ceph_context), 0, NULL,
                                   gather->new_sub());
     }
     /*
@@ -1974,7 +1974,7 @@ void CDir::_commit(version_t want)
      * we simply send the message containing the header off last, we cannot
      * get our header into an incorrect state.
      */
-    cache->mds->objecter->mutate(oid, oloc, m, snapc, g_clock.now(), 0, NULL,
+    cache->mds->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(&g_ceph_context), 0, NULL,
                                 gather->new_sub());
   }
 }
index b9bcb8eb14e03226845bed85af256d2579b1a16c..92ac90194a64d09976981d08fe12e7e7ce47a14b 100644 (file)
@@ -65,7 +65,7 @@ LockType CInode::policylock_type(CEPH_LOCK_IPOLICY);
 //int cinode_pins[CINODE_NUM_PINS];  // counts
 ostream& CInode::print_db_line_prefix(ostream& out)
 {
-  return out << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") ";
+  return out << ceph_clock_now(&g_ceph_context) << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") ";
 }
 
 /*
@@ -966,7 +966,7 @@ void CInode::store(Context *fin)
   object_t oid = CInode::get_object_name(ino(), frag_t(), ".inode");
   object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pg_pool());
 
-  mdcache->mds->objecter->mutate(oid, oloc, m, snapc, g_clock.now(), 0,
+  mdcache->mds->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(&g_ceph_context), 0,
                                 NULL, new C_Inode_Stored(this, get_version(), fin) );
 }
 
@@ -1091,7 +1091,7 @@ void CInode::store_parent(Context *fin)
   object_t oid = get_object_name(ino(), frag_t(), "");
   object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pg_pool());
 
-  mdcache->mds->objecter->mutate(oid, oloc, m, snapc, g_clock.now(), 0,
+  mdcache->mds->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(&g_ceph_context), 0,
                                 NULL, new C_Inode_StoredParent(this, inode.last_renamed_version, fin) );
 
 }
@@ -2397,7 +2397,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
       cap->issue_norevoke(issue);
       issue = cap->pending();
       cap->set_last_issue();
-      cap->set_last_issue_stamp(g_clock.now());
+      cap->set_last_issue_stamp(ceph_clock_now(&g_ceph_context));
       e.cap.caps = issue;
       e.cap.wanted = cap->wanted();
       e.cap.cap_id = cap->get_cap_id();
index f94f89516883ceff0832b038af8da80e010c2739..f6655098b5c84bed9fb24528b0c964e6d3ec14fb 100644 (file)
@@ -913,7 +913,7 @@ public:
       cap->reset_seq();
     }
     cap->set_cap_id(icr.cap_id);
-    cap->set_last_issue_stamp(g_clock.now());
+    cap->set_last_issue_stamp(ceph_clock_now(&g_ceph_context));
     return cap;
   }
   void clear_client_caps_after_export() {
index 0c7e42bd5f48a3623e154827c72c384708f1608c..49889f4b0f79fcf5dd87d2baddb57fe77e4fd9dd 100644 (file)
@@ -193,7 +193,7 @@ void Dumper::undump(const char *dump_file)
   Cond cond;
   
   cout << "writing header " << oid << std::endl;
-  objecter->write_full(oid, oloc, snapc, hbl, g_clock.now(), 0, 
+  objecter->write_full(oid, oloc, snapc, hbl, ceph_clock_now(&g_ceph_context), 0, 
                       NULL, 
                       new C_SafeCond(&lock, &cond, &done));
 
@@ -212,7 +212,7 @@ void Dumper::undump(const char *dump_file)
     uint64_t l = MIN(left, 1024*1024);
     j.read_fd(fd, l);
     cout << " writing " << pos << "~" << l << std::endl;
-    filer.write(ino, &h.layout, snapc, pos, l, j, g_clock.now(), 0, NULL, new C_SafeCond(&lock, &cond, &done));
+    filer.write(ino, &h.layout, snapc, pos, l, j, ceph_clock_now(&g_ceph_context), 0, NULL, new C_SafeCond(&lock, &cond, &done));
 
     lock.Lock();
     while (!done)
index f5b559d84a97b07897e5c01de7917a21e1d13a52..259fd9f3c2fdc1f00cfc222c3f7d793fe52780c9 100644 (file)
@@ -1647,7 +1647,7 @@ void Locker::request_inode_file_caps(CInode *in)
   if (wanted != in->replica_caps_wanted) {
 
     if (wanted == 0) {
-      if (in->replica_caps_wanted_keep_until > g_clock.now()) {
+      if (in->replica_caps_wanted_keep_until > ceph_clock_now(&g_ceph_context)) {
         // ok, release them finally!
         in->replica_caps_wanted_keep_until.sec_ref() = 0;
         dout(7) << "request_inode_file_caps " << ccap_string(wanted)
@@ -1657,7 +1657,7 @@ void Locker::request_inode_file_caps(CInode *in)
                  << dendl;
       }
       else if (in->replica_caps_wanted_keep_until.sec() == 0) {
-        in->replica_caps_wanted_keep_until = g_clock.now();
+        in->replica_caps_wanted_keep_until = ceph_clock_now(&g_ceph_context);
         in->replica_caps_wanted_keep_until.sec_ref() += 2;
         
         dout(7) << "request_inode_file_caps " << ccap_string(wanted)
@@ -2739,7 +2739,7 @@ void Locker::handle_client_lease(MClientLease *m)
       m->h.seq = ++l->seq;
       m->clear_payload();
       
-      utime_t now = g_clock.now();
+      utime_t now = ceph_clock_now(&g_ceph_context);
       now += mdcache->client_lease_durations[pool];
       mdcache->touch_client_lease(l, pool, now);
       
@@ -3518,7 +3518,7 @@ void Locker::mark_updated_scatterlock(ScatterLock *lock)
             << " - already on list since " << lock->get_update_stamp() << dendl;
   } else {
     updated_scatterlocks.push_back(lock->get_updated_item());
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     lock->set_update_stamp(now);
     dout(10) << "mark_updated_scatterlock " << *lock
             << " - added at " << now << dendl;
@@ -3639,7 +3639,7 @@ void Locker::scatter_tick()
   dout(10) << "scatter_tick" << dendl;
   
   // updated
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   int n = updated_scatterlocks.size();
   while (!updated_scatterlocks.empty()) {
     ScatterLock *lock = updated_scatterlocks.front();
index 8ef0569c26c8c809a99ae840efc7c69ac3823e6c..a6f096f4859c1f7df1dfd727c6aca46ea9c5f5ad 100644 (file)
@@ -71,8 +71,8 @@ int MDBalancer::proc_message(Message *m)
 void MDBalancer::tick()
 {
   static int num_bal_times = g_conf->mds_bal_max;
-  static utime_t first = g_clock.now();
-  utime_t now = g_clock.now();
+  static utime_t first = ceph_clock_now(&g_ceph_context);
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t elapsed = now;
   elapsed -= first;
 
@@ -171,7 +171,7 @@ mds_load_t MDBalancer::get_load(utime_t now)
 
 void MDBalancer::send_heartbeat()
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   
   if (mds->mdsmap->is_degraded()) {
     dout(10) << "send_heartbeat degraded" << dendl;
@@ -423,7 +423,7 @@ void MDBalancer::prep_rebalance(int beat)
   } else {
     int cluster_size = mds->get_mds_map()->get_num_mds();
     int whoami = mds->get_nodeid();
-    rebalance_time = g_clock.now();
+    rebalance_time = ceph_clock_now(&g_ceph_context);
 
     dump_pop_map();
 
@@ -1151,7 +1151,7 @@ void MDBalancer::dump_pop_map()
   if (mds->mdcache->root)
     iq.push_back(mds->mdcache->root);
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   while (!iq.empty()) {
     CInode *in = iq.front();
     iq.pop_front();
index e8ba93389627ed7504db73941bb8301c0ba07fec..cc6fd2d7bfabe0cae9e29c0952e57a5dc843397f 100644 (file)
@@ -278,7 +278,7 @@ CInode *MDCache::create_system_inode(inodeno_t ino, int mode)
   in->inode.mode = 0500 | mode;
   in->inode.size = 0;
   in->inode.ctime = 
-    in->inode.mtime = g_clock.now();
+    in->inode.mtime = ceph_clock_now(&g_ceph_context);
   in->inode.nlink = 1;
   in->inode.truncate_size = -1ull;
 
@@ -742,7 +742,7 @@ void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> auth, bool do_eval)
 
     // adjust recursive pop counters
     if (dir->is_auth()) {
-      utime_t now = g_clock.now();
+      utime_t now = ceph_clock_now(&g_ceph_context);
       CDir *p = dir->get_parent_dir();
       while (p) {
        p->pop_auth_subtree.sub(now, decayrate, dir->pop_auth_subtree);
@@ -820,7 +820,7 @@ void MDCache::try_subtree_merge_at(CDir *dir, bool do_eval)
 
     // adjust popularity?
     if (dir->is_auth()) {
-      utime_t now = g_clock.now();
+      utime_t now = ceph_clock_now(&g_ceph_context);
       CDir *p = dir->get_parent_dir();
       while (p) {
        p->pop_auth_subtree.add(now, decayrate, dir->pop_auth_subtree);
@@ -1811,7 +1811,7 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
 
   // declare now?
   if (mut->now == utime_t())
-    mut->now = g_clock.now();
+    mut->now = ceph_clock_now(&g_ceph_context);
 
   if (in->is_base())
     return;
@@ -5047,7 +5047,7 @@ void MDCache::purge_prealloc_ino(inodeno_t ino, Context *fin)
 
   dout(10) << "purge_prealloc_ino " << ino << " oid " << oid << dendl;
   SnapContext snapc;
-  mds->objecter->remove(oid, oloc, snapc, g_clock.now(), 0, 0, fin);
+  mds->objecter->remove(oid, oloc, snapc, ceph_clock_now(&g_ceph_context), 0, 0, fin);
 }  
 
 
@@ -5424,7 +5424,7 @@ void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<int, MCacheExpi
       mds->logger->inc("outt");
     else {
       mds->logger->inc("outut");
-      mds->logger->favg("oututl", g_clock.now() - in->hack_load_stamp);
+      mds->logger->favg("oututl", ceph_clock_now(&g_ceph_context) - in->hack_load_stamp);
     }
   }
   */
@@ -5903,7 +5903,7 @@ void MDCache::dentry_remove_replica(CDentry *dn, int from)
 
 void MDCache::trim_client_leases()
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   
   dout(10) << "trim_client_leases" << dendl;
 
@@ -5985,7 +5985,7 @@ public:
 
 void MDCache::shutdown_check()
 {
-  dout(0) << "shutdown_check at " << g_clock.now() << dendl;
+  dout(0) << "shutdown_check at " << ceph_clock_now(&g_ceph_context) << dendl;
 
   // cache
   int o = g_conf->debug_mds;
@@ -7957,7 +7957,7 @@ void MDCache::purge_stray(CDentry *dn)
       uint64_t num = (to + period - 1) / period;
       dout(10) << "purge_stray 0~" << to << " objects 0~" << num << " snapc " << snapc << " on " << *in << dendl;
       mds->filer->purge_range(in->inode.ino, &in->inode.layout, *snapc,
-                             0, num, g_clock.now(), 0,
+                             0, num, ceph_clock_now(&g_ceph_context), 0,
                              new C_MDC_PurgeStrayPurged(this, dn));
     } else {
       dout(10) << "purge_stray 0 objects snapc " << snapc << " on " << *in << dendl;
index e588cf97d2b40d957085b071f8376c0d07c0309d..350005fdc88224f25aac117afea1a07beb17e44a 100644 (file)
@@ -172,7 +172,7 @@ void MDLog::submit_entry(LogEvent *le, Context *c)
   le->_segment->num_events++;
   le->update_segment();
 
-  le->set_stamp(g_clock.now());
+  le->set_stamp(ceph_clock_now(&g_ceph_context));
   
   num_events++;
   assert(!capped);
@@ -304,7 +304,7 @@ void MDLog::trim(int m)
   if (segments.empty()) return;
 
   // hack: only trim for a few seconds at a time
-  utime_t stop = g_clock.now();
+  utime_t stop = ceph_clock_now(&g_ceph_context);
   stop += 2.0;
 
   map<uint64_t,LogSegment*>::iterator p = segments.begin();
@@ -313,7 +313,7 @@ void MDLog::trim(int m)
         ((max_events >= 0 && left-expiring_events-expired_events > max_events) ||
          (max_segments >= 0 && (int)(segments.size()-expiring_segments.size()-expired_segments.size()) > max_segments))) {
 
-    if (stop < g_clock.now())
+    if (stop < ceph_clock_now(&g_ceph_context))
       break;
 
     if ((int)expiring_segments.size() >= g_conf->mds_log_max_expiring)
index 0d55aea673b387d291e59d140808f078db3c85d8..a591fc72276a34440002749b0d8124eec9430d9c 100644 (file)
@@ -571,7 +571,7 @@ void MDS::tick()
   }
 
   // log
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   mds_load_t load = balancer->get_load(now);
   
   if (logger) {
@@ -623,7 +623,7 @@ void MDS::beacon_send()
           << " (currently " << ceph_mds_state_name(state) << ")"
           << dendl;
 
-  beacon_seq_stamp[beacon_last_seq] = g_clock.now();
+  beacon_seq_stamp[beacon_last_seq] = ceph_clock_now(&g_ceph_context);
   
   MMDSBeacon *beacon = new MMDSBeacon(monc->get_fsid(), monc->get_global_id(), name, mdsmap->get_epoch(), 
                                      want_state, beacon_last_seq);
@@ -647,7 +647,7 @@ bool MDS::is_laggy()
   if (beacon_last_acked_stamp == utime_t())
     return false;
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t since = now - beacon_last_acked_stamp;
   if (since > g_conf->mds_beacon_grace) {
     dout(5) << "is_laggy " << since << " > " << g_conf->mds_beacon_grace
@@ -668,7 +668,7 @@ void MDS::handle_mds_beacon(MMDSBeacon *m)
   if (beacon_seq_stamp.count(seq)) {
     assert(beacon_seq_stamp[seq] > beacon_last_acked_stamp);
     beacon_last_acked_stamp = beacon_seq_stamp[seq];
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     utime_t rtt = now - beacon_last_acked_stamp;
 
     dout(10) << "handle_mds_beacon " << ceph_mds_state_name(m->get_state())
@@ -1860,7 +1860,7 @@ bool MDS::_dispatch(Message *m)
 
   // hack: thrash exports
   static utime_t start;
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   if (start == utime_t()) 
     start = now;
   /*double el = now - start;
index 403a8377921303621047bf84f6af3260532f6b37..521a4052be929e95853a091293caf363784376d6 100644 (file)
@@ -67,7 +67,7 @@ void MDSTable::save(Context *onfinish, version_t v)
   object_locator_t oloc(mds->mdsmap->get_metadata_pg_pool());
   mds->objecter->write_full(oid, oloc,
                            snapc,
-                           bl, g_clock.now(), 0,
+                           bl, ceph_clock_now(&g_ceph_context), 0,
                            NULL, new C_MT_Save(this, version));
 }
 
index 93df2c20779c4034761950a0a78d125c56dde94e..f659f32c5aa6dbdd1ade9118f80dab235bfbb749 100644 (file)
@@ -942,7 +942,7 @@ void Migrator::export_go_synced(CDir *dir)
   cache->adjust_subtree_auth(dir, mds->get_nodeid(), dest);
 
   // take away the popularity we're sending.
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   mds->balancer->subtract_export(dir, now);
   
   // fill export message with cache data
@@ -1482,7 +1482,7 @@ void Migrator::export_finish(CDir *dir)
   
   // finish export (adjust local cache state)
   C_Contexts *fin = new C_Contexts(&g_ceph_context);
-  finish_export_dir(dir, fin->contexts, g_clock.now());
+  finish_export_dir(dir, fin->contexts, ceph_clock_now(&g_ceph_context));
   dir->add_waiter(CDir::WAIT_UNFREEZE, fin);
 
   // unfreeze
@@ -1858,7 +1858,7 @@ void Migrator::handle_export_dir(MExportDir *m)
   CDir *dir = cache->get_dirfrag(m->dirfrag);
   assert(dir);
   
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   int oldauth = m->get_source().num();
   dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << dendl;
   assert(dir->is_auth() == false);
index e8b06d912e5971a68eb416cf0f837cdc0559fd1a..74d7e2da10a5160d84443aeb0c27ea2319949c7c 100644 (file)
@@ -403,7 +403,7 @@ void Server::find_idle_sessions()
   
   // timeout/stale
   //  (caps go stale, lease die)
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t cutoff = now;
   cutoff -= g_conf->mds_session_timeout;  
   while (1) {
@@ -514,7 +514,7 @@ void Server::reconnect_clients()
 
   // clients will get the mdsmap and discover we're reconnecting via the monitor.
   
-  reconnect_start = g_clock.now();
+  reconnect_start = ceph_clock_now(&g_ceph_context);
   dout(1) << "reconnect_clients -- " << client_reconnect_gather.size() << " sessions" << dendl;
   mds->sessionmap.dump();
 }
@@ -533,7 +533,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
     return;
   }
 
-  utime_t delay = g_clock.now();
+  utime_t delay = ceph_clock_now(&g_ceph_context);
   delay -= reconnect_start;
   dout(10) << " reconnect_start " << reconnect_start << " delay " << delay << dendl;
 
@@ -657,7 +657,7 @@ void Server::reconnect_tick()
 {
   utime_t reconnect_end = reconnect_start;
   reconnect_end += g_conf->mds_reconnect_timeout;
-  if (g_clock.now() >= reconnect_end &&
+  if (ceph_clock_now(&g_ceph_context) >= reconnect_end &&
       !client_reconnect_gather.empty()) {
     dout(10) << "reconnect timed out" << dendl;
     for (set<client_t>::iterator p = client_reconnect_gather.begin();
@@ -830,7 +830,7 @@ void Server::early_reply(MDRequest *mdr, CInode *tracei, CDentry *tracedn)
   mdr->did_early_reply = true;
 
   mds->logger->inc(l_mds_reply);
-  double lat = g_clock.now() - mdr->client_request->get_recv_stamp();
+  double lat = ceph_clock_now(&g_ceph_context) - mdr->client_request->get_recv_stamp();
   mds->logger->favg(l_mds_replyl, lat);
   dout(20) << "lat " << lat << dendl;
 }
@@ -872,7 +872,7 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei,
   if (!did_early_reply && !is_replay) {
 
     mds->logger->inc(l_mds_reply);
-    double lat = g_clock.now() - mdr->client_request->get_recv_stamp();
+    double lat = ceph_clock_now(&g_ceph_context) - mdr->client_request->get_recv_stamp();
     mds->logger->favg(l_mds_replyl, lat);
     dout(20) << "lat " << lat << dendl;
     
@@ -965,7 +965,7 @@ void Server::set_trace_dist(Session *session, MClientReply *reply,
   bufferlist bl;
   int whoami = mds->get_nodeid();
   client_t client = session->get_client();
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   dout(20) << "set_trace_dist snapid " << snapid << dendl;
 
@@ -2035,7 +2035,7 @@ void Server::handle_client_stat(MDRequest *mdr)
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
 
-  mds->balancer->hit_inode(g_clock.now(), ref, META_POP_IRD,
+  mds->balancer->hit_inode(ceph_clock_now(&g_ceph_context), ref, META_POP_IRD,
                           mdr->client_request->get_source().num());
 
   // reply
@@ -2400,7 +2400,7 @@ void Server::handle_client_open(MDRequest *mdr)
   }
   
   // hit pop
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
   if (cmode == CEPH_FILE_MODE_RDWR ||
       cmode == CEPH_FILE_MODE_WR) 
     mds->balancer->hit_inode(mdr->now, cur, META_POP_IWR);
@@ -2512,7 +2512,7 @@ void Server::handle_client_openc(MDRequest *mdr)
 
     
   // create inode.
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
 
   SnapRealm *realm = diri->find_snaprealm();   // use directory's realm; inode isn't attached yet.
   snapid_t follows = realm->get_newest_seq();
@@ -2614,7 +2614,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
   dir->verify_fragstat();
 #endif
 
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
 
   snapid_t snapid = mdr->snapid;
 
@@ -2763,7 +2763,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
           << " complete=" << (int)complete << dendl;
 
   // bump popularity.  NOTE: this doesn't quite capture it.
-  mds->balancer->hit_dir(g_clock.now(), dir, META_POP_IRD, -1, numfiles);
+  mds->balancer->hit_dir(ceph_clock_now(&g_ceph_context), dir, META_POP_IRD, -1, numfiles);
   
   // reply
   reply_request(mdr, reply, diri);
@@ -3008,7 +3008,7 @@ void Server::handle_client_setattr(MDRequest *mdr)
 
   pi = cur->project_inode();
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   if (mask & CEPH_SETATTR_MODE)
     pi->mode = (pi->mode & ~07777) | (req->head.args.setattr.mode & 07777);
@@ -3074,7 +3074,7 @@ void Server::do_open_truncate(MDRequest *mdr, int cmode)
 
   // prepare
   inode_t *pi = in->project_inode();
-  pi->mtime = pi->ctime = g_clock.now();
+  pi->mtime = pi->ctime = ceph_clock_now(&g_ceph_context);
   pi->version = in->pre_dirty();
 
   pi->truncate_from = pi->size;
@@ -3163,7 +3163,7 @@ void Server::handle_client_setlayout(MDRequest *mdr)
   inode_t *pi = cur->project_inode();
   pi->layout = layout;
   pi->version = cur->pre_dirty();
-  pi->ctime = g_clock.now();
+  pi->ctime = ceph_clock_now(&g_ceph_context);
   
   // log + wait
   mdr->ls = mdlog->get_current_segment();
@@ -3310,7 +3310,7 @@ void Server::handle_client_setxattr(MDRequest *mdr)
   map<string,bufferptr> *px = new map<string,bufferptr>;
   inode_t *pi = cur->project_inode(px);
   pi->version = cur->pre_dirty();
-  pi->ctime = g_clock.now();
+  pi->ctime = ceph_clock_now(&g_ceph_context);
   pi->xattr_version++;
   px->erase(name);
   (*px)[name] = buffer::create(len);
@@ -3362,7 +3362,7 @@ void Server::handle_client_removexattr(MDRequest *mdr)
   map<string,bufferptr> *px = new map<string,bufferptr>;
   inode_t *pi = cur->project_inode(px);
   pi->version = cur->pre_dirty();
-  pi->ctime = g_clock.now();
+  pi->ctime = ceph_clock_now(&g_ceph_context);
   pi->xattr_version++;
   px->erase(name);
 
@@ -3465,7 +3465,7 @@ void Server::handle_client_mknod(MDRequest *mdr)
 
   SnapRealm *realm = dn->get_dir()->inode->find_snaprealm();
   snapid_t follows = realm->get_newest_seq();
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
 
   CInode *newi = prepare_new_inode(mdr, dn->get_dir(), inodeno_t(req->head.ino),
                                   req->head.args.mknod.mode, &layout);
@@ -3545,7 +3545,7 @@ void Server::handle_client_mkdir(MDRequest *mdr)
   // new inode
   SnapRealm *realm = dn->get_dir()->inode->find_snaprealm();
   snapid_t follows = realm->get_newest_seq();
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
 
   unsigned mode = req->head.args.mkdir.mode;
   mode &= ~S_IFMT;
@@ -3619,7 +3619,7 @@ void Server::handle_client_symlink(MDRequest *mdr)
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
 
-  mdr->now = g_clock.now();
+  mdr->now = ceph_clock_now(&g_ceph_context);
   snapid_t follows = dn->get_dir()->inode->find_snaprealm()->get_newest_seq();
 
   unsigned mode = S_IFLNK | 0777;
@@ -3695,7 +3695,7 @@ void Server::handle_client_link(MDRequest *mdr)
 
   // pick mtime
   if (mdr->now == utime_t())
-    mdr->now = g_clock.now();
+    mdr->now = ceph_clock_now(&g_ceph_context);
 
   // does the target need an anchor?
   if (targeti->is_auth()) {
@@ -4331,7 +4331,7 @@ void Server::handle_client_unlink(MDRequest *mdr)
 
   // yay!
   if (mdr->now == utime_t())
-    mdr->now = g_clock.now();
+    mdr->now = ceph_clock_now(&g_ceph_context);
 
   // NOTE: this is non-optimal.  we create an anchor at the old
   // location, and then change it.  we can do better, but it's more
@@ -4881,7 +4881,7 @@ void Server::handle_client_rename(MDRequest *mdr)
 
   // -- declare now --
   if (mdr->now == utime_t())
-    mdr->now = g_clock.now();
+    mdr->now = ceph_clock_now(&g_ceph_context);
 
   // -- prepare witnesses --
 
@@ -6108,7 +6108,7 @@ void Server::handle_client_lssnap(MDRequest *mdr)
   map<snapid_t,SnapInfo*> infomap;
   realm->get_snap_info(infomap, diri->get_oldest_snap());
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   __u32 num = 0;
   bufferlist dnbl;
   for (map<snapid_t,SnapInfo*>::iterator p = infomap.begin();
@@ -6209,7 +6209,7 @@ void Server::handle_client_mksnap(MDRequest *mdr)
   }
 
   if (mdr->now == utime_t())
-    mdr->now = g_clock.now();
+    mdr->now = ceph_clock_now(&g_ceph_context);
 
   // anchor
   if (!diri->is_anchored()) {
@@ -6360,7 +6360,7 @@ void Server::handle_client_rmsnap(MDRequest *mdr)
 
   // journal
   inode_t *pi = diri->project_inode();
-  pi->ctime = g_clock.now();
+  pi->ctime = ceph_clock_now(&g_ceph_context);
   pi->version = diri->pre_dirty();
   
   mdr->ls = mdlog->get_current_segment();
index b6adb41fb06ad3693078502c6e8798edcc77dd12..0a7bfcd23d6bcf9f56c96921766a60be8d0d1ce2 100644 (file)
@@ -123,7 +123,7 @@ void SessionMap::save(Context *onsave, version_t needv)
 
   mds->objecter->write_full(oid, oloc,
                            snapc,
-                           bl, g_clock.now(), 0,
+                           bl, ceph_clock_now(&g_ceph_context), 0,
                            NULL, new C_SM_Save(this, version));
 }
 
@@ -163,7 +163,7 @@ void SessionMap::encode(bufferlist& bl)
 
 void SessionMap::decode(bufferlist::iterator& p)
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   uint64_t pre;
   ::decode(pre, p);
   if (pre == (uint64_t)-1) {
index 3a7f7bcbf5b811473c9f7f1374dbe2f34093d039..9596bc830f0171cfdb6282565be17c754d9f8111 100644 (file)
@@ -268,7 +268,7 @@ public:
     else
       s = session_map[i.name] = new Session;
     s->inst = i;
-    s->last_cap_renew = g_clock.now();
+    s->last_cap_renew = ceph_clock_now(&g_ceph_context);
     return s;
   }
   void add_session(Session *s) {
@@ -286,7 +286,7 @@ public:
   void touch_session(Session *session) {
     if (session->item_session_list.is_on_list()) {
       by_state[session->state].push_back(&session->item_session_list);
-      session->last_cap_renew = g_clock.now();
+      session->last_cap_renew = ceph_clock_now(&g_ceph_context);
     } else {
       assert(0);  // hrm, should happen?
     }
index f9c97b6f17ef047e80a6eda8b079818f695f1f55..81026160888cafc539e5df87b741e4debf22a693 100644 (file)
@@ -1022,7 +1022,7 @@ WRITE_CLASS_ENCODER(dirfrag_load_vec_t)
 inline ostream& operator<<(ostream& out, dirfrag_load_vec_t& dl)
 {
   // ugliness!
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   DecayRate rate(g_conf->mds_decay_halflife);
   return out << "[" << dl.vec[0].get(now, rate) << "," << dl.vec[1].get(now, rate) 
             << " " << dl.meta_load(now, rate)
index 01c3d3635c8da4c631ce11a79d7d8069f6fe315d..935125dd8dd6c38cc5814156fb52765c25c45595 100644 (file)
@@ -66,7 +66,7 @@ class MMonPaxos : public Message {
     op(o), machine_id(mid),
     first_committed(0), last_committed(0), pn_from(0), pn(0), uncommitted_pn(0),
     latest_version(0) {
-    sent_timestamp = g_clock.now();
+    sent_timestamp = ceph_clock_now(&g_ceph_context);
   }
 
 private:
index d8515eb76f635b8c0d13eb5f554f233ec2d5a19a..759dca0abc06920713c006213517736ccfb3aa97 100644 (file)
@@ -67,7 +67,7 @@ void Elector::start()
   // start by trying to elect me
   if (epoch % 2 == 0) 
     bump_epoch(epoch+1);  // odd == election cycle
-  start_stamp = g_clock.now();
+  start_stamp = ceph_clock_now(&g_ceph_context);
   electing_me = true;
   acked_me.insert(mon->rank);
 
@@ -95,7 +95,7 @@ void Elector::defer(int who)
 
   // ack them
   leader_acked = who;
-  ack_stamp = g_clock.now();
+  ack_stamp = ceph_clock_now(&g_ceph_context);
   mon->messenger->send_message(new MMonElection(MMonElection::OP_ACK, epoch, mon->monmap),
                               mon->monmap->get_inst(who));
   
index a72d1d74280d70acec102971599742cb2396e7ac..6a3f1e2d071f1d4a52d2228fe6ecad339bd65e26 100644 (file)
@@ -81,7 +81,7 @@ void LogMonitor::create_initial(bufferlist& bl)
   dout(10) << "create_initial -- creating initial map" << dendl;
   LogEntry e;
   memset(&e.who, 0, sizeof(e.who));
-  e.stamp = g_clock.now();
+  e.stamp = ceph_clock_now(&g_ceph_context);
   e.type = CLOG_INFO;
   std::stringstream ss;
   ss << "mkfs " << mon->monmap->get_fsid();
index 95079725062bffc51a78b2056253ba7aa788c8d7..6cb1442b31fd5993676772131a2e9dc60c3ee31d 100644 (file)
@@ -56,7 +56,7 @@ void MDSMonitor::print_map(MDSMap &m, int dbl)
 void MDSMonitor::create_new_fs(MDSMap &m, int metadata_pool, int data_pool)
 {
   m.max_mds = g_conf->max_mds;
-  m.created = g_clock.now();
+  m.created = ceph_clock_now(&g_ceph_context);
   m.data_pg_pools.push_back(data_pool);
   m.metadata_pg_pool = metadata_pool;
   m.cas_pg_pool = -1;
@@ -112,7 +112,7 @@ void MDSMonitor::encode_pending(bufferlist &bl)
 {
   dout(10) << "encode_pending e" << pending_mdsmap.epoch << dendl;
 
-  pending_mdsmap.modified = g_clock.now();
+  pending_mdsmap.modified = ceph_clock_now(&g_ceph_context);
 
   //print_map(pending_mdsmap);
 
@@ -150,7 +150,7 @@ void MDSMonitor::_note_beacon(MMDSBeacon *m)
   version_t seq = m->get_seq();
 
   dout(15) << "_note_beacon " << *m << " noting time" << dendl;
-  last_beacon[gid].stamp = g_clock.now();  
+  last_beacon[gid].stamp = ceph_clock_now(&g_ceph_context);  
   last_beacon[gid].seq = seq;
 }
 
@@ -360,7 +360,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
     }
 
     // initialize the beacon timer
-    last_beacon[gid].stamp = g_clock.now();
+    last_beacon[gid].stamp = ceph_clock_now(&g_ceph_context);
     last_beacon[gid].seq = seq;
 
     // new incompat?
@@ -631,7 +631,7 @@ int MDSMonitor::fail_mds(std::ostream &ss, const std::string &arg)
   if (pending_mdsmap.up.count(w)) {
     uint64_t gid = pending_mdsmap.up[w];
     if (pending_mdsmap.mds_info.count(gid)) {
-      utime_t until = g_clock.now();
+      utime_t until = ceph_clock_now(&g_ceph_context);
       until += g_conf->mds_blacklist_interval;
       MDSMap::mds_info_t& info = pending_mdsmap.mds_info[pending_mdsmap.up[w]];
       pending_mdsmap.last_failure_osd_epoch = mon->osdmon()->blacklist(info.addr, until);
@@ -662,7 +662,7 @@ int MDSMonitor::cluster_fail(std::ostream &ss)
   // --- reset the cluster map ---
   if (pending_mdsmap.mds_info.size()) {
     // blacklist all old mds's
-    utime_t until = g_clock.now();
+    utime_t until = ceph_clock_now(&g_ceph_context);
     until += g_conf->mds_blacklist_interval;
     for (map<int32_t,uint64_t>::iterator p = pending_mdsmap.up.begin();
         p != pending_mdsmap.up.end();
@@ -905,7 +905,7 @@ void MDSMonitor::tick()
   }
 
   // check beacon timestamps
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t cutoff = now;
   cutoff -= g_conf->mds_beacon_grace;
 
@@ -918,7 +918,7 @@ void MDSMonitor::tick()
       dout(10) << " adding " << p->second.addr << " mds" << info.rank << "." << info.inc
               << " " << ceph_mds_state_name(info.state)
               << " to last_beacon" << dendl;
-      last_beacon[p->first].stamp = g_clock.now();
+      last_beacon[p->first].stamp = ceph_clock_now(&g_ceph_context);
       last_beacon[p->first].seq = 0;
     }
   }
@@ -1162,7 +1162,7 @@ void MDSMonitor::do_stop()
     case MDSMap::STATE_CLIENTREPLAY:
       // BUG: hrm, if this is the case, the STOPPING guys won't be able to stop, will they?
       {
-       utime_t until = g_clock.now();
+       utime_t until = ceph_clock_now(&g_ceph_context);
        until += g_conf->mds_blacklist_interval;
        pending_mdsmap.last_failure_osd_epoch = mon->osdmon()->blacklist(info.addr, until);
        propose_osdmap = true;
index 2466e45c3bfecf5b01d3b05ae6c8590334c98c22..792d9a8b7b4bd3688cecf54cfc01be68a59dcfd7 100644 (file)
@@ -230,7 +230,7 @@ int MonClient::get_monmap_privately()
       break;
     
     utime_t interval(1, 0);
-    map_cond.WaitInterval(monc_lock, interval);
+    map_cond.WaitInterval(cct, monc_lock, interval);
 
     if (monmap.epoch == 0) {
       messenger->mark_down(cur_con);  // nope, clean that connection up
@@ -405,7 +405,7 @@ int MonClient::authenticate(double timeout)
   if (cur_mon.empty())
     _reopen_session();
 
-  utime_t until = g_clock.now();
+  utime_t until = ceph_clock_now(cct);
   until += timeout;
   if (timeout > 0.0)
     dout(10) << "authenticate will time out at " << until << dendl;
@@ -433,7 +433,7 @@ void MonClient::handle_auth(MAuthReply *m)
   if (state == MC_STATE_NEGOTIATING) {
     if (!auth || (int)m->protocol != auth->get_protocol()) {
       delete auth;
-      auth = get_auth_client_handler(&g_ceph_context, m->protocol, rotating_secrets);
+      auth = get_auth_client_handler(cct, m->protocol, rotating_secrets);
       if (!auth) {
        m->put();
        return;
@@ -595,7 +595,7 @@ void MonClient::tick()
     _reopen_session();
   } else if (!cur_mon.empty()) {
     // just renew as needed
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(cct);
     if (now > sub_renew_after)
       _renew_subs();
 
@@ -639,7 +639,7 @@ void MonClient::_renew_subs()
     _reopen_session();
   else {
     if (sub_renew_sent == utime_t())
-      sub_renew_sent = g_clock.now();
+      sub_renew_sent = ceph_clock_now(cct);
 
     MMonSubscribe *m = new MMonSubscribe;
     m->what = sub_have;
@@ -694,7 +694,7 @@ int MonClient::_check_auth_rotating()
     return 0;
   }
 
-  utime_t cutoff = g_clock.now();
+  utime_t cutoff = ceph_clock_now(cct);
   cutoff -= MIN(30.0, g_conf->auth_service_ticket_ttl / 4.0);
   if (!rotating_secrets->need_new_secrets(cutoff)) {
     dout(10) << "_check_auth_rotating have uptodate secrets (they expire after " << cutoff << ")" << dendl;
@@ -716,7 +716,7 @@ int MonClient::_check_auth_rotating()
 int MonClient::wait_auth_rotating(double timeout)
 {
   Mutex::Locker l(monc_lock);
-  utime_t until = g_clock.now();
+  utime_t until = ceph_clock_now(cct);
   until += timeout;
 
   if (auth->get_protocol() == CEPH_AUTH_NONE)
@@ -727,7 +727,7 @@ int MonClient::wait_auth_rotating(double timeout)
 
   while (auth_principal_needs_rotating_keys(entity_name) &&
         rotating_secrets->need_new_secrets()) {
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(cct);
     if (now >= until) {
       dout(0) << "wait_auth_rotating timed out after " << timeout << dendl;
       return -ETIMEDOUT;
index 03e87c96a70b20e4dc1f8b42862a15d57581a7cf..56d45deca9067a37a0d086335e3ba30923416d16 100644 (file)
@@ -46,7 +46,7 @@ class MonMap {
 
   MonMap() : epoch(0) {
     memset(&fsid, 0, sizeof(fsid));
-    last_changed = created = g_clock.now();
+    last_changed = created = ceph_clock_now(&g_ceph_context);
   }
 
   ceph_fsid_t& get_fsid() { return fsid; }
index 92e29a35b03796332a0764814178f89150a7be7d..0c41e842b760ac2150885e7db2cd0fa590606836 100644 (file)
@@ -262,7 +262,7 @@ epoch_t Monitor::get_epoch()
 void Monitor::win_election(epoch_t epoch, set<int>& active) 
 {
   state = STATE_LEADER;
-  leader_since = g_clock.now();
+  leader_since = ceph_clock_now(&g_ceph_context);
   leader = rank;
   quorum = active;
   dout(10) << "win_election, epoch " << epoch << " quorum is " << quorum << dendl;
@@ -743,7 +743,7 @@ bool Monitor::_ms_dispatch(Message *m)
        dout(10) << "setting timeout on session" << dendl;
        // set an initial timeout here, so we will trim this session even if they don't
        // do anything.
-       s->until = g_clock.now();
+       s->until = ceph_clock_now(&g_ceph_context);
        s->until += g_conf->mon_subscribe_interval;
       } else {
        //give it monitor caps; the peer type has been authenticated
@@ -902,7 +902,7 @@ void Monitor::handle_subscribe(MMonSubscribe *m)
     return;
   }
 
-  s->until = g_clock.now();
+  s->until = ceph_clock_now(&g_ceph_context);
   s->until += g_conf->mon_subscribe_interval;
   for (map<string,ceph_mon_subscribe_item>::iterator p = m->what.begin();
        p != m->what.end();
@@ -1036,7 +1036,7 @@ void Monitor::tick()
     (*p)->tick();
   
   // trim sessions
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   xlist<MonSession*>::iterator p = session_map.sessions.begin();
   while (!p.end()) {
     MonSession *s = *p;
index d7b9c0ecc880d9a00c8ca2945eeef2816e3790c8..176b35786d1a5bac07d2e2bae581a907f11fd949 100644 (file)
@@ -87,7 +87,7 @@ void MonmapMonitor::create_pending()
 {
   pending_map = *mon->monmap;
   pending_map.epoch++;
-  pending_map.last_changed = g_clock.now();
+  pending_map.last_changed = ceph_clock_now(&g_ceph_context);
   dout(10) << "create_pending monmap epoch " << pending_map.epoch << dendl;
 }
 
@@ -203,7 +203,7 @@ bool MonmapMonitor::prepare_command(MMonCommand *m)
       }
 
       pending_map.add(name, addr);
-      pending_map.last_changed = g_clock.now();
+      pending_map.last_changed = ceph_clock_now(&g_ceph_context);
       ss << "added mon." << name << " at " << addr;
       getline(ss, rs);
       paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
@@ -219,7 +219,7 @@ bool MonmapMonitor::prepare_command(MMonCommand *m)
 
       entity_addr_t addr = pending_map.get_addr(name);
       pending_map.remove(name);
-      pending_map.last_changed = g_clock.now();
+      pending_map.last_changed = ceph_clock_now(&g_ceph_context);
       ss << "removed mon." << name << " at " << addr << ", there are now " << pending_map.size() << " monitors" ;
       getline(ss, rs);
       // send reply immediately in case we get removed
index 693d36ccb1cb18369ea156d1b0d6e767e4ff7753..20b975483c0c1dbc75c302826a60f21526939f66 100644 (file)
@@ -61,7 +61,7 @@ void OSDMonitor::create_initial(bufferlist& bl)
   newmap.decode(bl);
   newmap.set_epoch(1);
   newmap.set_fsid(mon->monmap->fsid);
-  newmap.created = newmap.modified = g_clock.now();
+  newmap.created = newmap.modified = ceph_clock_now(&g_ceph_context);
 
   // encode into pending incremental
   newmap.encode(pending_inc.fullmap);
@@ -113,7 +113,7 @@ bool OSDMonitor::update_from_paxos()
     if (osdmap.is_down(o) && osdmap.is_in(o) &&
        down_pending_out.count(o) == 0) {
       dout(10) << " adding osd" << o << " to down_pending_out map" << dendl;
-      down_pending_out[o] = g_clock.now();
+      down_pending_out[o] = ceph_clock_now(&g_ceph_context);
     }
 
   if (mon->is_leader()) {
@@ -240,7 +240,7 @@ void OSDMonitor::encode_pending(bufferlist &bl)
           << dendl;
   
   // finalize up pending_inc
-  pending_inc.modified = g_clock.now();
+  pending_inc.modified = ceph_clock_now(&g_ceph_context);
 
   // tell me about it
   for (map<int32_t,uint8_t>::iterator i = pending_inc.new_state.begin();
@@ -990,7 +990,7 @@ void OSDMonitor::tick()
   bool do_propose = false;
 
   // mark down osds out?
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   map<int,utime_t>::iterator i = down_pending_out.begin();
   while (i != down_pending_out.end()) {
     int o = i->first;
@@ -1588,7 +1588,7 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
        ss << "unable to parse address " << m->cmd[3];
       else if (m->cmd[2] == "add") {
 
-       utime_t expires = g_clock.now();
+       utime_t expires = ceph_clock_now(&g_ceph_context);
        double d = 60*60;  // 1 hour default
        if (m->cmd.size() > 4)
          d = atof(m->cmd[4].c_str());
@@ -1637,7 +1637,7 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
              pp = &pending_inc.new_pools[pool];
              *pp = *p;
            }
-           pp->add_snap(snapname.c_str(), g_clock.now());
+           pp->add_snap(snapname.c_str(), ceph_clock_now(&g_ceph_context));
            pp->set_snap_epoch(pending_inc.epoch);
            ss << "created pool " << m->cmd[3] << " snap " << snapname;
            getline(ss, rs);
@@ -1942,7 +1942,7 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m)
 
   switch (m->op) {
   case POOL_OP_CREATE_SNAP:
-    pp->add_snap(m->name.c_str(), g_clock.now());
+    pp->add_snap(m->name.c_str(), ceph_clock_now(&g_ceph_context));
     dout(10) << "create snap in pool " << m->pool << " " << m->name << " seq " << pp->get_snap_epoch() << dendl;
     break;
 
index b9b464e09025f2e57222ba2a41b8fa22c80ffffd..c6a71a4a4f7b0b767cc93542b56cffd37c8ae167 100644 (file)
@@ -129,7 +129,7 @@ bool PGMonitor::update_from_paxos()
   } 
 
   // walk through incrementals
-  utime_t now(g_clock.now());
+  utime_t now(ceph_clock_now(&g_ceph_context));
   while (paxosv > pg_map.version) {
     bufferlist bl;
     bool success = paxos->read(pg_map.version+1, bl);
@@ -185,7 +185,7 @@ void PGMonitor::handle_osd_timeouts()
 {
   if (!mon->is_leader())
     return;
-  utime_t now(g_clock.now());
+  utime_t now(ceph_clock_now(&g_ceph_context));
   utime_t timeo(g_conf->mon_osd_report_timeout, 0);
   if (now - mon->get_leader_since() < timeo) {
     // We haven't been the leader for long enough to consider OSD timeouts
@@ -392,7 +392,7 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats)
     return false;
   }
 
-  last_osd_report[from] = g_clock.now();
+  last_osd_report[from] = ceph_clock_now(&g_ceph_context);
 
   if (!stats->get_orig_source().is_osd() ||
       !mon->osdmon()->osdmap.is_up(from) ||
@@ -695,7 +695,7 @@ void PGMonitor::send_pg_creates()
   dout(10) << "send_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
 
   map<int, MOSDPGCreate*> msg;
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   
   OSDMap *osdmap = &mon->osdmon()->osdmap;
   int max = MIN(osdmap->get_max_osd(), osdmap->crush.get_max_devices());
@@ -739,7 +739,7 @@ void PGMonitor::send_pg_creates()
        p++) {
     dout(10) << "sending pg_create to osd" << p->first << dendl;
     mon->messenger->send_message(p->second, mon->osdmon()->osdmap.get_inst(p->first));
-    last_sent_pg_create[p->first] = g_clock.now();
+    last_sent_pg_create[p->first] = ceph_clock_now(&g_ceph_context);
   }
 }
 
index b0ad7b1d14ab232fe74b3bd86b57ed75d1626e6d..803bf705ca3f6e2ea996dd35d3148f2b3549e1ce 100644 (file)
@@ -478,7 +478,7 @@ void Paxos::commit()
 
   // commit locally
   last_committed++;
-  last_commit_time = g_clock.now();
+  last_commit_time = ceph_clock_now(&g_ceph_context);
   mon->store->put_int(last_committed, machine_name, "last_committed");
 
   // tell everyone
@@ -526,7 +526,7 @@ void Paxos::extend_lease()
   assert(mon->is_leader());
   assert(is_active());
 
-  lease_expire = g_clock.now();
+  lease_expire = ceph_clock_now(&g_ceph_context);
   lease_expire += g_conf->mon_lease;
   acked_lease.clear();
   acked_lease.insert(mon->rank);
@@ -562,7 +562,7 @@ void Paxos::extend_lease()
 
 void Paxos::warn_on_future_time(utime_t t, entity_name_t from)
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   if (t > now) {
     utime_t diff = t - now;
     if (diff > g_conf->mon_clock_drift_allowed) {
@@ -571,7 +571,7 @@ void Paxos::warn_on_future_time(utime_t t, entity_name_t from)
          pow(g_conf->mon_clock_drift_warn_backoff, clock_drift_warned)) {
        mon->clog.warn() << "message from " << from << " was stamped " << diff
                         << "s in the future, clocks not synchronized";
-       last_clock_drift_warn = g_clock.now();
+       last_clock_drift_warn = ceph_clock_now(&g_ceph_context);
        ++clock_drift_warned;
       }
     }
@@ -606,7 +606,7 @@ void Paxos::handle_lease(MMonPaxos *lease)
   MMonPaxos *ack = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_LEASE_ACK, machine_id);
   ack->last_committed = last_committed;
   ack->first_committed = first_committed;
-  ack->lease_timestamp = g_clock.now();
+  ack->lease_timestamp = ceph_clock_now(&g_ceph_context);
   mon->messenger->send_message(ack, lease->get_source_inst());
 
   // (re)set timeout event.
@@ -862,7 +862,7 @@ void Paxos::register_observer(entity_inst_t inst, version_t v)
     observers[inst] = observer = new Observer(inst, v);
   }  
 
-  utime_t timeout = g_clock.now();
+  utime_t timeout = ceph_clock_now(&g_ceph_context);
   timeout += g_conf->paxos_observer_timeout;
   observer->timeout = timeout;
 
@@ -883,7 +883,7 @@ void Paxos::update_observers()
     Observer *observer = iter->second;
 
     // timed out?
-    if (g_clock.now() > observer->timeout) {
+    if (ceph_clock_now(&g_ceph_context) > observer->timeout) {
       delete observer;
       observers.erase(iter++);
       continue;
@@ -920,7 +920,7 @@ void Paxos::update_observers()
 
 bool Paxos::is_readable(version_t v)
 {
-  dout(1) << "is_readable now=" << g_clock.now() << " lease_expire=" << lease_expire
+  dout(1) << "is_readable now=" << ceph_clock_now(&g_ceph_context) << " lease_expire=" << lease_expire
          << " has v" << v << " lc " << last_committed << dendl;
   if (v > last_committed)
     return false;
@@ -929,7 +929,7 @@ bool Paxos::is_readable(version_t v)
     (is_active() || is_updating()) &&
     last_committed > 0 &&           // must have a value
     (mon->get_quorum().size() == 1 ||  // alone, or
-     g_clock.now() < lease_expire);    // have lease
+     ceph_clock_now(&g_ceph_context) < lease_expire);    // have lease
 }
 
 bool Paxos::read(version_t v, bufferlist &bl)
@@ -957,7 +957,7 @@ bool Paxos::is_writeable()
   return
     mon->is_leader() &&
     is_active() &&
-    g_clock.now() < lease_expire;
+    ceph_clock_now(&g_ceph_context) < lease_expire;
 }
 
 bool Paxos::propose_new_value(bufferlist& bl, Context *oncommit)
index 11e6b3838db9c3eeaf8c0095d9c02ddfce31ce02..9769078df223b665caa3922d4f695e0c68d96d6a 100644 (file)
@@ -94,7 +94,7 @@ bool PaxosService::should_propose(double& delay)
   if (paxos->last_committed <= 1)
     delay = 0.0;
   else {
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     if ((now - paxos->last_commit_time) > g_conf->paxos_propose_interval)
       delay = (double)g_conf->paxos_min_wait;
     else
index 5742dca9aacc6f414490190a8294a3d86d5459d7..b0f5c9bee19e5031861693c36a195d6a1d3ab5a7 100644 (file)
@@ -54,7 +54,7 @@ public:
   virtual bool ms_verify_authorizer(Connection *con, int peer_type,
                                    int protocol, bufferlist& authorizer, bufferlist& authorizer_reply,
                                    bool& isvalid) { return false; };
-private:
+protected:
   CephContext *cct;
 };
 
index 046a92c80127d7cf03a723c844494bce9ec387bf..8a768be4336e4a7f5b0dbf975f1bf5db7637c7d7 100644 (file)
@@ -1453,7 +1453,7 @@ void SimpleMessenger::Pipe::fault(bool onconnect, bool onread)
     backoff.set_from_double(g_conf->ms_initial_backoff);
   } else {
     dout(10) << "fault waiting " << backoff << dendl;
-    cond.WaitInterval(pipe_lock, backoff);
+    cond.WaitInterval(&g_ceph_context, pipe_lock, backoff);
     backoff += backoff;
     if (backoff > g_conf->ms_max_backoff)
       backoff.set_from_double(g_conf->ms_max_backoff);
index 4bd8c7afbbc9abf27ce491e502e19bcb62d81152..b2ac38d9e104cf040d7153418e138a51b83b0357 100644 (file)
@@ -281,7 +281,7 @@ private:
     void queue_received(Message *m, int priority);
     
     void queue_received(Message *m) {
-      m->set_recv_stamp(g_clock.now());
+      m->set_recv_stamp(ceph_clock_now(&g_ceph_context));
 
       // this is just to make sure that a changeset is working
       // properly; if you start using the refcounting more and have
index ad8852dee8451a1d7a20040d36947f395d15b16e..a4f4f8305249e856e33cb710931ce5388fab7592 100644 (file)
@@ -765,7 +765,7 @@ void FileJournal::do_write(bufferlist& bl)
           << (hbp.length() ? " + header":"")
           << dendl;
   
-  utime_t from = g_clock.now();
+  utime_t from = ceph_clock_now(&g_ceph_context);
 
   // entry
   off64_t pos = write_pos;
@@ -839,7 +839,7 @@ void FileJournal::do_write(bufferlist& bl)
 #endif
   }
 
-  utime_t lat = g_clock.now() - from;    
+  utime_t lat = ceph_clock_now(&g_ceph_context) - from;    
   dout(20) << "do_write latency " << lat << dendl;
 
   write_lock.Lock();    
index 4b7842ec9dddc17e6f31f81225c1f0695d99e472..27c546fe55176c911ed1dd67e6eb9209ec7d00af 100644 (file)
@@ -3008,10 +3008,10 @@ void FileStore::sync_entry()
     utime_t min_interval;
     min_interval.set_from_double(g_conf->filestore_min_sync_interval);
 
-    utime_t startwait = g_clock.now();
+    utime_t startwait = ceph_clock_now(&g_ceph_context);
     if (!force_sync) {
       dout(20) << "sync_entry waiting for max_interval " << max_interval << dendl;
-      sync_cond.WaitInterval(lock, max_interval);
+      sync_cond.WaitInterval(&g_ceph_context, lock, max_interval);
     } else {
       dout(20) << "sync_entry not waiting, force_sync set" << dendl;
     }
@@ -3021,7 +3021,7 @@ void FileStore::sync_entry()
       force_sync = false;
     } else {
       // wait for at least the min interval
-      utime_t woke = g_clock.now();
+      utime_t woke = ceph_clock_now(&g_ceph_context);
       woke -= startwait;
       dout(20) << "sync_entry woke after " << woke << dendl;
       if (woke < min_interval) {
@@ -3029,7 +3029,7 @@ void FileStore::sync_entry()
        t -= woke;
        dout(20) << "sync_entry waiting for another " << t 
                 << " to reach min interval " << min_interval << dendl;
-       sync_cond.WaitInterval(lock, t);
+       sync_cond.WaitInterval(&g_ceph_context, lock, t);
       }
     }
 
@@ -3039,7 +3039,7 @@ void FileStore::sync_entry()
     lock.Unlock();
     
     if (commit_start()) {
-      utime_t start = g_clock.now();
+      utime_t start = ceph_clock_now(&g_ceph_context);
       uint64_t cp = committing_seq;
 
       SyncEntryTimeout *sync_entry_timeo = new SyncEntryTimeout();
@@ -3119,7 +3119,7 @@ void FileStore::sync_entry()
        }
       }
       
-      utime_t done = g_clock.now();
+      utime_t done = ceph_clock_now(&g_ceph_context);
       done -= start;
       dout(10) << "sync_entry commit took " << done << dendl;
       commit_finish();
index 3de878c35a940628b6e15f282c61a4dd2ebae97d..dd70b63dbf953439b73b3aaafd857081db68009f 100644 (file)
@@ -58,7 +58,7 @@ uint64_t Ager::age_fill(float pc, utime_t until) {
   bl.push_back(bp);
   uint64_t wrote = 0;
   while (1) {
-    if (g_clock.now() > until) break;
+    if (ceph_clock_now(&g_ceph_context) > until) break;
     
     struct statfs st;
     store->statfs(&st);
@@ -199,7 +199,7 @@ void Ager::age(int time,
   store->_fake_writes(true);
   srand(0);
 
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
   utime_t until = start;
   until.sec_ref() += time;
   
@@ -248,7 +248,7 @@ void Ager::age(int time,
   uint64_t wrote = 0;
 
   for (int c=1; c<=count; c++) {
-    if (g_clock.now() > until) break;
+    if (ceph_clock_now(&g_ceph_context) > until) break;
     
     //if (c == 7) start_debug = true;
     
@@ -278,7 +278,7 @@ void Ager::age(int time,
 
     // dump freelist?
     /*
-    if (g_clock.now() > nextfl) {
+    if (ceph_clock_now(&g_ceph_context) > nextfl) {
       elapsed += freelist_inc;
       save_freelist(elapsed);
       nextfl.sec_ref() += freelist_inc;
index 91ec36e14d08a5b5fd949aff0cb73e86351c0dd1..1b94b7687e49b1c0794d7d19fd4043047e02d2f6 100644 (file)
@@ -195,7 +195,7 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, ceph_fsid_t fsid,
       bp.zero();
       bl.push_back(bp);
       dout(0) << "testing disk bandwidth..." << dendl;
-      utime_t start = g_clock.now();
+      utime_t start = ceph_clock_now(&g_ceph_context);
       object_t oid("disk_bw_test");
       for (int i=0; i<1000; i++) {
        ObjectStore::Transaction *t = new ObjectStore::Transaction;
@@ -203,7 +203,7 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, ceph_fsid_t fsid,
        store->queue_transaction(NULL, t);
       }
       store->sync();
-      utime_t end = g_clock.now();
+      utime_t end = ceph_clock_now(&g_ceph_context);
       end -= start;
       dout(0) << "measured " << (1000.0 / (double)end) << " mb/sec" << dendl;
       ObjectStore::Transaction tr;
@@ -1424,7 +1424,7 @@ void OSD::update_heartbeat_peers()
   old_from.swap(heartbeat_from);
   old_con.swap(heartbeat_con);
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   heartbeat_epoch = osdmap->get_epoch();
 
@@ -1657,7 +1657,7 @@ void OSD::handle_osd_ping(MOSDPing *m)
       if (locked && !is_booting())
        _share_map_outgoing(osdmap->get_cluster_inst(from));
       
-      heartbeat_from_stamp[from] = g_clock.now();  // don't let _my_ lag interfere.
+      heartbeat_from_stamp[from] = ceph_clock_now(&g_ceph_context);  // don't let _my_ lag interfere.
       
       // remove from failure lists if needed
       if (failure_pending.count(from)) {
@@ -1697,7 +1697,7 @@ void OSD::heartbeat_entry()
     utime_t w;
     w.set_from_double(wait);
     dout(30) << "heartbeat_entry sleeping for " << wait << dendl;
-    heartbeat_cond.WaitInterval(heartbeat_lock, w);
+    heartbeat_cond.WaitInterval(&g_ceph_context, heartbeat_lock, w);
     dout(30) << "heartbeat_entry woke up" << dendl;
   }
   heartbeat_lock.Unlock();
@@ -1709,7 +1709,7 @@ void OSD::heartbeat_check()
   // we should also have map_lock rdlocked.
 
   // check for incoming heartbeats (move me elsewhere?)
-  utime_t grace = g_clock.now();
+  utime_t grace = ceph_clock_now(&g_ceph_context);
   grace -= g_conf->osd_heartbeat_grace;
   for (map<int, epoch_t>::iterator p = heartbeat_from.begin();
        p != heartbeat_from.end();
@@ -1727,7 +1727,7 @@ void OSD::heartbeat_check()
 
 void OSD::heartbeat()
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   dout(30) << "heartbeat" << dendl;
 
@@ -1851,7 +1851,7 @@ void OSD::tick()
   check_replay_queue();
 
   // mon report?
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   if (now - last_pg_stats_sent > g_conf->osd_mon_report_interval_max) {
     osd_stat_updated = true;
     do_mon_report();
@@ -1897,7 +1897,7 @@ void OSD::do_mon_report()
 {
   dout(7) << "do_mon_report" << dendl;
 
-  utime_t now(g_clock.now());
+  utime_t now(ceph_clock_now(&g_ceph_context));
   last_mon_report = now;
 
   // do any pending reports
@@ -1917,7 +1917,7 @@ void OSD::ms_handle_connect(Connection *con)
     send_alive();
     send_pg_temp();
     send_failures();
-    send_pg_stats(g_clock.now());
+    send_pg_stats(ceph_clock_now(&g_ceph_context));
   }
 }
 
@@ -1988,7 +1988,7 @@ bool OSD::ms_handle_reset(Connection *con)
                << " from " << obc->obs.oi << dendl;
        entity_name_t entity = witer->first;
        watch_info_t& w = obc->obs.oi.watchers[entity];
-       utime_t expire = g_clock.now();
+       utime_t expire = ceph_clock_now(&g_ceph_context);
        expire += w.timeout_seconds;
        obc->unconnected_watchers[entity] = expire;
        dout(10) << " disconnected watch " << w << " by " << entity << " session " << session
@@ -2046,7 +2046,7 @@ void OSD::handle_notify_timeout(void *_notif)
     if (witer != obc->watchers.end()) {
       watch_info_t& w = obc->obs.oi.watchers[notif_iter->first];
       obc->watchers.erase(witer);   // FIXME: hmm? notify timeout may be different than watch timeout?
-      utime_t expire = g_clock.now();
+      utime_t expire = ceph_clock_now(&g_ceph_context);
       expire += w.timeout_seconds;
       obc->unconnected_watchers[notif_iter->first] = expire;
     }
@@ -2099,7 +2099,7 @@ void OSD::queue_want_up_thru(epoch_t want)
     up_thru_wanted = want;
 
     // expedite, a bit.  WARNING this will somewhat delay other mon queries.
-    last_mon_report = g_clock.now();
+    last_mon_report = ceph_clock_now(&g_ceph_context);
     send_alive();
   } else {
     dout(10) << "queue_want_up_thru want " << want << " <= queued " << up_thru_wanted 
@@ -2273,7 +2273,7 @@ void OSD::handle_command(MMonCommand *m)
     ObjectStore::Transaction *cleanupt = new ObjectStore::Transaction;
 
     store->sync_and_flush();
-    utime_t start = g_clock.now();
+    utime_t start = ceph_clock_now(&g_ceph_context);
     for (uint64_t pos = 0; pos < count; pos += bsize) {
       char nm[30];
       snprintf(nm, sizeof(nm), "disk_bw_test_%lld", (long long)pos);
@@ -2285,7 +2285,7 @@ void OSD::handle_command(MMonCommand *m)
       cleanupt->remove(coll_t::META_COLL, soid);
     }
     store->sync_and_flush();
-    utime_t end = g_clock.now();
+    utime_t end = ceph_clock_now(&g_ceph_context);
 
     // clean up
     store->queue_transaction(NULL, cleanupt);
@@ -2382,7 +2382,7 @@ void OSD::handle_command(MMonCommand *m)
       clog.info() << "kicking recovery queue. set osd_recovery_delay_start "
                    << "to " << g_conf->osd_recovery_delay_start << "\n";
 
-      defer_recovery_until = g_clock.now();
+      defer_recovery_until = ceph_clock_now(&g_ceph_context);
       defer_recovery_until += g_conf->osd_recovery_delay_start;
       recovery_wq.kick();
     }
@@ -2873,7 +2873,7 @@ void OSD::sched_scrub()
   dout(20) << "sched_scrub" << dendl;
 
   pair<utime_t,pg_t> pos;
-  utime_t max = g_clock.now();
+  utime_t max = ceph_clock_now(&g_ceph_context);
   max -= g_conf->osd_scrub_max_interval;
   
   sched_scrub_lock.Lock();
@@ -3186,7 +3186,7 @@ void OSD::handle_osd_map(MOSDMap *m)
 
     superblock.current_epoch = cur;
     advance_map(t);
-    had_map_since = g_clock.now();
+    had_map_since = ceph_clock_now(&g_ceph_context);
   }
 
   C_Contexts *fin = new C_Contexts(&g_ceph_context);
@@ -4718,7 +4718,7 @@ void OSD::generate_backlog(PG *pg)
 
 void OSD::check_replay_queue()
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   list< pair<pg_t,utime_t> > pgids;
   replay_queue_lock.Lock();
   while (!replay_queue.empty() &&
@@ -4775,7 +4775,7 @@ bool OSD::_recover_now()
             << " >= max " << g_conf->osd_recovery_max_active << dendl;
     return false;
   }
-  if (g_clock.now() < defer_recovery_until) {
+  if (ceph_clock_now(&g_ceph_context) < defer_recovery_until) {
     dout(15) << "_recover_now defer until " << defer_recovery_until << dendl;
     return false;
   }
@@ -4975,7 +4975,7 @@ void OSD::handle_op(MOSDOp *op)
   // ...
   throttle_op_queue();
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   int r = init_op_flags(op);
   if (r) {
index 906bfcb72762200842d6a63831bf288702d1fd13..db31c569f66d5c29a199c6eb08a8f4fab39b5713 100644 (file)
@@ -739,7 +739,7 @@ protected:
        osd->recovery_queue.push_back(&pg->recovery_item);
 
        if (g_conf->osd_recovery_delay_start > 0) {
-         osd->defer_recovery_until = g_clock.now();
+         osd->defer_recovery_until = ceph_clock_now(&g_ceph_context);
          osd->defer_recovery_until += g_conf->osd_recovery_delay_start;
        }
        return true;
index 0a68877e05e815146fb089f0519f87fdc9f4c877..a4a3e93ea61b2c54ae163931f3688bdf3fbf19b1 100644 (file)
@@ -184,7 +184,7 @@ void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid,
           << lpg_bits << " lpg bits" << dendl;
   epoch = e;
   set_fsid(fsid);
-  created = modified = g_clock.now();
+  created = modified = ceph_clock_now(&g_ceph_context);
 
   set_max_osd(nosd);
 
index 643002f96240945771d7fd8c766668a2672ab758..403169d0ba82aa6fe5c0d03d745ea4e84e9139ab 100644 (file)
@@ -1120,7 +1120,7 @@ void PG::mark_all_unfound_as_lost(ObjectStore::Transaction& t)
   log.print(*_dout);
   *_dout << dendl;
 
-  utime_t mtime = g_clock.now();
+  utime_t mtime = ceph_clock_now(&g_ceph_context);
   eversion_t old_last_update = info.last_update;
   info.last_update.epoch = osd->osdmap->get_epoch();
   map<sobject_t, Missing::item>::iterator m = missing.missing.begin();
@@ -1479,7 +1479,7 @@ void PG::activate(ObjectStore::Transaction& t, list<Context*>& tfin,
   assert(!is_active());
   // -- crash recovery?
   if (is_crashed()) {
-    replay_until = g_clock.now();
+    replay_until = ceph_clock_now(&g_ceph_context);
     replay_until += g_conf->osd_replay_window;
     dout(10) << "crashed, allowing op replay for " << g_conf->osd_replay_window
             << " until " << replay_until << dendl;
@@ -2565,7 +2565,7 @@ bool PG::sched_scrub()
   }
 
   // just scrubbed?
-  if (info.history.last_scrub_stamp + g_conf->osd_scrub_min_interval > g_clock.now()) {
+  if (info.history.last_scrub_stamp + g_conf->osd_scrub_min_interval > ceph_clock_now(&g_ceph_context)) {
     dout(20) << "sched_scrub: just scrubbed, skipping" << dendl;
     return true;
   }
@@ -3319,7 +3319,7 @@ void PG::scrub_finalize() {
   // finish up
   osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp);
   info.history.last_scrub = info.last_update;
-  info.history.last_scrub_stamp = g_clock.now();
+  info.history.last_scrub_stamp = ceph_clock_now(&g_ceph_context);
   osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp);
 
   {
@@ -4683,9 +4683,9 @@ void PG::RecoveryState::RecoveryMachine::log_enter(const char *state_name)
 
 void PG::RecoveryState::RecoveryMachine::log_exit(const char *state_name, utime_t enter_time)
 {
-  utime_t dur = g_clock.now() - enter_time;
+  utime_t dur = ceph_clock_now(&g_ceph_context) - enter_time;
   dout(20) << "exit " << state_name << " " << dur << " " << event_count << " " << event_time << dendl;
-  pg->osd->pg_recovery_stats.log_exit(state_name, g_clock.now() - enter_time,
+  pg->osd->pg_recovery_stats.log_exit(state_name, ceph_clock_now(&g_ceph_context) - enter_time,
                                      event_count, event_time);
   event_count = 0;
   event_time = utime_t();
index 2eacd963d1324c4aaef568ed199710a2a414fbf4..de82541b3a9fb76d8d4f744b13900b7e7c40b151 100644 (file)
@@ -866,12 +866,12 @@ public:
       assert(!rctx);
       rctx = new_ctx;
       if (rctx)
-       rctx->start_time = g_clock.now();
+       rctx->start_time = ceph_clock_now(&g_ceph_context);
     }
 
     void end_handle() {
       if (rctx) {
-       utime_t dur = g_clock.now() - rctx->start_time;
+       utime_t dur = ceph_clock_now(&g_ceph_context) - rctx->start_time;
        machine.event_time += dur;
       }
       machine.event_count++;
@@ -995,7 +995,7 @@ public:
       const char *state_name;
       utime_t enter_time;
       const char *get_state_name() { return state_name; }
-      NamedState() : enter_time(g_clock.now()) {}
+      NamedState() : enter_time(ceph_clock_now(&g_ceph_context)) {}
       virtual ~NamedState() {}
     };
 
index 82e86a01d3691a4fa5b45f98b0599928a66e2d63..7cfad83a113f4e86b4b48c227b37018a29a5e48a 100644 (file)
@@ -569,7 +569,7 @@ void ReplicatedPG::do_op(MOSDOp *op)
   }
 
   // note my stats
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   // note some basic context for op replication that prepare_transaction may clobber
   eversion_t old_last_update = log.head;
@@ -645,7 +645,7 @@ void ReplicatedPG::log_op_stats(OpContext *ctx)
     osd->logger->inc(l_osd_c_rd);
     osd->logger->inc(l_osd_c_rdb, ctx->outdata.length());
 
-    utime_t now = g_clock.now();
+    utime_t now = ceph_clock_now(&g_ceph_context);
     utime_t diff = now;
     diff -= ctx->op->get_recv_stamp();
     //dout(20) <<  "do_op " << ctx->reqid << " total op latency " << diff << dendl;
@@ -798,7 +798,7 @@ bool ReplicatedPG::snap_trimmer()
       tid_t rep_tid = osd->get_tid();
       osd_reqid_t reqid(osd->cluster_messenger->get_myname(), 0, rep_tid);
       OpContext *ctx = new OpContext(NULL, reqid, ops, &obc->obs, this);
-      ctx->mtime = g_clock.now();
+      ctx->mtime = ceph_clock_now(&g_ceph_context);
 
       ctx->at_version.epoch = osd->osdmap->get_epoch();
       ctx->at_version.version = log.head.version + 1;
@@ -2302,7 +2302,7 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx)
       }
 
       // unconnected
-      utime_t now = g_clock.now();
+      utime_t now = ceph_clock_now(&g_ceph_context);
       for (map<entity_name_t, utime_t>::iterator q = obc->unconnected_watchers.begin();
           q != obc->unconnected_watchers.end();
           q++) {
@@ -2688,7 +2688,7 @@ void ReplicatedPG::eval_repop(RepGather *repop)
        repop->sent_ack = true;
       }
       
-      utime_t now = g_clock.now();
+      utime_t now = ceph_clock_now(&g_ceph_context);
       now -= repop->start;
       osd->logger->finc(l_osd_rlsum, now);
       osd->logger->inc(l_osd_rlnum, 1);
@@ -2788,7 +2788,7 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop(OpContext *ctx, ObjectContext *
     repop->waitfor_disk.insert(osd);
   }
 
-  repop->start = g_clock.now();
+  repop->start = ceph_clock_now(&g_ceph_context);
 
   repop_queue.push_back(&repop->queue_item);
   repop_map[repop->rep_tid] = repop;
@@ -2901,7 +2901,7 @@ ReplicatedPG::ObjectContext *ReplicatedPG::get_object_context(const sobject_t& s
 
       if (!obc->obs.oi.watchers.empty()) {
        // populate unconnected_watchers
-       utime_t now = g_clock.now();
+       utime_t now = ceph_clock_now(&g_ceph_context);
        for (map<entity_name_t, watch_info_t>::iterator p = obc->obs.oi.watchers.begin();
             p != obc->obs.oi.watchers.end();
             p++) {
@@ -3211,7 +3211,7 @@ void ReplicatedPG::sub_op_modify_applied(RepModify *rm)
   if (!rm->committed) {
     // send ack to acker only if we haven't sent a commit already
     MOSDSubOpReply *ack = new MOSDSubOpReply(rm->op, 0, osd->osdmap->get_epoch(), CEPH_OSD_FLAG_ACK);
-    ack->set_peer_stat(osd->get_my_stat_for(g_clock.now(), rm->ackerosd));
+    ack->set_peer_stat(osd->get_my_stat_for(ceph_clock_now(&g_ceph_context), rm->ackerosd));
     ack->set_priority(CEPH_MSG_PRIO_HIGH); // this better match commit priority!
     osd->cluster_messenger->
       send_message(ack, osd->osdmap->get_cluster_inst(rm->ackerosd));
@@ -3254,7 +3254,7 @@ void ReplicatedPG::sub_op_modify_commit(RepModify *rm)
     MOSDSubOpReply *commit = new MOSDSubOpReply(rm->op, 0, osd->osdmap->get_epoch(), CEPH_OSD_FLAG_ONDISK);
     commit->set_last_complete_ondisk(rm->last_complete);
     commit->set_priority(CEPH_MSG_PRIO_HIGH); // this better match ack priority!
-    commit->set_peer_stat(osd->get_my_stat_for(g_clock.now(), rm->ackerosd));
+    commit->set_peer_stat(osd->get_my_stat_for(ceph_clock_now(&g_ceph_context), rm->ackerosd));
     osd->cluster_messenger->
       send_message(commit, osd->osdmap->get_cluster_inst(rm->ackerosd));
   }
index f2a46811d01931c0b66e2cb97b5f0b67bbdd3c24..819cf61282c759d13b7685a0cd3e223223a1cb6c 100644 (file)
@@ -334,7 +334,7 @@ void Journaler::write_head(Context *oncommit)
   last_written.write_pos = safe_pos;
   dout(10) << "write_head " << last_written << dendl;
   
-  last_wrote_head = g_clock.now();
+  last_wrote_head = ceph_clock_now(&g_ceph_context);
 
   bufferlist bl;
   ::encode(last_written, bl);
@@ -342,7 +342,7 @@ void Journaler::write_head(Context *oncommit)
   
   object_t oid = file_object_t(ino, 0);
   object_locator_t oloc(pg_pool);
-  objecter->write_full(oid, oloc, snapc, bl, g_clock.now(), 0, 
+  objecter->write_full(oid, oloc, snapc, bl, ceph_clock_now(&g_ceph_context), 0, 
                       NULL, 
                       new C_WriteHead(this, last_written, oncommit));
 }
@@ -385,7 +385,7 @@ void Journaler::_finish_flush(int r, uint64_t start, utime_t stamp)
 
   // calc latency?
   if (logger) {
-    utime_t lat = g_clock.now();
+    utime_t lat = ceph_clock_now(&g_ceph_context);
     lat -= stamp;
     logger->favg(logger_key_lat, lat);
   }
@@ -499,7 +499,7 @@ void Journaler::_do_flush(unsigned amount)
   
   // submit write for anything pending
   // flush _start_ pos to _finish_flush
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   SnapContext snapc;
 
   Context *onsafe = new C_Flush(this, flush_pos, now);  // on COMMIT
@@ -515,7 +515,7 @@ void Journaler::_do_flush(unsigned amount)
   }
 
   filer.write(ino, &layout, snapc,
-             flush_pos, len, write_bl, g_clock.now(),
+             flush_pos, len, write_bl, ceph_clock_now(&g_ceph_context),
              0,
              NULL, onsafe);
 
@@ -586,7 +586,7 @@ void Journaler::flush(Context *onsafe)
   }
 
   // write head?
-  if (last_wrote_head.sec() + g_conf->journaler_write_head_interval < g_clock.now().sec()) {
+  if (last_wrote_head.sec() + g_conf->journaler_write_head_interval < ceph_clock_now(&g_ceph_context).sec()) {
     write_head();
   }
 }
@@ -635,7 +635,7 @@ void Journaler::_issue_prezero()
     }
     SnapContext snapc;
     Context *c = new C_Journaler_Prezero(this, prezeroing_pos, len);
-    filer.zero(ino, &layout, snapc, prezeroing_pos, len, g_clock.now(), 0, NULL, c);
+    filer.zero(ino, &layout, snapc, prezeroing_pos, len, ceph_clock_now(&g_ceph_context), 0, NULL, c);
     prezeroing_pos += len;
   }
 }
@@ -989,7 +989,7 @@ void Journaler::trim()
   uint64_t first = trimming_pos / period;
   uint64_t num = (trim_to - trimming_pos) / period;
   SnapContext snapc;
-  filer.purge_range(ino, &layout, snapc, first, num, g_clock.now(), 0, 
+  filer.purge_range(ino, &layout, snapc, first, num, ceph_clock_now(&g_ceph_context), 0, 
                    new C_Trim(this, trim_to));
   trimming_pos = trim_to;  
 }
index f713afa726db7b39d2ed1c48add89d181c7c6112..139bc54e9ebccdc63f5a5d35ef745ad06bb210e5 100644 (file)
@@ -736,7 +736,7 @@ void ObjectCacher::bh_write_commit(int poolid, sobject_t oid, loff_t start, uint
 
 void ObjectCacher::flush(loff_t amount)
 {
-  utime_t cutoff = g_clock.now();
+  utime_t cutoff = ceph_clock_now(&g_ceph_context);
   //cutoff.sec_ref() -= g_conf->client_oc_max_dirty_age;
 
   dout(10) << "flush " << amount << dendl;
@@ -960,7 +960,7 @@ int ObjectCacher::readx(OSDRead *rd, ObjectSet *oset, Context *onfinish)
 
 int ObjectCacher::writex(OSDWrite *wr, ObjectSet *oset)
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   
   for (vector<ObjectExtent>::iterator ex_it = wr->extents.begin();
        ex_it != wr->extents.end();
@@ -1071,7 +1071,7 @@ void ObjectCacher::flusher_entry()
       }
       else {
         // check tail of lru for old dirty items
-        utime_t cutoff = g_clock.now();
+        utime_t cutoff = ceph_clock_now(&g_ceph_context);
         cutoff.sec_ref()--;
         BufferHead *bh = 0;
         while ((bh = (BufferHead*)lru_dirty.lru_get_next_expire()) != 0 &&
@@ -1083,7 +1083,7 @@ void ObjectCacher::flusher_entry()
       }
     }
     if (flusher_stop) break;
-    flusher_cond.WaitInterval(lock, utime_t(1,0));
+    flusher_cond.WaitInterval(&g_ceph_context, lock, utime_t(1,0));
   }
   lock.Unlock();
   dout(10) << "flusher finish" << dendl;
index 915df2814b4a22e6ce0804fccd6f6a79f01e2936..6cee31561c84e6a065683c5c8263fe66a16ea6b8 100644 (file)
@@ -416,7 +416,7 @@ class ObjectCacher {
   void mark_dirty(BufferHead *bh) { 
     bh_set_state(bh, BufferHead::STATE_DIRTY); 
     lru_dirty.lru_touch(bh);
-    //bh->set_dirty_stamp(g_clock.now());
+    //bh->set_dirty_stamp(ceph_clock_now(&g_ceph_context));
   };
 
   void bh_add(Object *ob, BufferHead *bh) {
index cc785d221ec28683abc0f499211edeae8a3c788f..1e17cd301681f9aa0dd209cf0fb39aa18f760360 100644 (file)
@@ -409,7 +409,7 @@ void Objecter::tick()
   set<OSDSession*> toping;
 
   // look for laggy requests
-  utime_t cutoff = g_clock.now();
+  utime_t cutoff = ceph_clock_now(&g_ceph_context);
   cutoff -= g_conf->objecter_timeout;  // timeout
 
   for (hash_map<tid_t,Op*>::iterator p = ops.begin();
@@ -440,7 +440,7 @@ void Objecter::tick()
 
 void Objecter::resend_mon_ops()
 {
-  utime_t cutoff = g_clock.now();
+  utime_t cutoff = ceph_clock_now(&g_ceph_context);
   cutoff -= g_conf->objecter_mon_retry_interval;
 
 
@@ -651,7 +651,7 @@ void Objecter::send_op(Op *op)
 
   op->paused = false;
   op->incarnation = op->session->incarnation;
-  op->stamp = g_clock.now();
+  op->stamp = ceph_clock_now(&g_ceph_context);
 
   MOSDOp *m = new MOSDOp(client_inc, op->tid, 
                         op->oid, op->oloc, op->pgid, osdmap->get_epoch(),
@@ -1081,7 +1081,7 @@ void Objecter::pool_op_submit(PoolOp *op) {
   if (op->snapid) m->snapid = op->snapid;
   if (op->crush_rule) m->crush_rule = op->crush_rule;
   monc->send_mon_message(m);
-  op->last_submit = g_clock.now();
+  op->last_submit = ceph_clock_now(&g_ceph_context);
 }
 
 /**
@@ -1142,7 +1142,7 @@ void Objecter::poolstat_submit(PoolStatOp *op)
 {
   dout(10) << "poolstat_submit " << op->tid << dendl;
   monc->send_mon_message(new MGetPoolStats(monc->get_fsid(), op->tid, op->pools, last_seen_pgmap_version));
-  op->last_submit = g_clock.now();
+  op->last_submit = ceph_clock_now(&g_ceph_context);
 }
 
 void Objecter::handle_get_pool_stats_reply(MGetPoolStatsReply *m)
@@ -1184,7 +1184,7 @@ void Objecter::fs_stats_submit(StatfsOp *op)
 {
   dout(10) << "fs_stats_submit" << op->tid << dendl;
   monc->send_mon_message(new MStatfs(monc->get_fsid(), op->tid, last_seen_pgmap_version));
-  op->last_submit = g_clock.now();
+  op->last_submit = ceph_clock_now(&g_ceph_context);
 }
 
 void Objecter::handle_fs_stats_reply(MStatfsReply *m) {
index 84635e4029591a5817aa0418b868f26dcf3061f8..5142222023ef351c7928bbc1f484ef9c62143217 100644 (file)
@@ -167,10 +167,10 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
 
   pthread_create(&print_thread, NULL, status_printer, (void *)data);
   dataLock.Lock();
-  data->start_time = g_clock.now();
+  data->start_time = ceph_clock_now(&g_ceph_context);
   dataLock.Unlock();
   for (int i = 0; i<concurrentios; ++i) {
-    start_times[i] = g_clock.now();
+    start_times[i] = ceph_clock_now(&g_ceph_context);
     completions[i] = rados.aio_create_completion((void *) &cond, 0,
                                                 &_aio_cb);
     r = io_ctx.aio_write(name[i], completions[i], *contents[i], data->object_size, 0);
@@ -192,7 +192,7 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
 
   runtime.set_from_double(secondsToRun);
   stopTime = data->start_time + runtime;
-  while( g_clock.now() < stopTime ) {
+  while( ceph_clock_now(&g_ceph_context) < stopTime ) {
     dataLock.Lock();
     while (1) {
       for (slot = 0; slot < concurrentios; ++slot) {
@@ -219,7 +219,7 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
       dataLock.Unlock();
       goto ERR;
     }
-    data->cur_latency = g_clock.now() - start_times[slot];
+    data->cur_latency = ceph_clock_now(&g_ceph_context) - start_times[slot];
     total_latency += data->cur_latency;
     if( data->cur_latency > data->max_latency) data->max_latency = data->cur_latency;
     if (data->cur_latency < data->min_latency) data->min_latency = data->cur_latency;
@@ -229,11 +229,11 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
     dataLock.Unlock();
     completions[slot]->release();
     completions[slot] = 0;
-    timePassed = g_clock.now() - data->start_time;
+    timePassed = ceph_clock_now(&g_ceph_context) - data->start_time;
 
     //write new stuff to rados, then delete old stuff
     //and save locations of new stuff for later deletion
-    start_times[slot] = g_clock.now();
+    start_times[slot] = ceph_clock_now(&g_ceph_context);
     completions[slot] = rados.aio_create_completion((void *) &cond, 0, &_aio_cb);
     r = io_ctx.aio_write(newName, completions[slot], *newContents, data->object_size, 0);
     if (r < 0) {//naughty; doesn't clean up heap space.
@@ -258,7 +258,7 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
       dataLock.Unlock();
       goto ERR;
     }
-    data->cur_latency = g_clock.now() - start_times[slot];
+    data->cur_latency = ceph_clock_now(&g_ceph_context) - start_times[slot];
     total_latency += data->cur_latency;
     if (data->cur_latency > data->max_latency) data->max_latency = data->cur_latency;
     if (data->cur_latency < data->min_latency) data->min_latency = data->cur_latency;
@@ -272,7 +272,7 @@ int write_bench(librados::Rados& rados, librados::IoCtx& io_ctx,
     delete contents[slot];
   }
 
-  timePassed = g_clock.now() - data->start_time;
+  timePassed = ceph_clock_now(&g_ceph_context) - data->start_time;
   dataLock.Lock();
   data->done = true;
   dataLock.Unlock();
@@ -352,13 +352,13 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
   pthread_create(&print_thread, NULL, status_printer, (void *)data);
 
   dataLock.Lock();
-  data->start_time = g_clock.now();
+  data->start_time = ceph_clock_now(&g_ceph_context);
   dataLock.Unlock();
   utime_t finish_time = data->start_time + time_to_run;
   //start initial reads
   for (int i = 0; i < concurrentios; ++i) {
     index[i] = i;
-    start_times[i] = g_clock.now();
+    start_times[i] = ceph_clock_now(&g_ceph_context);
     completions[i] = rados.aio_create_completion((void *) &cond, &_aio_cb, 0);
     r = io_ctx.aio_read(name[i], completions[i], contents[i], data->object_size, 0);
     if (r < 0) { //naughty, doesn't clean up heap -- oh, or handle the print thread!
@@ -376,7 +376,7 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
   char* newName;
   bufferlist *cur_contents;
 
-  while (seconds_to_run && (g_clock.now() < finish_time) &&
+  while (seconds_to_run && (ceph_clock_now(&g_ceph_context) < finish_time) &&
       write_data->finished > data->started) {
     dataLock.Lock();
     while (1) {
@@ -403,7 +403,7 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
       dataLock.Unlock();
       goto ERR;
     }
-    data->cur_latency = g_clock.now() - start_times[slot];
+    data->cur_latency = ceph_clock_now(&g_ceph_context) - start_times[slot];
     total_latency += data->cur_latency;
     if( data->cur_latency > data->max_latency) data->max_latency = data->cur_latency;
     if (data->cur_latency < data->min_latency) data->min_latency = data->cur_latency;
@@ -416,7 +416,7 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
     cur_contents = contents[slot];
 
     //start new read and check data if requested
-    start_times[slot] = g_clock.now();
+    start_times[slot] = ceph_clock_now(&g_ceph_context);
     contents[slot] = new bufferlist();
     completions[slot] = rados.aio_create_completion((void *) &cond, &_aio_cb, 0);
     r = io_ctx.aio_read(newName, completions[slot], contents[slot], data->object_size, 0);
@@ -448,7 +448,7 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
       dataLock.Unlock();
       goto ERR;
     }
-    data->cur_latency = g_clock.now() - start_times[slot];
+    data->cur_latency = ceph_clock_now(&g_ceph_context) - start_times[slot];
     total_latency += data->cur_latency;
     if (data->cur_latency > data->max_latency) data->max_latency = data->cur_latency;
     if (data->cur_latency < data->min_latency) data->min_latency = data->cur_latency;
@@ -467,7 +467,7 @@ int seq_read_bench(librados::Rados& rados, librados::IoCtx& io_ctx, int seconds_
     delete contents[slot];
   }
 
-  runtime = g_clock.now() - data->start_time;
+  runtime = ceph_clock_now(&g_ceph_context) - data->start_time;
   dataLock.Lock();
   data->done = true;
   dataLock.Unlock();
@@ -534,7 +534,7 @@ void *status_printer(void * data_store) {
       / (1024*1024)
       / cycleSinceChange;
     avg_bandwidth = (double) (data->trans_size) * (data->finished)
-      / (double)(g_clock.now() - data->start_time) / (1024*1024);
+      / (double)(ceph_clock_now(&g_ceph_context) - data->start_time) / (1024*1024);
     if (previous_writes != data->finished) {
       previous_writes = data->finished;
       cycleSinceChange = 0;
@@ -561,7 +561,7 @@ void *status_printer(void * data_store) {
     }
     ++i;
     ++cycleSinceChange;
-    cond.WaitInterval(dataLock, ONE_SECOND);
+    cond.WaitInterval(&g_ceph_context, dataLock, ONE_SECOND);
   }
   dataLock.Unlock();
   return NULL;
index beecdd8da686afd09699dbcf828d4db6abc77244..25371631e83401fb2ad9b24c7fef3c748471734e 100644 (file)
@@ -53,7 +53,7 @@ int rgw_log_op(struct req_state *s)
     entry.owner = s->acl->get_owner().get_id();
 
   entry.time = s->time;
-  entry.total_time = g_clock.now() - s->time;
+  entry.total_time = ceph_clock_now(&g_ceph_context) - s->time;
   entry.bytes_sent = s->bytes_sent;
   entry.bytes_received = s->bytes_received;
   if (s->err.http_ret) {
index ab21f380c3bb41d90832aa25c50ebc8e1a89d563..e2ba0adf4c190ca16ca25a43fe814e51cf87df42 100644 (file)
@@ -562,7 +562,7 @@ void RGWPutObj::execute()
       info.num = atoi(part_num.c_str());
       info.etag = etag;
       info.size = s->obj_size;
-      info.modified = g_clock.now();
+      info.modified = ceph_clock_now(&g_ceph_context);
       ::encode(info, bl);
       RGW_LOG(0) << "JJJ name=" << p << "bl.length()=" << bl.length() << dendl;
       meta_attrs[p] = bl;
@@ -1246,7 +1246,7 @@ void RGWHandler::init_state(struct req_state *s, struct fcgx_state *fcgx)
   s->os_auth_token = NULL;
   s->os_user = NULL;
   s->os_groups = NULL;
-  s->time = g_clock.now();
+  s->time = ceph_clock_now(&g_ceph_context);
   s->user.clear();
   s->perm_mask = 0;
 }
index 8e051045d6087a60473977ccd18400820cc0a48f..c0c6b852d3758f5d5266852873ec6b3648b21985 100644 (file)
@@ -44,7 +44,7 @@ static int encode_token(string& os_user, string& key, bufferlist& bl)
   if (ret < 0)
     return ret;
 
-  utime_t expiration = g_clock.now();
+  utime_t expiration = ceph_clock_now(&g_ceph_context);
   expiration += RGW_OS_TOKEN_EXPIRATION; // 15 minutes
 
   ret = build_token(os_user, key, nonce, expiration, bl);
@@ -87,8 +87,8 @@ int rgw_os_verify_signed_token(const char *token, RGWUserInfo& info)
     RGW_LOG(0) << "failed to decode token" << dendl;
     return -EINVAL;
   }
-  if (expiration < g_clock.now()) {
-    RGW_LOG(0) << "old timed out token was used now=" << g_clock.now() << " token.expiration=" << expiration << dendl;
+  if (expiration < ceph_clock_now(&g_ceph_context)) {
+    RGW_LOG(0) << "old timed out token was used now=" << ceph_clock_now(&g_ceph_context) << " token.expiration=" << expiration << dendl;
     return -EPERM;
   }
 
index 0af3cc66c1c40ced8826aedea74afb80762d1a89..8583f8d3c47d604d74ede61fb5637de82c3d0d5e 100644 (file)
@@ -78,14 +78,14 @@ struct C_Ack : public Context {
   off_t off;
   C_Ack(off_t o) : off(o) {}
   void finish(int r) {
-    set_ack(off, g_clock.now());
+    set_ack(off, ceph_clock_now(&g_ceph_context));
   }
 };
 struct C_Commit : public Context {
   off_t off;
   C_Commit(off_t o) : off(o) {}
   void finish(int r) {
-    set_commit(off, g_clock.now());
+    set_commit(off, ceph_clock_now(&g_ceph_context));
   }
 };
 
@@ -133,7 +133,7 @@ int main(int argc, const char **argv)
   ft.create_collection(coll_t());
   fs->apply_transaction(ft);
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
   utime_t end = now;
   end += seconds;
   off_t pos = 0;
@@ -142,7 +142,7 @@ int main(int argc, const char **argv)
   while (now < end) {
     sobject_t poid(object_t("streamtest"), 0);
 
-    set_start(pos, g_clock.now());
+    set_start(pos, ceph_clock_now(&g_ceph_context));
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
     t->write(coll_t(), poid, pos, bytes, bl);
     fs->queue_transaction(NULL, t, new C_Ack(pos), new C_Commit(pos));
index a32311325dd16af18b0bf8a089cf328c759f05bc..89e60b66d1bdc6b3fd27c14319680d5c3ec53958 100644 (file)
@@ -94,7 +94,7 @@ static int basic_timer_test(T &timer, Mutex *lock)
     if (lock)
       lock->Lock();
     utime_t inc(2 * i, 0);
-    utime_t t = g_clock.now() + inc;
+    utime_t t = ceph_clock_now(&g_ceph_context) + inc;
     timer.add_event_at(t, test_contexts[i]);
     if (lock)
       lock->Unlock();
@@ -133,7 +133,7 @@ static int test_out_of_order_insertion(SafeTimer &timer, Mutex *lock)
 
   {
     utime_t inc(100, 0);
-    utime_t t = g_clock.now() + inc;
+    utime_t t = ceph_clock_now(&g_ceph_context) + inc;
     lock->Lock();
     timer.add_event_at(t, test_contexts[0]);
     lock->Unlock();
@@ -141,7 +141,7 @@ static int test_out_of_order_insertion(SafeTimer &timer, Mutex *lock)
 
   {
     utime_t inc(2, 0);
-    utime_t t = g_clock.now() + inc;
+    utime_t t = ceph_clock_now(&g_ceph_context) + inc;
     lock->Lock();
     timer.add_event_at(t, test_contexts[1]);
     lock->Unlock();
@@ -182,7 +182,7 @@ static int safe_timer_cancel_all_test(SafeTimer &safe_timer, Mutex& safe_timer_l
   safe_timer_lock.Lock();
   for (int i = 0; i < MAX_TEST_CONTEXTS; ++i) {
     utime_t inc(4 * i, 0);
-    utime_t t = g_clock.now() + inc;
+    utime_t t = ceph_clock_now(&g_ceph_context) + inc;
     safe_timer.add_event_at(t, test_contexts[i]);
   }
   safe_timer_lock.Unlock();
@@ -220,7 +220,7 @@ static int safe_timer_cancellation_test(SafeTimer &safe_timer, Mutex& safe_timer
   safe_timer_lock.Lock();
   for (int i = 0; i < MAX_TEST_CONTEXTS; ++i) {
     utime_t inc(4 * i, 0);
-    utime_t t = g_clock.now() + inc;
+    utime_t t = ceph_clock_now(&g_ceph_context) + inc;
     safe_timer.add_event_at(t, test_contexts[i]);
   }
   safe_timer_lock.Unlock();
index 69985dfe37ba8f60e27e3b56804744f374666450..8595455836b769e2cae59fd5f8abde3335821a1b 100644 (file)
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
   }
   
  
-  utime_t start = g_clock.now();
+  utime_t start = ceph_clock_now(&g_ceph_context);
   while (loop++ < count) {
     ret = safe_write(fd, buf, bsize);
     if (ret)
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
   }
   ::fsync(fd);
   ::close(fd);
-  utime_t end = g_clock.now();
+  utime_t end = ceph_clock_now(&g_ceph_context);
   end -= start;
 
 
index adfa95d4a2deae7daf4651b3df28665eb837bf8a..42548325de5facb8cc22c93323af4e908c35371c 100644 (file)
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
     
     int s = blocks*4096;
 
-    utime_t start = g_clock.now();
+    utime_t start = ceph_clock_now(&g_ceph_context);
     for (int i=0; i<count; i++) {
       off64_t so, o = (lrand48() % numblocks) * 4096;
       //cout << "s = " << s << " o = " << o << endl;
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
       //int r = ::read(fd, buf, s);
       if (r < 0) cout << "r = " << r << " " << strerror(errno) << endl;
     }
-    utime_t end = g_clock.now();
+    utime_t end = ceph_clock_now(&g_ceph_context);
     
     double timeper = end - start;
     timeper /= count;
index 6eef26d5532827912784ce34c6e08ea39a659c87..407a722adf660b250eb75aad79c1cbbb69fb2389 100644 (file)
@@ -50,10 +50,10 @@ int main(int argc, char **argv)
       so = o + 4096*((rand() % range) );//- range/2);
       //cout << o << " " << so << " " << (so-o) << endl;
 
-      utime_t start = g_clock.now();
+      utime_t start = ceph_clock_now(&g_ceph_context);
       lseek64(fd, so, SEEK_SET);
       r = ::read(fd, buf, blocks*4096);
-      utime_t end = g_clock.now();
+      utime_t end = ceph_clock_now(&g_ceph_context);
       timeper += (end-start);
     }
     
index a3194489e48866075d670df8c1dbaf86c6ac6f6d..a69dd73dc2b1897c413f288b05b340a1d0000a5d 100644 (file)
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
   DecayCounter dc(hl);
   RealCounter rc;
 
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   for (int ms=0; ms < 300*1000; ms++) {
        if (ms % 30000 == 0) {
index b67afb20b7dc83c60eb55ee87fbe6a4eff456572..d7e736b9d9f12ea506cbbb599a757143d1ce80ad 100644 (file)
@@ -11,7 +11,7 @@ int main(int argc, char *argv[])
   char aes_key[AES_KEY_LEN];
   memset(aes_key, 0x77, sizeof(aes_key));
   bufferptr keybuf(aes_key, sizeof(aes_key));
-  CryptoKey key(CEPH_CRYPTO_AES, g_clock.now(), keybuf);
+  CryptoKey key(CEPH_CRYPTO_AES, ceph_clock_now(&g_ceph_context), keybuf);
 
   const char *msg="hello! this is a message\n";
   char pad[16];
index b43480f37f7e021fcdce2d4eee1e3da2479097bf..6159734339de3e9d7dadd688c3b9997c491646e6 100644 (file)
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
   char aes_key[AES_KEY_LEN];
   memset(aes_key, 0x77, sizeof(aes_key));
   bufferptr keybuf(aes_key, sizeof(aes_key));
-  CryptoKey key(CEPH_CRYPTO_AES, g_clock.now(), keybuf);
+  CryptoKey key(CEPH_CRYPTO_AES, ceph_clock_now(&g_ceph_context), keybuf);
 
   const char *msg="hello! this is a message\n";
   char pad[16];
index ded95bd37822d447b70046bf8e403b0d54633373..11db06d9fb098699a178b3fc2f769fd71f023798 100644 (file)
@@ -90,7 +90,7 @@ static void handle_observe(CephToolCtx *ctx, MMonObserve *observe)
 
 static void handle_notify(CephToolCtx *ctx, MMonObserveNotify *notify)
 {
-  utime_t now = g_clock.now();
+  utime_t now = ceph_clock_now(&g_ceph_context);
 
   dout(1) << notify->get_source() << " -> " << get_paxos_name(notify->machine_id)
          << " v" << notify->ver
@@ -273,7 +273,7 @@ static void send_command(CephToolCtx *ctx)
   m->set_data(pending_bl);
 
   if (!ctx->concise)
-    *ctx->log << g_clock.now() << " mon" << " <- " << pending_cmd << std::endl;
+    *ctx->log << ceph_clock_now(&g_ceph_context) << " mon" << " <- " << pending_cmd << std::endl;
   ctx->mc.send_mon_message(m);
 }
 
@@ -340,7 +340,7 @@ static int do_command(CephToolCtx *ctx,
   rs = rs;
   rbl = reply_bl;
   if (!ctx->concise)
-    *ctx->log << g_clock.now() << " "
+    *ctx->log << ceph_clock_now(&g_ceph_context) << " "
           << reply_from.name << " -> '"
           << reply_rs << "' (" << reply_rc << ")"
           << std::endl;
index 54eb4560b8c94b8197575a71875d7c16fd998521..ad8353fc542c826afea879ff19473234ba188b33 100644 (file)
@@ -133,7 +133,7 @@ public:
     CephToolCtx *ctx = gui->ctx;
     ctx->lock.Lock();
     while (true) {
-      utime_t t(g_clock.now());
+      utime_t t(ceph_clock_now(&g_ceph_context));
       t += 3.0;
       ctx->gui_cond.WaitUntil(ctx->lock, t);
       if (shutting_down) {