From 112e569296f8b06d4db848b3bf26604451262393 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Tue, 21 Jun 2011 12:28:16 -0700 Subject: [PATCH] Convert g_ceph_context to a pointer. Signed-off-by: Colin McCabe --- src/cauthtool.cc | 10 ++-- src/cconf.cc | 2 +- src/cfuse.cc | 6 +-- src/client/Client.cc | 50 +++++++++---------- src/client/Client.h | 4 +- src/client/SyntheticClient.cc | 62 ++++++++++++------------ src/client/SyntheticClient.h | 2 +- src/cmds.cc | 14 +++--- src/cmon.cc | 20 ++++---- src/common/ceph_context.h | 6 --- src/common/debug.h | 10 ++-- src/cosd.cc | 30 ++++++------ src/csyn.cc | 8 ++-- src/dupstore.cc | 2 +- src/global/global_context.cc | 8 ++-- src/global/global_context.h | 2 +- src/global/signal_handler.cc | 2 +- src/libceph.cc | 2 +- src/librados-config.cc | 2 +- src/librados.cc | 2 +- src/mds/CDentry.cc | 2 +- src/mds/CDir.cc | 22 ++++----- src/mds/CInode.cc | 12 ++--- src/mds/CInode.h | 4 +- src/mds/Dumper.cc | 4 +- src/mds/Dumper.h | 2 +- src/mds/Locker.cc | 14 +++--- src/mds/MDBalancer.cc | 12 ++--- src/mds/MDCache.cc | 36 +++++++------- src/mds/MDLog.cc | 14 +++--- src/mds/MDS.cc | 40 ++++++++-------- src/mds/MDSTable.cc | 4 +- src/mds/Migrator.cc | 8 ++-- src/mds/Resetter.h | 2 +- src/mds/Server.cc | 60 +++++++++++------------ src/mds/Server.h | 2 +- src/mds/SessionMap.cc | 8 ++-- src/mds/SessionMap.h | 4 +- src/mds/journal.cc | 28 +++++------ src/mds/mdstypes.h | 6 +-- src/messages/MMonPaxos.h | 2 +- src/mon/AuthMonitor.cc | 4 +- src/mon/Elector.cc | 6 +-- src/mon/LogMonitor.cc | 2 +- src/mon/MDSMonitor.cc | 26 +++++----- src/mon/MDSMonitor.h | 4 +- src/mon/Monitor.cc | 20 ++++---- src/mon/MonmapMonitor.cc | 6 +-- src/mon/MonmapMonitor.h | 2 +- src/mon/OSDMonitor.cc | 14 +++--- src/mon/PGMonitor.cc | 10 ++-- src/mon/Paxos.cc | 54 ++++++++++----------- src/mon/PaxosService.cc | 2 +- src/monmaptool.cc | 4 +- src/os/FileJournal.cc | 4 +- src/os/FileStore.cc | 28 +++++------ src/os/JournalingObjectStore.h | 2 +- src/osd/Ager.cc | 8 ++-- src/osd/OSD.cc | 74 ++++++++++++++--------------- src/osd/OSD.h | 4 +- src/osd/PG.cc | 12 ++--- src/osd/PG.h | 6 +-- src/osd/ReplicatedPG.cc | 20 ++++---- src/osdc/Filer.h | 8 ++-- src/osdc/Journaler.cc | 26 +++++----- src/osdc/ObjectCacher.cc | 24 +++++----- src/osdc/ObjectCacher.h | 2 +- src/osdc/Objecter.cc | 12 ++--- src/osdc/Objecter.h | 6 +-- src/osdc/rados_bencher.h | 34 ++++++------- src/osdmaptool.cc | 4 +- src/rados.cc | 4 +- src/rados_sync.cc | 2 +- src/rbd.cc | 8 ++-- src/rgw/librgw.cc | 4 +- src/rgw/rgw_admin.cc | 4 +- src/rgw/rgw_log.cc | 2 +- src/rgw/rgw_main.cc | 4 +- src/rgw/rgw_op.cc | 4 +- src/rgw/rgw_os_auth.cc | 6 +-- src/streamtest.cc | 10 ++-- src/test/TestDoutStreambuf.cc | 2 +- src/test/TestSignalHandlers.cc | 2 +- src/test/TestTimers.cc | 14 +++--- src/test/gather.cc | 8 ++-- src/test/old/test_disk_bw.cc | 4 +- src/test/old/test_seek_read.c | 4 +- src/test/old/test_short_seek_read.c | 4 +- src/test/old/testcounter.cc | 2 +- src/test/test_libcommon_build.cc | 2 +- src/test/test_mutate.cc | 4 +- src/test_trans.cc | 2 +- src/testcrypto.cc | 2 +- src/testkeys.cc | 6 +-- src/testmsgr.cc | 8 ++-- src/tools/ceph.cc | 2 +- src/tools/common.cc | 12 ++--- src/tools/common.h | 2 +- src/tools/gceph.cc | 2 +- src/tools/gui.cc | 2 +- 100 files changed, 542 insertions(+), 548 deletions(-) diff --git a/src/cauthtool.cc b/src/cauthtool.cc index aebe39846c26e..cfd9a8d45cc8a 100644 --- a/src/cauthtool.cc +++ b/src/cauthtool.cc @@ -55,7 +55,7 @@ int main(int argc, const char **argv) global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); EntityName ename(g_conf->name); const char *me = argv[0]; @@ -130,7 +130,7 @@ int main(int argc, const char **argv) if (gen_print_key) { CryptoKey key; - key.create(&g_ceph_context, CEPH_CRYPTO_AES); + key.create(g_ceph_context, CEPH_CRYPTO_AES); cout << key << std::endl; return 0; } @@ -178,7 +178,7 @@ int main(int argc, const char **argv) cout << "importing contents of " << import_keyring << " into " << fn << std::endl; //other.print(cout); - keyring.import(&g_ceph_context, other); + keyring.import(g_ceph_context, other); modified = true; } else { cerr << "can't open " << import_keyring << ": " << err << std::endl; @@ -187,7 +187,7 @@ int main(int argc, const char **argv) } if (gen_key) { EntityAuth eauth; - eauth.key.create(&g_ceph_context, CEPH_CRYPTO_AES); + eauth.key.create(g_ceph_context, CEPH_CRYPTO_AES); keyring.add(ename, eauth); modified = true; } @@ -211,7 +211,7 @@ int main(int argc, const char **argv) cerr << "could not parse caps file " << caps_fn << std::endl; exit(1); } - complain_about_parse_errors(&g_ceph_context, &parse_errors); + complain_about_parse_errors(g_ceph_context, &parse_errors); map caps; const char *key_names[] = { "mon", "osd", "mds", NULL }; for (int i=0; key_names[i]; i++) { diff --git a/src/cconf.cc b/src/cconf.cc index 357864d2a9b0e..1f7ef4b00f7a3 100644 --- a/src/cconf.cc +++ b/src/cconf.cc @@ -122,7 +122,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); std::string val; for (std::vector::iterator i = args.begin(); i != args.end(); ) { diff --git a/src/cfuse.cc b/src/cfuse.cc index cf0db88027715..fe33113046ceb 100644 --- a/src/cfuse.cc +++ b/src/cfuse.cc @@ -81,7 +81,7 @@ int main(int argc, const char **argv, const char *envp[]) { } // get monmap - MonClient mc(&g_ceph_context); + MonClient mc(g_ceph_context); int ret = mc.build_initial_monmap(); if (ret == -EINVAL) usage(); @@ -90,7 +90,7 @@ int main(int argc, const char **argv, const char *envp[]) { return -1; // start up network - SimpleMessenger *messenger = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *messenger = new SimpleMessenger(g_ceph_context); messenger->register_entity(entity_name_t::CLIENT()); Client *client = new Client(messenger, &mc); if (filer_flags) { @@ -110,7 +110,7 @@ int main(int argc, const char **argv, const char *envp[]) { childpid = fork(); } - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); if (childpid == 0) { //cout << "child, mounting" << std::endl; diff --git a/src/client/Client.cc b/src/client/Client.cc index db912b816c241..c94ed026a77c9 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -294,7 +294,7 @@ void Client::init() char hostname[80]; gethostname(hostname, 79); snprintf(s, sizeof(s), "clients.%s.%d", hostname, getpid()); - client_logger = new ProfLogger(&g_ceph_context, s, &client_logtype); + client_logger = new ProfLogger(g_ceph_context, s, &client_logtype); } client_logger_lock.Unlock(); } @@ -961,7 +961,7 @@ int Client::make_request(MetaRequest *request, bufferlist *pdirbl) { // time the call - utime_t start = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + request->sent_stamp = ceph_clock_now(g_ceph_context); dout(20) << "send_request set sent_stamp to " << request->sent_stamp << dendl; } request->mds = mds; @@ -1504,7 +1504,7 @@ void Client::handle_mds_map(MMDSMap* m) dout(1) << "handle_mds_map epoch " << m->get_epoch() << dendl; MDSMap *oldmap = mdsmap; - mdsmap = new MDSMap(&g_ceph_context); + mdsmap = new MDSMap(g_ceph_context); mdsmap->decode(m->get_encoded()); // reset session @@ -1691,7 +1691,7 @@ void Client::handle_lease(MClientLease *m) void Client::release_lease(Inode *in, Dentry *dn, int mask) { - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); map::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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + last_cap_renew = ceph_clock_now(g_ceph_context); for (map::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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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, ceph_clock_now(&g_ceph_context), 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, ceph_clock_now(&g_ceph_context), 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, ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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; diff --git a/src/client/Client.h b/src/client/Client.h index ff5c0557a6eb8..f59089b9a0aa6 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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 " << ceph_clock_now(&g_ceph_context) << std::endl;*/ + << "cur time " << ceph_clock_now(g_ceph_context) << std::endl;*/ if ((cap->session->cap_gen <= cap->gen) - && (ceph_clock_now(&g_ceph_context) < 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 diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index f05342f0952e6..6c86728b16592 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -283,7 +283,7 @@ SyntheticClient::SyntheticClient(Client *client, int w) this->iargs = syn_iargs; this->sargs = syn_sargs; - run_start = ceph_clock_now(&g_ceph_context); + run_start = ceph_clock_now(g_ceph_context); } @@ -327,7 +327,7 @@ int SyntheticClient::run() return -1; } - //run_start = ceph_clock_now(&g_ceph_context); + //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 = ceph_clock_now(&g_ceph_context) - 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 1) clean_dir(prefix); // clean only if repeat - utime_t lat = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t start = ceph_clock_now(g_ceph_context); hash_map open_files; hash_map open_dirs; @@ -1040,7 +1040,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) Cond cond; bool ack; bool safe; - C_Gather *safeg = new C_Gather(&g_ceph_context, new C_SafeCond(&lock, &cond, &safe)); + C_Gather *safeg = new C_Gather(g_ceph_context, new C_SafeCond(&lock, &cond, &safe)); Context *safegref = safeg->new_sub(); // take a ref while (!t.end()) { @@ -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, ceph_clock_now(&g_ceph_context), 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, ceph_clock_now(&g_ceph_context), 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 contents; - utime_t s = ceph_clock_now(&g_ceph_context); + utime_t s = ceph_clock_now(g_ceph_context); int r = client->getdir(basedir, contents); - utime_t e = ceph_clock_now(&g_ceph_context); + 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; ilstat(d, &st) < 0) { dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl; return -1; } - utime_t e = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t start = ceph_clock_now(g_ceph_context); for (int c=0; cmkdir("orig", 0755); client->mkdir("copy", 0755); - utime_t start = ceph_clock_now(&g_ceph_context); + utime_t start = ceph_clock_now(g_ceph_context); for (int i=0; imknod(d, 0755); } - utime_t end = ceph_clock_now(&g_ceph_context); + utime_t end = ceph_clock_now(g_ceph_context); end -= start; dout(0) << "orig " << end << dendl; // link - start = ceph_clock_now(&g_ceph_context); + start = ceph_clock_now(g_ceph_context); for (int i=0; ilink(d, e); } - end = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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(ceph_clock_now(&g_ceph_context)); + starts.push_back(ceph_clock_now(g_ceph_context)); client->client_lock.Lock(); - client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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, ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + utime_t lat = ceph_clock_now(g_ceph_context); lat -= start; if (client_logger) { if (write) diff --git a/src/client/SyntheticClient.h b/src/client/SyntheticClient.h index 09f739596e029..484ef6f04d020 100644 --- a/src/client/SyntheticClient.h +++ b/src/client/SyntheticClient.h @@ -205,7 +205,7 @@ class SyntheticClient { } bool time_to_stop() { - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); if (0) cout << "time_to_stop .. now " << now << " until " << run_until << " start " << run_start diff --git a/src/cmds.cc b/src/cmds.cc index 898f8487bfa55..453aeb01e9979 100644 --- a/src/cmds.cc +++ b/src/cmds.cc @@ -62,9 +62,9 @@ void usage() static int do_cmds_special_action(const std::string &action, const std::string &dump_file, int rank) { - SimpleMessenger *messenger = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *messenger = new SimpleMessenger(g_ceph_context); messenger->bind(getpid()); - MonClient mc(&g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; @@ -197,7 +197,7 @@ int main(int argc, const char **argv) usage(); } - SimpleMessenger *messenger = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *messenger = new SimpleMessenger(g_ceph_context); messenger->bind(getpid()); cout << "starting " << g_conf->name << " at " << messenger->get_ms_addr() << std::endl; @@ -217,14 +217,14 @@ int main(int argc, const char **argv) SimpleMessenger::Policy::stateful_server(supported, 0)); if (shadow != MDSMap::STATE_ONESHOT_REPLAY) - global_init_daemonize(&g_ceph_context, 0); - common_init_finish(&g_ceph_context); + global_init_daemonize(g_ceph_context, 0); + common_init_finish(g_ceph_context); // get monmap - MonClient mc(&g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; - global_init_chdir(&g_ceph_context); + global_init_chdir(g_ceph_context); messenger->start(); diff --git a/src/cmon.cc b/src/cmon.cc index 396d7a5a2e678..ff108ace1c655 100644 --- a/src/cmon.cc +++ b/src/cmon.cc @@ -82,7 +82,7 @@ int main(int argc, const char **argv) // -- mkfs -- if (mkfs) { - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); if (g_conf->monmap.empty() || !osdmapfn) usage(); @@ -104,7 +104,7 @@ int main(int argc, const char **argv) << error << std::endl; exit(1); } - MonMap monmap(ceph_clock_now(&g_ceph_context)); + MonMap monmap(ceph_clock_now(g_ceph_context)); monmap.decode(monmapbl); err = osdmapbl.read_file(osdmapfn, &error); @@ -116,7 +116,7 @@ int main(int argc, const char **argv) // go MonitorStore store(g_conf->mon_data); - Monitor mon(&g_ceph_context, g_conf->name.get_id(), &store, 0, &monmap); + Monitor mon(g_ceph_context, g_conf->name.get_id(), &store, 0, &monmap); mon.mkfs(osdmapbl); cout << argv[0] << ": created monfs at " << g_conf->mon_data << " for " << g_conf->name << std::endl; @@ -190,7 +190,7 @@ int main(int argc, const char **argv) v++; // set the version - MonMap tmp(ceph_clock_now(&g_ceph_context)); + MonMap tmp(ceph_clock_now(g_ceph_context)); tmp.decode(bl); if (tmp.get_epoch() != v) { cout << "changing monmap epoch from " << tmp.get_epoch() << " to " << v << std::endl; @@ -213,7 +213,7 @@ int main(int argc, const char **argv) // monmap? - MonMap monmap(ceph_clock_now(&g_ceph_context)); + MonMap monmap(ceph_clock_now(g_ceph_context)); { bufferlist latest; store.get_bl_ss(latest, "monmap/latest", 0); @@ -251,7 +251,7 @@ int main(int argc, const char **argv) } // bind - SimpleMessenger *messenger = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *messenger = new SimpleMessenger(g_ceph_context); int rank = monmap.get_rank(g_conf->name.get_id()); cout << "starting " << g_conf->name << " rank " << rank @@ -266,11 +266,11 @@ int main(int argc, const char **argv) // start monitor messenger->register_entity(entity_name_t::MON(rank)); messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH); - Monitor *mon = new Monitor(&g_ceph_context, g_conf->name.get_id(), &store, messenger, &monmap); + Monitor *mon = new Monitor(g_ceph_context, g_conf->name.get_id(), &store, messenger, &monmap); - global_init_daemonize(&g_ceph_context, 0); - common_init_finish(&g_ceph_context); - global_init_chdir(&g_ceph_context); + global_init_daemonize(g_ceph_context, 0); + common_init_finish(g_ceph_context); + global_init_chdir(g_ceph_context); messenger->start(); uint64_t supported = diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 56d145fc17d28..95b452fcd43a5 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -84,10 +84,4 @@ class CephContext { md_config_obs_t *_prof_logger_conf_obs; }; -/* Globals (FIXME: remove) */ -extern CephContext g_ceph_context; -extern md_config_t *g_conf; -extern DoutStreambuf ::traits_type> *_doss; - - #endif diff --git a/src/common/debug.h b/src/common/debug.h index 1cf31d0c469fd..7d5a785d38a5e 100644 --- a/src/common/debug.h +++ b/src/common/debug.h @@ -20,14 +20,14 @@ /* Global version of the stuff in common/dout.h */ -#define dout(v) ldout((&g_ceph_context), v) +#define dout(v) ldout((g_ceph_context), v) -#define pdout(v, p) lpdout((&g_ceph_context), v, p) +#define pdout(v, p) lpdout((g_ceph_context), v, p) -#define generic_dout(v) lgeneric_dout((&g_ceph_context), v) +#define generic_dout(v) lgeneric_dout((g_ceph_context), v) -#define derr lderr((&g_ceph_context)) +#define derr lderr((g_ceph_context)) -#define generic_derr lgeneric_derr((&g_ceph_context)) +#define generic_derr lgeneric_derr((g_ceph_context)) #endif diff --git a/src/cosd.cc b/src/cosd.cc index 30fd030c59cb4..c723d7ad09dd2 100644 --- a/src/cosd.cc +++ b/src/cosd.cc @@ -83,7 +83,7 @@ int main(int argc, const char **argv) } if (dump_pg_log) { - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); bufferlist bl; std::string error; int r = bl.read_file(dump_pg_log, &error); @@ -122,8 +122,8 @@ int main(int argc, const char **argv) } if (mkfs) { - common_init_finish(&g_ceph_context); - MonClient mc(&g_ceph_context); + common_init_finish(g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; if (mc.get_monmap_privately() < 0) @@ -141,7 +141,7 @@ int main(int argc, const char **argv) *_dout << " for osd" << whoami << " fsid " << mc.monmap.fsid << dendl; } if (mkkey) { - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); KeyRing *keyring = KeyRing::create_empty(); if (!keyring) { derr << "Unable to get a Ceph keyring." << dendl; @@ -149,7 +149,7 @@ int main(int argc, const char **argv) } EntityName ename(g_conf->name); EntityAuth eauth; - eauth.key.create(&g_ceph_context, CEPH_CRYPTO_AES); + eauth.key.create(g_ceph_context, CEPH_CRYPTO_AES); keyring->add(ename, eauth); bufferlist bl; keyring->encode_plaintext(bl); @@ -163,7 +163,7 @@ int main(int argc, const char **argv) if (mkfs || mkkey) exit(0); if (mkjournal) { - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); int err = OSD::mkjournal(g_conf->osd_data, g_conf->osd_journal); if (err < 0) { derr << TEXT_RED << " ** ERROR: error creating fresh journal " << g_conf->osd_journal @@ -176,7 +176,7 @@ int main(int argc, const char **argv) exit(0); } if (flushjournal) { - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); int err = OSD::flushjournal(g_conf->osd_data, g_conf->osd_journal); if (err < 0) { derr << TEXT_RED << " ** ERROR: error flushing journal " << g_conf->osd_journal @@ -226,9 +226,9 @@ int main(int argc, const char **argv) cluster_addr_set = false; } - SimpleMessenger *client_messenger = new SimpleMessenger(&g_ceph_context); - SimpleMessenger *cluster_messenger = new SimpleMessenger(&g_ceph_context); - SimpleMessenger *messenger_hb = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *client_messenger = new SimpleMessenger(g_ceph_context); + SimpleMessenger *cluster_messenger = new SimpleMessenger(g_ceph_context); + SimpleMessenger *messenger_hb = new SimpleMessenger(g_ceph_context); client_messenger->bind(g_conf->public_addr, getpid()); cluster_messenger->bind(g_conf->cluster_addr, getpid()); @@ -276,12 +276,12 @@ int main(int argc, const char **argv) // Set up crypto, daemonize, etc. // Leave stderr open in case we need to report errors. - global_init_daemonize(&g_ceph_context, CINIT_FLAG_NO_CLOSE_STDERR); - common_init_finish(&g_ceph_context); - MonClient mc(&g_ceph_context); + global_init_daemonize(g_ceph_context, CINIT_FLAG_NO_CLOSE_STDERR); + common_init_finish(g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; - global_init_chdir(&g_ceph_context); + global_init_chdir(g_ceph_context); OSD *osd = new OSD(whoami, cluster_messenger, client_messenger, messenger_hb, &mc, g_conf->osd_data, g_conf->osd_journal); @@ -293,7 +293,7 @@ int main(int argc, const char **argv) } // Now close the standard file descriptors - global_init_shutdown_stderr(&g_ceph_context); + global_init_shutdown_stderr(g_ceph_context); client_messenger->start(); messenger_hb->start(); diff --git a/src/csyn.cc b/src/csyn.cc index 5f0da24fa37de..cc58ce53c520c 100644 --- a/src/csyn.cc +++ b/src/csyn.cc @@ -47,14 +47,14 @@ int main(int argc, const char **argv, char *envp[]) argv_to_vec(argc, argv, args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); parse_syn_options(args); // for SyntheticClient vec_to_argv(args, argc, argv); // get monmap - MonClient mc(&g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; @@ -65,10 +65,10 @@ int main(int argc, const char **argv, char *envp[]) cout << "csyn: starting " << g_conf->num_client << " syn client(s)" << std::endl; for (int i=0; inum_client; i++) { - messengers[i] = new SimpleMessenger(&g_ceph_context); + messengers[i] = new SimpleMessenger(g_ceph_context); messengers[i]->register_entity(entity_name_t(entity_name_t::TYPE_CLIENT,-1)); messengers[i]->bind(i * 1000000 + getpid()); - mclients[i] = new MonClient(&g_ceph_context); + mclients[i] = new MonClient(g_ceph_context); mclients[i]->build_initial_monmap(); Client *client = new Client(messengers[i], mclients[i]); client->set_filer_flags(syn_filer_flags); diff --git a/src/dupstore.cc b/src/dupstore.cc index f5c5782455cae..865e9439dcb99 100644 --- a/src/dupstore.cc +++ b/src/dupstore.cc @@ -88,7 +88,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); // args if (args.size() != 4) diff --git a/src/global/global_context.cc b/src/global/global_context.cc index 3ae0b31045cc8..ec2545cbcf016 100644 --- a/src/global/global_context.cc +++ b/src/global/global_context.cc @@ -18,11 +18,11 @@ /* * Global variables for use from process context. */ -CephContext g_ceph_context __attribute__((init_priority(103))) (0); -md_config_t *g_conf(g_ceph_context._conf); -DoutStreambuf ::traits_type> *_doss(g_ceph_context._doss); +CephContext *g_ceph_context = new CephContext(0); +md_config_t *g_conf(g_ceph_context->_conf); +DoutStreambuf ::traits_type> *_doss(g_ceph_context->_doss); CephContext *get_global_context(void) { - return &g_ceph_context; + return g_ceph_context; } diff --git a/src/global/global_context.h b/src/global/global_context.h index 248b9415dac18..6d08867909fb1 100644 --- a/src/global/global_context.h +++ b/src/global/global_context.h @@ -26,7 +26,7 @@ class DoutStreambuf; class md_config_t; -extern CephContext g_ceph_context; +extern CephContext *g_ceph_context; extern md_config_t *g_conf; extern DoutStreambuf ::traits_type> *_doss; diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc index a723744edb57a..e31268e9dcf2c 100644 --- a/src/global/signal_handler.cc +++ b/src/global/signal_handler.cc @@ -50,7 +50,7 @@ void install_sighandler(int signum, signal_handler_t handler, int flags) void sighup_handler(int signum) { - g_ceph_context.reopen_logs(); + g_ceph_context->reopen_logs(); } static void reraise_fatal(int signum) diff --git a/src/libceph.cc b/src/libceph.cc index 767ebbbe0d10e..a99f6b19a6781 100644 --- a/src/libceph.cc +++ b/src/libceph.cc @@ -228,7 +228,7 @@ extern "C" int ceph_create(struct ceph_mount_info **cmount, const char * const i { int ret; libceph_init_mutex.Lock(); - CephContext *cct = &g_ceph_context; + CephContext *cct = g_ceph_context; if (!libceph_initialized) { CephInitParameters iparams(CEPH_ENTITY_TYPE_CLIENT, CEPH_CONF_FILE_DEFAULT); iparams.conf_file = ""; diff --git a/src/librados-config.cc b/src/librados-config.cc index d2016f84e74e4..f2ccfafdcf9e3 100644 --- a/src/librados-config.cc +++ b/src/librados-config.cc @@ -58,7 +58,7 @@ int main(int argc, const char **argv) } global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); FOR_EACH_ARG(args) { usage_exit(); diff --git a/src/librados.cc b/src/librados.cc index 2828e1b695bb1..1cf58cd374d5e 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -3124,7 +3124,7 @@ extern "C" int rados_create(rados_t *pcluster, const char * const id) ++rados_initialized; } else { - cct_ = &g_ceph_context; + cct_ = g_ceph_context; } rados_init_mutex.Unlock(); librados::RadosClient *radosp = new librados::RadosClient(cct_); diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 4fb85475f0c8e..e6b2ac4ecd50f 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -33,7 +33,7 @@ ostream& CDentry::print_db_line_prefix(ostream& out) { - return out << ceph_clock_now(&g_ceph_context) << " 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)); diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 3c2206885ad98..4f869a4dccaed 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -143,7 +143,7 @@ void CDir::print(ostream& out) ostream& CDir::print_db_line_prefix(ostream& out) { - return out << ceph_clock_now(&g_ceph_context) << " 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() << ") "; } @@ -154,10 +154,10 @@ ostream& CDir::print_db_line_prefix(ostream& out) CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) : dirty_rstat_inodes(member_offset(CInode, dirty_rstat_item)), item_dirty(this), item_new(this), - pop_me(ceph_clock_now(&g_ceph_context)), - pop_nested(ceph_clock_now(&g_ceph_context)), - pop_auth_subtree(ceph_clock_now(&g_ceph_context)), - pop_auth_subtree_nested(ceph_clock_now(&g_ceph_context)), + pop_me(ceph_clock_now(g_ceph_context)), + pop_nested(ceph_clock_now(g_ceph_context)), + pop_auth_subtree(ceph_clock_now(g_ceph_context)), + pop_auth_subtree_nested(ceph_clock_now(g_ceph_context)), bloom(NULL) { g_num_dir++; @@ -1174,7 +1174,7 @@ void CDir::finish_waiting(uint64_t mask, int result) list finished; take_waiting(mask, finished); if (result < 0) - finish_contexts(&g_ceph_context, finished, result); + finish_contexts(g_ceph_context, finished, result); else cache->mds->queue_waiters(finished); } @@ -1576,7 +1576,7 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn) in->mark_dirty_rstat(); //in->hack_accessed = false; - //in->hack_load_stamp = ceph_clock_now(&g_ceph_context); + //in->hack_load_stamp = ceph_clock_now(g_ceph_context); //num_new_inodes_loaded++; } } @@ -1957,16 +1957,16 @@ 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, ceph_clock_now(&g_ceph_context), 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 - C_Gather *gather = new C_Gather(&g_ceph_context, new C_Dir_Committed(this, get_version(), + C_Gather *gather = new C_Gather(g_ceph_context, new C_Dir_Committed(this, get_version(), inode->inode.last_renamed_version)); 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, ceph_clock_now(&g_ceph_context), 0, NULL, + cache->mds->objecter->mutate(oid, oloc, n, snapc, ceph_clock_now(g_ceph_context), 0, NULL, gather->new_sub()); } /* @@ -1979,7 +1979,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, ceph_clock_now(&g_ceph_context), 0, NULL, + cache->mds->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(g_ceph_context), 0, NULL, gather->new_sub()); } } diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index e53a93e1fba36..4d0697042ac1e 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -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 << ceph_clock_now(&g_ceph_context) << " 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, ceph_clock_now(&g_ceph_context), 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) ); } @@ -995,7 +995,7 @@ void CInode::fetch(Context *fin) dout(10) << "fetch" << dendl; C_Inode_Fetched *c = new C_Inode_Fetched(this, fin); - C_Gather *gather = new C_Gather(&g_ceph_context, c); + C_Gather *gather = new C_Gather(g_ceph_context, c); object_t oid = CInode::get_object_name(ino(), frag_t(), ""); object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pg_pool()); @@ -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, ceph_clock_now(&g_ceph_context), 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(ceph_clock_now(&g_ceph_context)); + 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(); @@ -2654,7 +2654,7 @@ void CInode::decode_import(bufferlist::iterator& p, if (dirty) _mark_dirty(ls); - ::decode(pop, ceph_clock_now(&g_ceph_context), p); + ::decode(pop, ceph_clock_now(g_ceph_context), p); ::decode(replica_map, p); if (!replica_map.empty()) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index f17a3fa76cc9e..dd4f1c2829d78 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -477,7 +477,7 @@ class CInode : public MDSCacheObject { item_dirty_dirfrag_dirfragtree(this), auth_pins(0), nested_auth_pins(0), nested_anchors(0), - pop(ceph_clock_now(&g_ceph_context)), + pop(ceph_clock_now(g_ceph_context)), versionlock(this, &versionlock_type), authlock(this, &authlock_type), linklock(this, &linklock_type), @@ -914,7 +914,7 @@ class CInode : public MDSCacheObject { cap->reset_seq(); } cap->set_cap_id(icr.cap_id); - cap->set_last_issue_stamp(ceph_clock_now(&g_ceph_context)); + cap->set_last_issue_stamp(ceph_clock_now(g_ceph_context)); return cap; } void clear_client_caps_after_export() { diff --git a/src/mds/Dumper.cc b/src/mds/Dumper.cc index 49889f4b0f79f..9b4ca71cf0149 100644 --- a/src/mds/Dumper.cc +++ b/src/mds/Dumper.cc @@ -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, ceph_clock_now(&g_ceph_context), 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, ceph_clock_now(&g_ceph_context), 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) diff --git a/src/mds/Dumper.h b/src/mds/Dumper.h index 3f0bd26648a88..c722f1106dcdd 100644 --- a/src/mds/Dumper.h +++ b/src/mds/Dumper.h @@ -52,7 +52,7 @@ class Dumper : public Dispatcher { Dispatcher(messenger_->cct), messenger(messenger_), monc(monc_), - lock("Dumper::lock"), timer(&g_ceph_context, lock) + lock("Dumper::lock"), timer(g_ceph_context, lock) {} virtual ~Dumper(); diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 259fd9f3c2fdc..020864dcf2945 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -799,7 +799,7 @@ void Locker::eval_cap_gather(CInode *in, set *issue_set) issue_caps(in); } - finish_contexts(&g_ceph_context, finishers); + finish_contexts(g_ceph_context, finishers); } void Locker::eval_scatter_gathers(CInode *in) @@ -820,7 +820,7 @@ void Locker::eval_scatter_gathers(CInode *in) if (need_issue && in->is_head()) issue_caps(in); - finish_contexts(&g_ceph_context, finishers); + finish_contexts(g_ceph_context, finishers); } void Locker::eval(SimpleLock *lock, bool *need_issue) @@ -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 > ceph_clock_now(&g_ceph_context)) { + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); int n = updated_scatterlocks.size(); while (!updated_scatterlocks.empty()) { ScatterLock *lock = updated_scatterlocks.front(); diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 69b725575db6b..a94147fabe55a 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -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 = ceph_clock_now(&g_ceph_context); - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); if (mds->mdsmap->is_degraded()) { dout(10) << "send_heartbeat degraded" << dendl; @@ -433,7 +433,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 = ceph_clock_now(&g_ceph_context); + rebalance_time = ceph_clock_now(g_ceph_context); dump_pop_map(); @@ -462,7 +462,7 @@ void MDBalancer::prep_rebalance(int beat) double total_load = 0; multimap load_map; for (int i=0; i::value_type val(i, mds_load_t(ceph_clock_now(&g_ceph_context))); + map::value_type val(i, mds_load_t(ceph_clock_now(g_ceph_context))); std::pair < map::iterator, bool > r(mds_load.insert(val)); mds_load_t &load(r.first->second); @@ -1166,7 +1166,7 @@ void MDBalancer::dump_pop_map() if (mds->mdcache->root) iq.push_back(mds->mdcache->root); - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); while (!iq.empty()) { CInode *in = iq.front(); iq.pop_front(); diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index cc6fd2d7bfabe..b4b39cd852fae 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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 = ceph_clock_now(&g_ceph_context); + 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 auth, bool do_eval) // adjust recursive pop counters if (dir->is_auth()) { - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + mut->now = ceph_clock_now(g_ceph_context); if (in->is_base()) return; @@ -3607,7 +3607,7 @@ C_Gather *MDCache::parallel_fetch(map& pathmap, set fetch_queue; @@ -4603,7 +4603,7 @@ void MDCache::open_snap_parents() dout(10) << "open_snap_parents" << dendl; map splits; - C_Gather *gather = new C_Gather(&g_ceph_context); + C_Gather *gather = new C_Gather(g_ceph_context); map > >::iterator p = missing_snap_parents.begin(); while (p != missing_snap_parents.end()) { @@ -4673,7 +4673,7 @@ void MDCache::open_undef_dirfrags() p++) { CDir *dir = *p; if (!gather) - gather = new C_Gather(&g_ceph_context, new C_MDC_OpenUndefDirfragsFinish(this)); + gather = new C_Gather(g_ceph_context, new C_MDC_OpenUndefDirfragsFinish(this)); dir->fetch(gather->new_sub()); } @@ -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, ceph_clock_now(&g_ceph_context), 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, maplogger->inc("outt"); else { mds->logger->inc("outut"); - mds->logger->favg("oututl", ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); dout(10) << "trim_client_leases" << dendl; @@ -5928,7 +5928,7 @@ void MDCache::trim_client_leases() void MDCache::check_memory_usage() { - static MemoryModel mm(&g_ceph_context); + static MemoryModel mm(g_ceph_context); static MemoryModel::snap last; mm.sample(&last); static MemoryModel::snap baseline = last; @@ -5985,7 +5985,7 @@ class C_MDC_ShutdownCheck : public Context { void MDCache::shutdown_check() { - dout(0) << "shutdown_check at " << ceph_clock_now(&g_ceph_context) << 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, ceph_clock_now(&g_ceph_context), 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; @@ -8785,7 +8785,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) } // waiters - finish_contexts(&g_ceph_context, error, -ENOENT); // finish errors directly + finish_contexts(g_ceph_context, error, -ENOENT); // finish errors directly mds->queue_waiters(finished); // done @@ -9436,7 +9436,7 @@ void MDCache::split_dir(CDir *dir, int bits) return; } - C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, dir->get_frag(), bits)); + C_Gather *gather = new C_Gather(g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, dir->get_frag(), bits)); fragment_freeze_dirs(dirs, gather); // initial mark+complete pass @@ -9470,7 +9470,7 @@ void MDCache::merge_dir(CInode *diri, frag_t frag) int bits = first->get_frag().bits() - frag.bits(); dout(10) << " we are merginb by " << bits << " bits" << dendl; - C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, frag, bits)); + C_Gather *gather = new C_Gather(g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, frag, bits)); fragment_freeze_dirs(dirs, gather); // initial mark+complete pass @@ -9514,7 +9514,7 @@ void MDCache::fragment_mark_and_complete(list& dirs) if (!dir->is_complete()) { dout(15) << " fetching incomplete " << *dir << dendl; if (!gather) - gather = new C_Gather(&g_ceph_context, + gather = new C_Gather(g_ceph_context, new C_MDC_FragmentMarking(this, dirs)); dir->fetch(gather->new_sub(), true); // ignore authpinnability @@ -9641,7 +9641,7 @@ void MDCache::fragment_frozen(list& dirs, frag_t basefrag, int bits) */ // freeze, journal, and store resulting frags - C_Gather *gather = new C_Gather(&g_ceph_context, + C_Gather *gather = new C_Gather(g_ceph_context, new C_MDC_FragmentLoggedAndStored(this, mut, resultfrags, basefrag, bits)); diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index 41ee11e6d0ad1..cff21aed46241 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -42,7 +42,7 @@ MDLog::~MDLog() { if (journaler) { delete journaler; journaler = 0; } if (logger) { - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete logger; logger = 0; } @@ -78,8 +78,8 @@ void MDLog::open_logger() // logger char name[80]; snprintf(name, sizeof(name), "mds.%s.log", g_conf->name.get_id().c_str()); - logger = new ProfLogger(&g_ceph_context, name, &mdlog_logtype); - g_ceph_context.GetProfLoggerCollection()->logger_add(logger); + logger = new ProfLogger(g_ceph_context, name, &mdlog_logtype); + g_ceph_context->GetProfLoggerCollection()->logger_add(logger); } void MDLog::init_journaler() @@ -172,7 +172,7 @@ void MDLog::submit_entry(LogEvent *le, Context *c) le->_segment->num_events++; le->update_segment(); - le->set_stamp(ceph_clock_now(&g_ceph_context)); + 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 = ceph_clock_now(&g_ceph_context); + utime_t stop = ceph_clock_now(g_ceph_context); stop += 2.0; map::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 < ceph_clock_now(&g_ceph_context)) + if (stop < ceph_clock_now(g_ceph_context)) break; if ((int)expiring_segments.size() >= g_conf->mds_log_max_expiring) @@ -573,7 +573,7 @@ void MDLog::_replay_thread() } dout(10) << "_replay_thread kicking waiters" << dendl; - finish_contexts(&g_ceph_context, waitfor_replay, 0); + finish_contexts(g_ceph_context, waitfor_replay, 0); dout(10) << "_replay_thread finish" << dendl; mds->mds_lock.Unlock(); diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 70673109a47fe..bbfbcd224d06f 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -111,7 +111,7 @@ MDS::MDS(const std::string &n, Messenger *m, MonClient *mc) : monc->set_messenger(messenger); - mdsmap = new MDSMap(&g_ceph_context); + mdsmap = new MDSMap(g_ceph_context); osdmap = new OSDMap; objecter = new Objecter(messenger, monc, osdmap, mds_lock, timer); @@ -173,12 +173,12 @@ MDS::~MDS() { if (objecter) { delete objecter; objecter = 0; } if (logger) { - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete logger; logger = 0; } if (mlogger) { - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete mlogger; mlogger = 0; } @@ -287,19 +287,19 @@ void MDS::open_logger() g_conf->name.get_id().c_str(), (unsigned long long) monc->get_global_id()); logger = new ProfLogger(cct, name, (ProfLogType*)&mds_logtype); - g_ceph_context.GetProfLoggerCollection()->logger_add(logger); + g_ceph_context->GetProfLoggerCollection()->logger_add(logger); snprintf(name, sizeof(name), "mds.%s.%llu.mem.log", g_conf->name.get_id().c_str(), (unsigned long long) monc->get_global_id()); mlogger = new ProfLogger(cct, name, (ProfLogType*)&mdm_logtype); - g_ceph_context.GetProfLoggerCollection()->logger_add(mlogger); + g_ceph_context->GetProfLoggerCollection()->logger_add(mlogger); mdlog->open_logger(); server->open_logger(); { - ProfLoggerCollection *coll = g_ceph_context.GetProfLoggerCollection(); + ProfLoggerCollection *coll = g_ceph_context->GetProfLoggerCollection(); coll->logger_tare(mdsmap->get_created()); coll->logger_start(); } @@ -575,7 +575,7 @@ void MDS::tick() } // log - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); mds_load_t load = balancer->get_load(now); if (logger) { @@ -627,7 +627,7 @@ void MDS::beacon_send() << " (currently " << ceph_mds_state_name(state) << ")" << dendl; - beacon_seq_stamp[beacon_last_seq] = ceph_clock_now(&g_ceph_context); + 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); @@ -651,7 +651,7 @@ bool MDS::is_laggy() if (beacon_last_acked_stamp == utime_t()) return false; - utime_t now = ceph_clock_now(&g_ceph_context); + 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 @@ -672,7 +672,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 = ceph_clock_now(&g_ceph_context); + 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()) @@ -854,7 +854,7 @@ void MDS::handle_mds_map(MMDSMap *m) entity_addr_t addr; // decode and process - mdsmap = new MDSMap(&g_ceph_context); + mdsmap = new MDSMap(g_ceph_context); mdsmap->decode(m->get_encoded()); monc->sub_got("mdsmap", mdsmap->get_epoch()); @@ -1116,7 +1116,7 @@ void MDS::boot_create() { dout(3) << "boot_create" << dendl; - C_Gather *fin = new C_Gather(&g_ceph_context, new C_MDS_CreateFinish(this)); + C_Gather *fin = new C_Gather(g_ceph_context, new C_MDS_CreateFinish(this)); mdcache->init_layouts(); @@ -1192,7 +1192,7 @@ void MDS::boot_start(int step, int r) case 1: { - C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDS_BootStart(this, 2)); + C_Gather *gather = new C_Gather(g_ceph_context, new C_MDS_BootStart(this, 2)); dout(2) << "boot_start " << step << ": opening inotable" << dendl; inotable->load(gather->new_sub()); @@ -1216,7 +1216,7 @@ void MDS::boot_start(int step, int r) { dout(2) << "boot_start " << step << ": loading/discovering base inodes" << dendl; - C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDS_BootStart(this, 3)); + C_Gather *gather = new C_Gather(g_ceph_context, new C_MDS_BootStart(this, 3)); mdcache->open_mydir_inode(gather->new_sub()); @@ -1433,7 +1433,7 @@ void MDS::reconnect_start() reopen_log(); server->reconnect_clients(); - finish_contexts(&g_ceph_context, waiting_for_reconnect); + finish_contexts(g_ceph_context, waiting_for_reconnect); } void MDS::reconnect_done() { @@ -1468,7 +1468,7 @@ void MDS::rejoin_done() void MDS::clientreplay_start() { dout(1) << "clientreplay_start" << dendl; - finish_contexts(&g_ceph_context, waiting_for_replay); // kick waiters + finish_contexts(g_ceph_context, waiting_for_replay); // kick waiters queue_one_replay(); } @@ -1487,8 +1487,8 @@ void MDS::active_start() mdcache->clean_open_file_lists(); mdcache->scan_stray_dir(); - finish_contexts(&g_ceph_context, waiting_for_replay); // kick waiters - finish_contexts(&g_ceph_context, waiting_for_active); // kick waiters + finish_contexts(g_ceph_context, waiting_for_replay); // kick waiters + finish_contexts(g_ceph_context, waiting_for_active); // kick waiters } @@ -1864,7 +1864,7 @@ bool MDS::_dispatch(Message *m) // hack: thrash exports static utime_t start; - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); if (start == utime_t()) start = now; /*double el = now - start; @@ -2014,7 +2014,7 @@ bool MDS::ms_verify_authorizer(Connection *con, int peer_type, Mutex::Locker l(mds_lock); AuthAuthorizeHandler *authorize_handler = - get_authorize_handler(protocol, &g_ceph_context); + get_authorize_handler(protocol, g_ceph_context); if (!authorize_handler) { dout(0) << "No AuthAuthorizeHandler found for protocol " << protocol << dendl; is_valid = false; diff --git a/src/mds/MDSTable.cc b/src/mds/MDSTable.cc index 521a4052be929..afaa2ba78b04f 100644 --- a/src/mds/MDSTable.cc +++ b/src/mds/MDSTable.cc @@ -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, ceph_clock_now(&g_ceph_context), 0, + bl, ceph_clock_now(g_ceph_context), 0, NULL, new C_MT_Save(this, version)); } @@ -83,7 +83,7 @@ void MDSTable::save_2(version_t v) ls.splice(ls.end(), waitfor_save.begin()->second); waitfor_save.erase(waitfor_save.begin()); } - finish_contexts(&g_ceph_context, ls,0); + finish_contexts(g_ceph_context, ls,0); } diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index f659f32c5aa6d..d25d77b702aa2 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); mds->balancer->subtract_export(dir, now); // fill export message with cache data @@ -1481,8 +1481,8 @@ void Migrator::export_finish(CDir *dir) assert(g_conf->mds_kill_export_at != 13); // finish export (adjust local cache state) - C_Contexts *fin = new C_Contexts(&g_ceph_context); - finish_export_dir(dir, fin->contexts, ceph_clock_now(&g_ceph_context)); + C_Contexts *fin = new C_Contexts(g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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); diff --git a/src/mds/Resetter.h b/src/mds/Resetter.h index ae585d9adbb5e..08da58b366779 100644 --- a/src/mds/Resetter.h +++ b/src/mds/Resetter.h @@ -50,7 +50,7 @@ class Resetter : public Dispatcher { Dispatcher(messenger_->cct), messenger(messenger_), monc(monc_), - lock("Resetter::lock"), timer(&g_ceph_context, lock) + lock("Resetter::lock"), timer(g_ceph_context, lock) {} virtual ~Resetter(); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index ceef8048a3f49..05198cb2fab13 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -81,8 +81,8 @@ void Server::open_logger() char name[80]; snprintf(name, sizeof(name), "mds.%s.server.log", g_conf->name.get_id().c_str()); - logger = new ProfLogger(&g_ceph_context, name, &mdserver_logtype); - g_ceph_context.GetProfLoggerCollection()->logger_add(logger); + logger = new ProfLogger(g_ceph_context, name, &mdserver_logtype); + g_ceph_context->GetProfLoggerCollection()->logger_add(logger); } @@ -403,7 +403,7 @@ void Server::find_idle_sessions() // timeout/stale // (caps go stale, lease die) - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 (ceph_clock_now(&g_ceph_context) >= reconnect_end && + if (ceph_clock_now(g_ceph_context) >= reconnect_end && !client_reconnect_gather.empty()) { dout(10) << "reconnect timed out" << dendl; for (set::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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context); + 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(ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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(ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 *px = new map; inode_t *pi = cur->project_inode(px); pi->version = cur->pre_dirty(); - pi->ctime = ceph_clock_now(&g_ceph_context); + 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 *px = new map; inode_t *pi = cur->project_inode(px); pi->version = cur->pre_dirty(); - pi->ctime = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + mdr->now = ceph_clock_now(g_ceph_context); // -- prepare witnesses -- @@ -4933,7 +4933,7 @@ void Server::handle_client_rename(MDRequest *mdr) vector trace; destdn->make_anchor_trace(trace, srcdnl->get_inode()); - anchorgather = new C_Gather(&g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr)); + anchorgather = new C_Gather(g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr)); mds->anchorclient->prepare_update(srcdnl->get_inode()->ino(), trace, &mdr->more()->src_reanchor_atid, anchorgather->new_sub()); } @@ -4947,7 +4947,7 @@ void Server::handle_client_rename(MDRequest *mdr) straydn->make_anchor_trace(trace, destdnl->get_inode()); if (!anchorgather) - anchorgather = new C_Gather(&g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr)); + anchorgather = new C_Gather(g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr)); mds->anchorclient->prepare_update(destdnl->get_inode()->ino(), trace, &mdr->more()->dst_reanchor_atid, anchorgather->new_sub()); } @@ -6108,7 +6108,7 @@ void Server::handle_client_lssnap(MDRequest *mdr) map infomap; realm->get_snap_info(infomap, diri->get_oldest_snap()); - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); __u32 num = 0; bufferlist dnbl; for (map::iterator p = infomap.begin(); @@ -6209,7 +6209,7 @@ void Server::handle_client_mksnap(MDRequest *mdr) } if (mdr->now == utime_t()) - mdr->now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + pi->ctime = ceph_clock_now(g_ceph_context); pi->version = diri->pre_dirty(); mdr->ls = mdlog->get_current_segment(); diff --git a/src/mds/Server.h b/src/mds/Server.h index cee38eac2dbc3..ec1ee66793fd9 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -57,7 +57,7 @@ class Server { terminating_sessions(false) { } ~Server() { - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete logger; } diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index 0a7bfcd23d6bc..54b684db85daf 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -84,7 +84,7 @@ void SessionMap::_load_finish(int r, bufferlist &bl) << dendl; projected = committing = committed = version; dump(); - finish_contexts(&g_ceph_context, waiting_for_load); + finish_contexts(g_ceph_context, waiting_for_load); } @@ -123,7 +123,7 @@ void SessionMap::save(Context *onsave, version_t needv) mds->objecter->write_full(oid, oloc, snapc, - bl, ceph_clock_now(&g_ceph_context), 0, + bl, ceph_clock_now(g_ceph_context), 0, NULL, new C_SM_Save(this, version)); } @@ -132,7 +132,7 @@ void SessionMap::_save_finish(version_t v) dout(10) << "_save_finish v" << v << dendl; committed = v; - finish_contexts(&g_ceph_context, commit_waiters[v]); + finish_contexts(g_ceph_context, commit_waiters[v]); commit_waiters.erase(v); } @@ -163,7 +163,7 @@ void SessionMap::encode(bufferlist& bl) void SessionMap::decode(bufferlist::iterator& p) { - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); uint64_t pre; ::decode(pre, p); if (pre == (uint64_t)-1) { diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index 9596bc830f017..2f209cb6f7045 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -268,7 +268,7 @@ class SessionMap { else s = session_map[i.name] = new Session; s->inst = i; - s->last_cap_renew = ceph_clock_now(&g_ceph_context); + s->last_cap_renew = ceph_clock_now(g_ceph_context); return s; } void add_session(Session *s) { @@ -286,7 +286,7 @@ class SessionMap { 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 = ceph_clock_now(&g_ceph_context); + session->last_cap_renew = ceph_clock_now(g_ceph_context); } else { assert(0); // hrm, should happen? } diff --git a/src/mds/journal.cc b/src/mds/journal.cc index b4b7bb960def1..0f280978fd070 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -102,14 +102,14 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) dout(20) << " dirty_inode " << **p << dendl; assert((*p)->is_auth()); if ((*p)->is_base()) { - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); (*p)->store(gather->new_sub()); } else commit.insert((*p)->get_parent_dn()->get_dir()); } if (!commit.empty()) { - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); for (set::iterator p = commit.begin(); p != commit.end(); @@ -131,7 +131,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) p != uncommitted_masters.end(); p++) { dout(10) << "try_to_expire waiting for slaves to ack commit on " << *p << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->mdcache->wait_for_uncommitted_master(*p, gather->new_sub()); } @@ -139,19 +139,19 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) for (elist::iterator p = dirty_dirfrag_dir.begin(); !p.end(); ++p) { CInode *in = *p; dout(10) << "try_to_expire waiting for dirlock flush on " << *in << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->locker->scatter_nudge(&in->filelock, gather->new_sub()); } for (elist::iterator p = dirty_dirfrag_dirfragtree.begin(); !p.end(); ++p) { CInode *in = *p; dout(10) << "try_to_expire waiting for dirfragtreelock flush on " << *in << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->locker->scatter_nudge(&in->dirfragtreelock, gather->new_sub()); } for (elist::iterator p = dirty_dirfrag_nest.begin(); !p.end(); ++p) { CInode *in = *p; dout(10) << "try_to_expire waiting for nest flush on " << *in << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->locker->scatter_nudge(&in->nestlock, gather->new_sub()); } @@ -195,7 +195,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) } } if (le) { - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->mdlog->submit_entry(le, gather->new_sub()); dout(10) << "try_to_expire waiting for open files to rejournal" << dendl; } @@ -206,7 +206,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) CInode *in = *p; dout(10) << "try_to_expire waiting for dir parent pointer update on " << *in << dendl; assert(in->state_test(CInode::STATE_DIRTYPARENT)); - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); in->store_parent(gather->new_sub()); } @@ -217,7 +217,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) MDSlaveUpdate *su = *p; dout(10) << "try_to_expire waiting on slave update " << su << dendl; assert(su->waiter == 0); - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); su->waiter = gather->new_sub(); } @@ -227,7 +227,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) << ", committed is " << mds->inotable->get_committed_version() << " (" << mds->inotable->get_committing_version() << ")" << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->inotable->save(gather->new_sub(), inotablev); } @@ -237,7 +237,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) << ", committed is " << mds->sessionmap.committed << " (" << mds->sessionmap.committing << ")" << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); mds->sessionmap.save(gather->new_sub(), sessionmapv); } @@ -249,7 +249,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) for (hash_set::iterator q = p->second.begin(); q != p->second.end(); ++q) { - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); dout(10) << "try_to_expire " << get_mdstable_name(p->first) << " transaction " << *q << " pending commit (not yet acked), waiting" << dendl; assert(!client->has_committed(*q)); @@ -265,7 +265,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) if (p->second > server->get_committed_version()) { dout(10) << "try_to_expire waiting for " << get_mdstable_name(p->first) << " to save, need " << p->second << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); server->save(gather->new_sub()); } } @@ -275,7 +275,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) p != truncating_inodes.end(); p++) { dout(10) << "try_to_expire waiting for truncate of " << **p << dendl; - if (!gather) gather = new C_Gather(&g_ceph_context); + if (!gather) gather = new C_Gather(g_ceph_context); (*p)->add_waiter(CInode::WAIT_TRUNC, gather->new_sub()); } diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 0f7e1788a9b77..c8aa8991cc518 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -1036,7 +1036,7 @@ inline void decode(dirfrag_load_vec_t& c, const utime_t &t, bufferlist::iterator inline ostream& operator<<(ostream& out, dirfrag_load_vec_t& dl) { // ugliness! - utime_t now = ceph_clock_now(&g_ceph_context); + 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) @@ -1134,7 +1134,7 @@ class load_spread_t { DecayCounter count; public: - load_spread_t() : p(0), n(0), count(ceph_clock_now(&g_ceph_context)) + load_spread_t() : p(0), n(0), count(ceph_clock_now(g_ceph_context)) { for (int i=0; i finished; take_waiting(mask, finished); - finish_contexts(&g_ceph_context, finished, result); + finish_contexts(g_ceph_context, finished, result); } diff --git a/src/messages/MMonPaxos.h b/src/messages/MMonPaxos.h index f3f9416f1b9f9..a2d8a6a85688e 100644 --- a/src/messages/MMonPaxos.h +++ b/src/messages/MMonPaxos.h @@ -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 = ceph_clock_now(&g_ceph_context); + sent_timestamp = ceph_clock_now(g_ceph_context); } private: diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 0a64440e4be8c..7d02efaa46249 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -94,7 +94,7 @@ void AuthMonitor::create_initial(bufferlist& bl) dout(10) << "create_initial -- creating initial map" << dendl; KeyRing keyring; - if (keyring.load(&g_ceph_context, g_conf->keyring) == 0) { + if (keyring.load(g_ceph_context, g_conf->keyring) == 0) { import_keyring(keyring); } @@ -365,7 +365,7 @@ bool AuthMonitor::prep_auth(MAuth *m, bool paxos_writable) goto reply; } - s->auth_handler = get_auth_service_handler(&g_ceph_context, + s->auth_handler = get_auth_service_handler(g_ceph_context, &mon->key_server, supported); if (!s->auth_handler) { ret = -ENOTSUP; diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index a3c7f206097b7..e4acab0481140 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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)); @@ -285,7 +285,7 @@ void Elector::dispatch(Message *m) { MMonElection *em = (MMonElection*)m; - MonMap *peermap = new MonMap(ceph_clock_now(&g_ceph_context)); + MonMap *peermap = new MonMap(ceph_clock_now(g_ceph_context)); peermap->decode(em->monmap_bl); if (peermap->epoch > mon->monmap->epoch) { dout(0) << m->get_source_inst() << " has newer monmap epoch " << peermap->epoch diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 6a3f1e2d071f1..5b8605dc80cde 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -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 = ceph_clock_now(&g_ceph_context); + e.stamp = ceph_clock_now(g_ceph_context); e.type = CLOG_INFO; std::stringstream ss; ss << "mkfs " << mon->monmap->get_fsid(); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 99b92feb10da1..d5c797eb83de3 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + last_beacon[gid].stamp = ceph_clock_now(g_ceph_context); last_beacon[gid].seq = seq; // new incompat? @@ -500,7 +500,7 @@ bool MDSMonitor::preprocess_command(MMonCommand *m) p = 0; r = -ENOENT; } else { - p = new MDSMap(&g_ceph_context); + p = new MDSMap(g_ceph_context); p->decode(b); } } @@ -522,7 +522,7 @@ bool MDSMonitor::preprocess_command(MMonCommand *m) if (!b.length()) { r = -ENOENT; } else { - MDSMap m(&g_ceph_context); + MDSMap m(g_ceph_context); m.decode(b); m.encode(rdata); ss << "got mdsmap epoch " << m.get_epoch(); @@ -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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t until = ceph_clock_now(g_ceph_context); until += g_conf->mds_blacklist_interval; for (map::iterator p = pending_mdsmap.up.begin(); p != pending_mdsmap.up.end(); @@ -715,7 +715,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m) ss << "max_mds = " << pending_mdsmap.max_mds; } else if (m->cmd[1] == "setmap" && m->cmd.size() == 3) { - MDSMap map(&g_ceph_context); + MDSMap map(g_ceph_context); map.decode(m->get_data()); epoch_t e = atoi(m->cmd[2].c_str()); //if (ceph_fsid_compare(&map.get_fsid(), &mon->monmap->fsid) == 0) { @@ -812,7 +812,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m) } } } else if (m->cmd[1] == "newfs" && m->cmd.size() == 4) { - MDSMap newmap(&g_ceph_context); + MDSMap newmap(g_ceph_context); int metadata = atoi(m->cmd[2].c_str()); int data = atoi(m->cmd[3].c_str()); pending_mdsmap = newmap; @@ -905,7 +905,7 @@ void MDSMonitor::tick() } // check beacon timestamps - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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; diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 7150fbf547efc..8abf44cdce4ad 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -105,8 +105,8 @@ class MDSMonitor : public PaxosService { public: MDSMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p), - mdsmap(&g_ceph_context), - pending_mdsmap(&g_ceph_context) + mdsmap(g_ceph_context), + pending_mdsmap(g_ceph_context) { } diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index d9a5d792f6b8d..863a9538c47bf 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -263,7 +263,7 @@ epoch_t Monitor::get_epoch() void Monitor::win_election(epoch_t epoch, set& active) { state = STATE_LEADER; - leader_since = ceph_clock_now(&g_ceph_context); + leader_since = ceph_clock_now(g_ceph_context); leader = rank; quorum = active; dout(10) << "win_election, epoch " << epoch << " quorum is " << quorum << dendl; @@ -499,7 +499,7 @@ void Monitor::forward_request_leader(PaxosServiceMessage *req) } else if (session && !session->closed) { RoutedRequest *rr = new RoutedRequest; rr->tid = ++routed_request_tid; - encode_message(&g_ceph_context, req, rr->request_bl); + encode_message(g_ceph_context, req, rr->request_bl); rr->session = (MonSession *)session->get(); routed_requests[rr->tid] = rr; session->routed_request_tids.insert(rr->tid); @@ -556,7 +556,7 @@ void Monitor::try_send_message(Message *m, entity_inst_t to) dout(10) << "try_send_message " << *m << " to " << to << dendl; bufferlist bl; - encode_message(&g_ceph_context, m, bl); + encode_message(g_ceph_context, m, bl); messenger->send_message(m, to); @@ -744,7 +744,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 = ceph_clock_now(&g_ceph_context); + 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 @@ -903,7 +903,7 @@ void Monitor::handle_subscribe(MMonSubscribe *m) return; } - s->until = ceph_clock_now(&g_ceph_context); + s->until = ceph_clock_now(g_ceph_context); s->until += g_conf->mon_subscribe_interval; for (map::iterator p = m->what.begin(); p != m->what.end(); @@ -1037,7 +1037,7 @@ void Monitor::tick() (*p)->tick(); // trim sessions - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); xlist::iterator p = session_map.sessions.begin(); while (!p.end()) { MonSession *s = *p; @@ -1131,7 +1131,7 @@ bool Monitor::ms_get_authorizer(int service_id, AuthAuthorizer **authorizer, boo if (service_id != CEPH_ENTITY_TYPE_MON) return false; - if (!is_supported_auth(CEPH_AUTH_CEPHX, &g_ceph_context)) + if (!is_supported_auth(CEPH_AUTH_CEPHX, g_ceph_context)) return false; CephXServiceTicketInfo auth_ticket_info; @@ -1169,7 +1169,7 @@ bool Monitor::ms_get_authorizer(int service_id, AuthAuthorizer **authorizer, boo ::encode(blob, ticket_data); bufferlist::iterator iter = ticket_data.begin(); - CephXTicketHandler handler(&g_ceph_context, service_id); + CephXTicketHandler handler(g_ceph_context, service_id); ::decode(handler.ticket, iter); handler.session_key = info.session_key; @@ -1188,7 +1188,7 @@ bool Monitor::ms_verify_authorizer(Connection *con, int peer_type, << " protocol " << protocol << dendl; if (peer_type == CEPH_ENTITY_TYPE_MON && - is_supported_auth(CEPH_AUTH_CEPHX, &g_ceph_context)) { + is_supported_auth(CEPH_AUTH_CEPHX, g_ceph_context)) { // monitor, and cephx is enabled isvalid = false; if (protocol == CEPH_AUTH_CEPHX) { @@ -1196,7 +1196,7 @@ bool Monitor::ms_verify_authorizer(Connection *con, int peer_type, CephXServiceTicketInfo auth_ticket_info; if (authorizer_data.length()) { - int ret = cephx_verify_authorizer(&g_ceph_context, &key_server, iter, + int ret = cephx_verify_authorizer(g_ceph_context, &key_server, iter, auth_ticket_info, authorizer_reply); if (ret >= 0) isvalid = true; diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 176b35786d1a5..0050c4dcfe08b 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -87,7 +87,7 @@ void MonmapMonitor::create_pending() { pending_map = *mon->monmap; pending_map.epoch++; - pending_map.last_changed = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 diff --git a/src/mon/MonmapMonitor.h b/src/mon/MonmapMonitor.h index be987f6bfddab..8322c55a928ee 100644 --- a/src/mon/MonmapMonitor.h +++ b/src/mon/MonmapMonitor.h @@ -37,7 +37,7 @@ class MMonCommand; class MonmapMonitor : public PaxosService { public: MonmapMonitor(Monitor *mn, Paxos *p) - : PaxosService(mn, p), pending_map(ceph_clock_now(&g_ceph_context)) + : PaxosService(mn, p), pending_map(ceph_clock_now(g_ceph_context)) { } MonMap pending_map; //the pending map awaiting passage diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 20b975483c0c1..63e09f8153928 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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 = ceph_clock_now(&g_ceph_context); + 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] = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + pending_inc.modified = ceph_clock_now(g_ceph_context); // tell me about it for (map::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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); map::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 = ceph_clock_now(&g_ceph_context); + 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(), ceph_clock_now(&g_ceph_context)); + 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(), ceph_clock_now(&g_ceph_context)); + 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; diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index c6a71a4a4f7b0..7d3acc624bb09 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -129,7 +129,7 @@ bool PGMonitor::update_from_paxos() } // walk through incrementals - utime_t now(ceph_clock_now(&g_ceph_context)); + 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(ceph_clock_now(&g_ceph_context)); + 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] = ceph_clock_now(&g_ceph_context); + 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 msg; - utime_t now = ceph_clock_now(&g_ceph_context); + 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] = ceph_clock_now(&g_ceph_context); + last_sent_pg_create[p->first] = ceph_clock_now(g_ceph_context); } } diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 803bf705ca3f6..bc8e3af2b854e 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -294,9 +294,9 @@ void Paxos::handle_last(MMonPaxos *last) extend_lease(); // wake people up - finish_contexts(&g_ceph_context, waiting_for_active); - finish_contexts(&g_ceph_context, waiting_for_readable); - finish_contexts(&g_ceph_context, waiting_for_writeable); + finish_contexts(g_ceph_context, waiting_for_active); + finish_contexts(g_ceph_context, waiting_for_readable); + finish_contexts(g_ceph_context, waiting_for_writeable); } } } else { @@ -344,10 +344,10 @@ void Paxos::begin(bufferlist& v) // we're alone, take it easy commit(); state = STATE_ACTIVE; - finish_contexts(&g_ceph_context, waiting_for_active); - finish_contexts(&g_ceph_context, waiting_for_commit); - finish_contexts(&g_ceph_context, waiting_for_readable); - finish_contexts(&g_ceph_context, waiting_for_writeable); + finish_contexts(g_ceph_context, waiting_for_active); + finish_contexts(g_ceph_context, waiting_for_commit); + finish_contexts(g_ceph_context, waiting_for_readable); + finish_contexts(g_ceph_context, waiting_for_writeable); update_observers(); return; } @@ -450,10 +450,10 @@ void Paxos::handle_accept(MMonPaxos *accept) extend_lease(); // wake people up - finish_contexts(&g_ceph_context, waiting_for_active); - finish_contexts(&g_ceph_context, waiting_for_commit); - finish_contexts(&g_ceph_context, waiting_for_readable); - finish_contexts(&g_ceph_context, waiting_for_writeable); + finish_contexts(g_ceph_context, waiting_for_active); + finish_contexts(g_ceph_context, waiting_for_commit); + finish_contexts(g_ceph_context, waiting_for_readable); + finish_contexts(g_ceph_context, waiting_for_writeable); } accept->put(); } @@ -478,7 +478,7 @@ void Paxos::commit() // commit locally last_committed++; - last_commit_time = ceph_clock_now(&g_ceph_context); + last_commit_time = ceph_clock_now(g_ceph_context); mon->store->put_int(last_committed, machine_name, "last_committed"); // tell everyone @@ -518,7 +518,7 @@ void Paxos::handle_commit(MMonPaxos *commit) commit->put(); - finish_contexts(&g_ceph_context, waiting_for_commit); + finish_contexts(g_ceph_context, waiting_for_commit); } void Paxos::extend_lease() @@ -526,7 +526,7 @@ void Paxos::extend_lease() assert(mon->is_leader()); assert(is_active()); - lease_expire = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + ack->lease_timestamp = ceph_clock_now(g_ceph_context); mon->messenger->send_message(ack, lease->get_source_inst()); // (re)set timeout event. @@ -619,9 +619,9 @@ void Paxos::handle_lease(MMonPaxos *lease) trim_to(lease->first_committed); // kick waiters - finish_contexts(&g_ceph_context, waiting_for_active); + finish_contexts(g_ceph_context, waiting_for_active); if (is_readable()) - finish_contexts(&g_ceph_context, waiting_for_readable); + finish_contexts(g_ceph_context, waiting_for_readable); lease->put(); } @@ -780,8 +780,8 @@ void Paxos::peon_init() dout(10) << "peon_init -- i am a peon" << dendl; // no chance to write now! - finish_contexts(&g_ceph_context, waiting_for_writeable, -1); - finish_contexts(&g_ceph_context, waiting_for_commit, -1); + finish_contexts(g_ceph_context, waiting_for_writeable, -1); + finish_contexts(g_ceph_context, waiting_for_commit, -1); } void Paxos::election_starting() @@ -790,7 +790,7 @@ void Paxos::election_starting() cancel_events(); new_value.clear(); - finish_contexts(&g_ceph_context, waiting_for_commit, -1); + finish_contexts(g_ceph_context, waiting_for_commit, -1); } @@ -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 = ceph_clock_now(&g_ceph_context); + 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 (ceph_clock_now(&g_ceph_context) > 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=" << ceph_clock_now(&g_ceph_context) << " 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 - ceph_clock_now(&g_ceph_context) < 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() && - ceph_clock_now(&g_ceph_context) < lease_expire; + ceph_clock_now(g_ceph_context) < lease_expire; } bool Paxos::propose_new_value(bufferlist& bl, Context *oncommit) diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 9769078df223b..e1c1cc9a4b979 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -94,7 +94,7 @@ bool PaxosService::should_propose(double& delay) if (paxos->last_committed <= 1) delay = 0.0; else { - utime_t now = ceph_clock_now(&g_ceph_context); + 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 diff --git a/src/monmaptool.cc b/src/monmaptool.cc index de3ed9a441715..7f1fbd9479bb2 100644 --- a/src/monmaptool.cc +++ b/src/monmaptool.cc @@ -51,7 +51,7 @@ int main(int argc, const char **argv) global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); FOR_EACH_ARG(args) { if (CEPH_ARGPARSE_EQ("help", '\0')) { usage(); @@ -92,7 +92,7 @@ int main(int argc, const char **argv) if (!fn) usage(); - MonMap monmap(ceph_clock_now(&g_ceph_context)); + MonMap monmap(ceph_clock_now(g_ceph_context)); cout << me << ": monmap file " << fn << std::endl; diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index a4f4f8305249e..a6a66283be6e9 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -765,7 +765,7 @@ void FileJournal::do_write(bufferlist& bl) << (hbp.length() ? " + header":"") << dendl; - utime_t from = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context) - from; + utime_t lat = ceph_clock_now(g_ceph_context) - from; dout(20) << "do_write latency " << lat << dendl; write_lock.Lock(); diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index fa0741b66d505..fce4726ca4f7b 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -864,14 +864,14 @@ FileStore::FileStore(const std::string &base, const std::string &jdev) : basedir_fd(-1), current_fd(-1), attrs(this), fake_attrs(false), collections(this), fake_collections(false), - ondisk_finisher(&g_ceph_context), + ondisk_finisher(g_ceph_context), lock("FileStore::lock"), force_sync(false), sync_epoch(0), sync_entry_timeo_lock("sync_entry_timeo_lock"), - timer(&g_ceph_context, sync_entry_timeo_lock), + timer(g_ceph_context, sync_entry_timeo_lock), stop(false), sync_thread(this), - op_queue_len(0), op_queue_bytes(0), op_finisher(&g_ceph_context), next_finish(0), - op_tp(&g_ceph_context, "FileStore::op_tp", g_conf->filestore_op_threads), op_wq(this, &op_tp), + op_queue_len(0), op_queue_bytes(0), op_finisher(g_ceph_context), next_finish(0), + op_tp(g_ceph_context, "FileStore::op_tp", g_conf->filestore_op_threads), op_wq(this, &op_tp), flusher_queue_len(0), flusher_thread(this), logger(NULL) { @@ -1902,11 +1902,11 @@ void FileStore::start_logger(int whoami, utime_t tare) char name[80]; snprintf(name, sizeof(name), "osd.%d.fs.log", whoami); - logger = new ProfLogger(&g_ceph_context, name, (ProfLogType*)&fs_logtype); + logger = new ProfLogger(g_ceph_context, name, (ProfLogType*)&fs_logtype); if (journal) journal->logger = logger; { - ProfLoggerCollection *coll = g_ceph_context.GetProfLoggerCollection(); + ProfLoggerCollection *coll = g_ceph_context->GetProfLoggerCollection(); coll->logger_add(logger); coll->logger_tare(tare); coll->logger_start(); @@ -1919,7 +1919,7 @@ void FileStore::stop_logger() if (logger) { if (journal) journal->logger = NULL; - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete logger; logger = NULL; } @@ -3011,10 +3011,10 @@ void FileStore::sync_entry() utime_t min_interval; min_interval.set_from_double(g_conf->filestore_min_sync_interval); - utime_t startwait = ceph_clock_now(&g_ceph_context); + 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(&g_ceph_context, lock, max_interval); + sync_cond.WaitInterval(g_ceph_context, lock, max_interval); } else { dout(20) << "sync_entry not waiting, force_sync set" << dendl; } @@ -3024,7 +3024,7 @@ void FileStore::sync_entry() force_sync = false; } else { // wait for at least the min interval - utime_t woke = ceph_clock_now(&g_ceph_context); + utime_t woke = ceph_clock_now(g_ceph_context); woke -= startwait; dout(20) << "sync_entry woke after " << woke << dendl; if (woke < min_interval) { @@ -3032,7 +3032,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(&g_ceph_context, lock, t); + sync_cond.WaitInterval(g_ceph_context, lock, t); } } @@ -3042,7 +3042,7 @@ void FileStore::sync_entry() lock.Unlock(); if (commit_start()) { - utime_t start = ceph_clock_now(&g_ceph_context); + utime_t start = ceph_clock_now(g_ceph_context); uint64_t cp = committing_seq; SyncEntryTimeout *sync_entry_timeo = new SyncEntryTimeout(); @@ -3122,7 +3122,7 @@ void FileStore::sync_entry() } } - utime_t done = ceph_clock_now(&g_ceph_context); + utime_t done = ceph_clock_now(g_ceph_context); done -= start; dout(10) << "sync_entry commit took " << done << dendl; commit_finish(); @@ -3157,7 +3157,7 @@ void FileStore::sync_entry() } lock.Lock(); - finish_contexts(&g_ceph_context, fin, 0); + finish_contexts(g_ceph_context, fin, 0); fin.clear(); if (!sync_waiters.empty()) { dout(10) << "sync_entry more waiters, committing again" << dendl; diff --git a/src/os/JournalingObjectStore.h b/src/os/JournalingObjectStore.h index 2addfe9ce69ff..a04feec55763e 100644 --- a/src/os/JournalingObjectStore.h +++ b/src/os/JournalingObjectStore.h @@ -69,7 +69,7 @@ class JournalingObjectStore : public ObjectStore { JournalingObjectStore() : op_seq(0), applied_seq(0), committing_seq(0), committed_seq(0), open_ops(0), blocked(false), - journal(NULL), finisher(&g_ceph_context), + journal(NULL), finisher(g_ceph_context), journal_lock("JournalingObjectStore::journal_lock"), com_lock("JournalingObjectStore::com_lock") { } diff --git a/src/osd/Ager.cc b/src/osd/Ager.cc index dd70b63dbf953..fb8afd7e9b89e 100644 --- a/src/osd/Ager.cc +++ b/src/osd/Ager.cc @@ -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 (ceph_clock_now(&g_ceph_context) > 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 = ceph_clock_now(&g_ceph_context); + 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 (ceph_clock_now(&g_ceph_context) > 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 (ceph_clock_now(&g_ceph_context) > nextfl) { + if (ceph_clock_now(g_ceph_context) > nextfl) { elapsed += freelist_inc; save_freelist(elapsed); nextfl.sec_ref() += freelist_inc; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 416ed018fb228..5ad1a608de01b 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t end = ceph_clock_now(g_ceph_context); end -= start; dout(0) << "measured " << (1000.0 / (double)end) << " mb/sec" << dendl; ObjectStore::Transaction tr; @@ -427,7 +427,7 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger, heartbeat_thread(this), heartbeat_dispatcher(this), decayrate(5.0), - stat_oprate(ceph_clock_now(&g_ceph_context)), + stat_oprate(ceph_clock_now(g_ceph_context)), peer_stat_lock("OSD::peer_stat_lock"), read_latency_calc(g_conf->osd_max_opq<1 ? 1:g_conf->osd_max_opq), qlen_calc(3), @@ -480,7 +480,7 @@ OSD::~OSD() { delete map_in_progress_cond; delete class_handler; - g_ceph_context.GetProfLoggerCollection()->logger_remove(logger); + g_ceph_context->GetProfLoggerCollection()->logger_remove(logger); delete logger; delete store; } @@ -695,8 +695,8 @@ void OSD::open_logger() char name[80]; snprintf(name, sizeof(name), "osd.%d.log", whoami); - logger = new ProfLogger(&g_ceph_context, name, (ProfLogType*)&osd_logtype); - g_ceph_context.GetProfLoggerCollection()->logger_add(logger); + logger = new ProfLogger(g_ceph_context, name, (ProfLogType*)&osd_logtype); + g_ceph_context->GetProfLoggerCollection()->logger_add(logger); if (osdmap->get_epoch() > 0) start_logger(); @@ -704,7 +704,7 @@ void OSD::open_logger() void OSD::start_logger() { - ProfLoggerCollection *coll = g_ceph_context.GetProfLoggerCollection(); + ProfLoggerCollection *coll = g_ceph_context->GetProfLoggerCollection(); coll->logger_tare(osdmap->get_created()); coll->logger_start(); logger_started = true; @@ -1170,7 +1170,7 @@ PG *OSD::get_or_create_pg(const PG::Info& info, epoch_t epoch, int from, int& cr // ok, create PG locally using provided Info and History *pt = new ObjectStore::Transaction; - *pfin = new C_Contexts(&g_ceph_context); + *pfin = new C_Contexts(g_ceph_context); if (create) { pg = _create_lock_new_pg(info.pgid, acting, **pt); } else { @@ -1202,7 +1202,7 @@ PG *OSD::get_or_create_pg(const PG::Info& info, epoch_t epoch, int from, int& cr return NULL; } *pt = new ObjectStore::Transaction; - *pfin = new C_Contexts(&g_ceph_context); + *pfin = new C_Contexts(g_ceph_context); } return pg; } @@ -1425,7 +1425,7 @@ void OSD::update_heartbeat_peers() old_from.swap(heartbeat_from); old_con.swap(heartbeat_con); - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); heartbeat_epoch = osdmap->get_epoch(); @@ -1658,7 +1658,7 @@ void OSD::handle_osd_ping(MOSDPing *m) if (locked && !is_booting()) _share_map_outgoing(osdmap->get_cluster_inst(from)); - heartbeat_from_stamp[from] = ceph_clock_now(&g_ceph_context); // 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)) { @@ -1698,7 +1698,7 @@ void OSD::heartbeat_entry() utime_t w; w.set_from_double(wait); dout(30) << "heartbeat_entry sleeping for " << wait << dendl; - heartbeat_cond.WaitInterval(&g_ceph_context, heartbeat_lock, w); + heartbeat_cond.WaitInterval(g_ceph_context, heartbeat_lock, w); dout(30) << "heartbeat_entry woke up" << dendl; } heartbeat_lock.Unlock(); @@ -1710,7 +1710,7 @@ void OSD::heartbeat_check() // we should also have map_lock rdlocked. // check for incoming heartbeats (move me elsewhere?) - utime_t grace = ceph_clock_now(&g_ceph_context); + utime_t grace = ceph_clock_now(g_ceph_context); grace -= g_conf->osd_heartbeat_grace; for (map::iterator p = heartbeat_from.begin(); p != heartbeat_from.end(); @@ -1728,7 +1728,7 @@ void OSD::heartbeat_check() void OSD::heartbeat() { - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); dout(30) << "heartbeat" << dendl; @@ -1852,7 +1852,7 @@ void OSD::tick() check_replay_queue(); // mon report? - utime_t now = ceph_clock_now(&g_ceph_context); + 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(); @@ -1898,7 +1898,7 @@ void OSD::do_mon_report() { dout(7) << "do_mon_report" << dendl; - utime_t now(ceph_clock_now(&g_ceph_context)); + utime_t now(ceph_clock_now(g_ceph_context)); last_mon_report = now; // do any pending reports @@ -1918,7 +1918,7 @@ void OSD::ms_handle_connect(Connection *con) send_alive(); send_pg_temp(); send_failures(); - send_pg_stats(ceph_clock_now(&g_ceph_context)); + send_pg_stats(ceph_clock_now(g_ceph_context)); } } @@ -1989,7 +1989,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 = ceph_clock_now(&g_ceph_context); + 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 @@ -2047,7 +2047,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 = ceph_clock_now(&g_ceph_context); + utime_t expire = ceph_clock_now(g_ceph_context); expire += w.timeout_seconds; obc->unconnected_watchers[notif_iter->first] = expire; } @@ -2100,7 +2100,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 = ceph_clock_now(&g_ceph_context); + last_mon_report = ceph_clock_now(g_ceph_context); send_alive(); } else { dout(10) << "queue_want_up_thru want " << want << " <= queued " << up_thru_wanted @@ -2274,7 +2274,7 @@ void OSD::handle_command(MMonCommand *m) ObjectStore::Transaction *cleanupt = new ObjectStore::Transaction; store->sync_and_flush(); - utime_t start = ceph_clock_now(&g_ceph_context); + 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); @@ -2286,7 +2286,7 @@ void OSD::handle_command(MMonCommand *m) cleanupt->remove(coll_t::META_COLL, soid); } store->sync_and_flush(); - utime_t end = ceph_clock_now(&g_ceph_context); + utime_t end = ceph_clock_now(g_ceph_context); // clean up store->queue_transaction(NULL, cleanupt); @@ -2327,9 +2327,9 @@ void OSD::handle_command(MMonCommand *m) } } else if (m->cmd.size() == 2 && m->cmd[0] == "logger" && m->cmd[1] == "reset") { - g_ceph_context.GetProfLoggerCollection()->logger_reset_all(); + g_ceph_context->GetProfLoggerCollection()->logger_reset_all(); } else if (m->cmd.size() == 2 && m->cmd[0] == "logger" && m->cmd[1] == "reopen") { - g_ceph_context.reopen_logs(); + g_ceph_context->reopen_logs(); } else if (m->cmd[0] == "heap") { if (ceph_using_tcmalloc()) ceph_heap_profiler_handle_command(m->cmd, clog); @@ -2383,7 +2383,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 = ceph_clock_now(&g_ceph_context); + defer_recovery_until = ceph_clock_now(g_ceph_context); defer_recovery_until += g_conf->osd_recovery_delay_start; recovery_wq.kick(); } @@ -2601,7 +2601,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type, bool& isvalid) { AuthAuthorizeHandler *authorize_handler = - get_authorize_handler(protocol, &g_ceph_context); + get_authorize_handler(protocol, g_ceph_context); if (!authorize_handler) { dout(0) << "No AuthAuthorizeHandler found for protocol " << protocol << dendl; isvalid = false; @@ -2613,7 +2613,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type, uint64_t global_id; uint64_t auid = CEPH_AUTH_UID_DEFAULT; - isvalid = authorize_handler->verify_authorizer(&g_ceph_context, monc->rotating_secrets, + isvalid = authorize_handler->verify_authorizer(g_ceph_context, monc->rotating_secrets, authorizer_data, authorizer_reply, name, global_id, caps_info, &auid); dout(10) << "OSD::ms_verify_authorizer name=" << name << " auid=" << auid << dendl; @@ -2876,7 +2876,7 @@ void OSD::sched_scrub() dout(20) << "sched_scrub" << dendl; pair pos; - utime_t max = ceph_clock_now(&g_ceph_context); + utime_t max = ceph_clock_now(g_ceph_context); max -= g_conf->osd_scrub_max_interval; sched_scrub_lock.Lock(); @@ -3183,16 +3183,16 @@ void OSD::handle_osd_map(MOSDMap *m) note_down_osd(*p); if (!logger_started) - g_ceph_context.GetProfLoggerCollection()->logger_start(); + g_ceph_context->GetProfLoggerCollection()->logger_start(); osdmap = newmap; superblock.current_epoch = cur; advance_map(t); - had_map_since = ceph_clock_now(&g_ceph_context); + had_map_since = ceph_clock_now(g_ceph_context); } - C_Contexts *fin = new C_Contexts(&g_ceph_context); + C_Contexts *fin = new C_Contexts(g_ceph_context); if (osdmap->is_up(whoami) && osdmap->get_addr(whoami) == client_messenger->get_myaddr()) { @@ -3805,7 +3805,7 @@ void OSD::kick_pg_split_queue() // create and lock children ObjectStore::Transaction *t = new ObjectStore::Transaction; - C_Contexts *fin = new C_Contexts(&g_ceph_context); + C_Contexts *fin = new C_Contexts(g_ceph_context); map children; for (set::iterator q = p->second.begin(); q != p->second.end(); @@ -4045,7 +4045,7 @@ void OSD::handle_pg_create(MOSDPGCreate *m) if (can_create_pg(pgid)) { ObjectStore::Transaction *t = new ObjectStore::Transaction; - C_Contexts *fin = new C_Contexts(&g_ceph_context); + C_Contexts *fin = new C_Contexts(g_ceph_context); PG *pg = _create_lock_new_pg(pgid, creating_pgs[pgid].acting, *t); creating_pgs.erase(pgid); @@ -4676,7 +4676,7 @@ void OSD::generate_backlog(PG *pg) map< int, map > query_map; map< int, MOSDPGInfo* > info_map; ObjectStore::Transaction *t = new ObjectStore::Transaction; - C_Contexts *fin = new C_Contexts(&g_ceph_context); + C_Contexts *fin = new C_Contexts(g_ceph_context); PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t); if (!pg->generate_backlog_epoch) { @@ -4721,7 +4721,7 @@ void OSD::generate_backlog(PG *pg) void OSD::check_replay_queue() { - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); list< pair > pgids; replay_queue_lock.Lock(); while (!replay_queue.empty() && @@ -4778,7 +4778,7 @@ bool OSD::_recover_now() << " >= max " << g_conf->osd_recovery_max_active << dendl; return false; } - if (ceph_clock_now(&g_ceph_context) < 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; } @@ -4978,7 +4978,7 @@ void OSD::handle_op(MOSDOp *op) // ... throttle_op_queue(); - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); int r = init_op_flags(op); if (r) { diff --git a/src/osd/OSD.h b/src/osd/OSD.h index db31c569f66d5..acfc42b177812 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -270,7 +270,7 @@ class OSD : public Dispatcher { public: OSD *osd; HeartbeatDispatcher(OSD *o) - : Dispatcher(&g_ceph_context), osd(o) + : Dispatcher(g_ceph_context), osd(o) { } } heartbeat_dispatcher; @@ -739,7 +739,7 @@ class OSD : public Dispatcher { osd->recovery_queue.push_back(&pg->recovery_item); if (g_conf->osd_recovery_delay_start > 0) { - osd->defer_recovery_until = ceph_clock_now(&g_ceph_context); + osd->defer_recovery_until = ceph_clock_now(g_ceph_context); osd->defer_recovery_until += g_conf->osd_recovery_delay_start; } return true; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 403169d0ba82a..5e56197a28ab7 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1120,7 +1120,7 @@ void PG::mark_all_unfound_as_lost(ObjectStore::Transaction& t) log.print(*_dout); *_dout << dendl; - utime_t mtime = ceph_clock_now(&g_ceph_context); + 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::iterator m = missing.missing.begin(); @@ -1479,7 +1479,7 @@ void PG::activate(ObjectStore::Transaction& t, list& tfin, assert(!is_active()); // -- crash recovery? if (is_crashed()) { - replay_until = ceph_clock_now(&g_ceph_context); + 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 > ceph_clock_now(&g_ceph_context)) { + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context) - 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, ceph_clock_now(&g_ceph_context) - 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(); diff --git a/src/osd/PG.h b/src/osd/PG.h index de82541b3a9fb..1c16950272024 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -866,12 +866,12 @@ class PG { assert(!rctx); rctx = new_ctx; if (rctx) - rctx->start_time = ceph_clock_now(&g_ceph_context); + rctx->start_time = ceph_clock_now(g_ceph_context); } void end_handle() { if (rctx) { - utime_t dur = ceph_clock_now(&g_ceph_context) - 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 @@ class PG { const char *state_name; utime_t enter_time; const char *get_state_name() { return state_name; } - NamedState() : enter_time(ceph_clock_now(&g_ceph_context)) {} + NamedState() : enter_time(ceph_clock_now(g_ceph_context)) {} virtual ~NamedState() {} }; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 7cfad83a113f4..cb0f6704d9ad0 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -569,7 +569,7 @@ void ReplicatedPG::do_op(MOSDOp *op) } // note my stats - utime_t now = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); for (map::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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); for (map::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(ceph_clock_now(&g_ceph_context), 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(ceph_clock_now(&g_ceph_context), 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)); } @@ -4373,7 +4373,7 @@ int ReplicatedPG::start_recovery_ops(int max) dout(10) << __func__ << ": all OSDs in the PG are up-to-date!" << dendl; log.reset_recovery_pointers(); ObjectStore::Transaction *t = new ObjectStore::Transaction; - C_Contexts *fin = new C_Contexts(&g_ceph_context); + C_Contexts *fin = new C_Contexts(g_ceph_context); finish_recovery(*t, fin->contexts); int tr = osd->store->queue_transaction(&osr, t, new ObjectStore::C_DeleteTransaction(t), fin); assert(tr == 0); diff --git a/src/osdc/Filer.h b/src/osdc/Filer.h index 536d63fac7e33..938837945f80c 100644 --- a/src/osdc/Filer.h +++ b/src/osdc/Filer.h @@ -194,9 +194,9 @@ class Filer { } else { C_Gather *gack = 0, *gcom = 0; if (onack) - gack = new C_Gather(&g_ceph_context, onack); + gack = new C_Gather(g_ceph_context, onack); if (oncommit) - gcom = new C_Gather(&g_ceph_context, oncommit); + gcom = new C_Gather(g_ceph_context, oncommit); for (vector::iterator p = extents.begin(); p != extents.end(); p++) { vector ops(1); ops[0].op.op = CEPH_OSD_OP_TRIMTRUNC; @@ -231,9 +231,9 @@ class Filer { } else { C_Gather *gack = 0, *gcom = 0; if (onack) - gack = new C_Gather(&g_ceph_context, onack); + gack = new C_Gather(g_ceph_context, onack); if (oncommit) - gcom = new C_Gather(&g_ceph_context, oncommit); + gcom = new C_Gather(g_ceph_context, oncommit); for (vector::iterator p = extents.begin(); p != extents.end(); p++) { if (p->offset == 0 && p->length == layout->fl_object_size) objecter->remove(p->oid, p->oloc, diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 819cf61282c75..d9e41ec59eb9a 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -195,7 +195,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl) state = STATE_ACTIVE; list ls; ls.swap(waitfor_recover); - finish_contexts(&g_ceph_context, ls, 0); + finish_contexts(g_ceph_context, ls, 0); return; } @@ -209,7 +209,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl) << magic << "'" << dendl; list ls; ls.swap(waitfor_recover); - finish_contexts(&g_ceph_context, ls, -EINVAL); + finish_contexts(g_ceph_context, ls, -EINVAL); return; } @@ -283,7 +283,7 @@ void Journaler::_finish_probe_end(int r, uint64_t end) // done. list ls; ls.swap(waitfor_recover); - finish_contexts(&g_ceph_context, ls, 0); + finish_contexts(g_ceph_context, ls, 0); } class Journaler::C_RereadHeadProbe : public Context @@ -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 = ceph_clock_now(&g_ceph_context); + 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, ceph_clock_now(&g_ceph_context), 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 = ceph_clock_now(&g_ceph_context); + utime_t lat = ceph_clock_now(g_ceph_context); lat -= stamp; logger->favg(logger_key_lat, lat); } @@ -408,7 +408,7 @@ void Journaler::_finish_flush(int r, uint64_t start, utime_t stamp) while (!waitfor_safe.empty()) { if (waitfor_safe.begin()->first > safe_pos) break; - finish_contexts(&g_ceph_context, waitfor_safe.begin()->second); + finish_contexts(g_ceph_context, waitfor_safe.begin()->second); waitfor_safe.erase(waitfor_safe.begin()); } } @@ -499,7 +499,7 @@ void Journaler::_do_flush(unsigned amount) // submit write for anything pending // flush _start_ pos to _finish_flush - utime_t now = ceph_clock_now(&g_ceph_context); + 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, ceph_clock_now(&g_ceph_context), + 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 < ceph_clock_now(&g_ceph_context).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, ceph_clock_now(&g_ceph_context), 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, ceph_clock_now(&g_ceph_context), 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; } @@ -1010,7 +1010,7 @@ void Journaler::_trim_finish(int r, uint64_t to) // finishers? while (!waitfor_trim.empty() && waitfor_trim.begin()->first <= trimmed_pos) { - finish_contexts(&g_ceph_context, waitfor_trim.begin()->second, 0); + finish_contexts(g_ceph_context, waitfor_trim.begin()->second, 0); waitfor_trim.erase(waitfor_trim.begin()); } } diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 139bc54e9ebcc..6d50f66be0033 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -520,7 +520,7 @@ void ObjectCacher::bh_read_finish(int poolid, sobject_t oid, loff_t start, uint6 p++) ls.splice(ls.end(), p->second); bh->waitfor_read.clear(); - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); // clean up? ob->try_merge_bh(bh); @@ -617,7 +617,7 @@ void ObjectCacher::lock_ack(int poolid, list& oids, tid_t tid) << " tid " << tid << " obsolete" << dendl; } - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); } } @@ -678,7 +678,7 @@ void ObjectCacher::bh_write_ack(int poolid, sobject_t oid, loff_t start, uint64_ list ls; ls.splice(ls.begin(), ob->waitfor_ack[tid]); ob->waitfor_ack.erase(tid); - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); } // is the entire object set now clean? @@ -713,7 +713,7 @@ void ObjectCacher::bh_write_commit(int poolid, sobject_t oid, loff_t start, uint list ls; ls.splice(ls.begin(), ob->waitfor_commit[tid]); ob->waitfor_commit.erase(tid); - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); } // is the entire object set now clean and fully committed? @@ -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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); for (vector::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 = ceph_clock_now(&g_ceph_context); + 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(&g_ceph_context, lock, utime_t(1,0)); + flusher_cond.WaitInterval(g_ceph_context, lock, utime_t(1,0)); } lock.Unlock(); dout(10) << "flusher finish" << dendl; @@ -1488,7 +1488,7 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish) if (!flush(ob)) { // we'll need to gather... if (!gather && onfinish) - gather = new C_Gather(&g_ceph_context, onfinish); + gather = new C_Gather(g_ceph_context, onfinish); safe = false; dout(10) << "flush_set " << oset << " will wait for ack tid " @@ -1535,7 +1535,7 @@ bool ObjectCacher::commit_set(ObjectSet *oset, Context *onfinish) dout(10) << "commit_set " << oset << " " << *ob << " will finish on commit tid " << ob->last_write_tid << dendl; - if (!gather && onfinish) gather = new C_Gather(&g_ceph_context, onfinish); + if (!gather && onfinish) gather = new C_Gather(g_ceph_context, onfinish); safe = false; if (gather) ob->waitfor_commit[ob->last_write_tid].push_back( gather->new_sub() ); @@ -1735,7 +1735,7 @@ void ObjectCacher::kick_sync_writers(ObjectSet *oset) ls.splice(ls.begin(), ob->waitfor_wr); } - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); } void ObjectCacher::kick_sync_readers(ObjectSet *oset) @@ -1756,7 +1756,7 @@ void ObjectCacher::kick_sync_readers(ObjectSet *oset) ls.splice(ls.begin(), ob->waitfor_rd); } - finish_contexts(&g_ceph_context, ls); + finish_contexts(g_ceph_context, ls); } diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 6cee31561c84e..ab562a54b082d 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -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(ceph_clock_now(&g_ceph_context)); + //bh->set_dirty_stamp(ceph_clock_now(g_ceph_context)); }; void bh_add(Object *ob, BufferHead *bh) { diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 1e17cd301681f..4f833102bb260 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -409,7 +409,7 @@ void Objecter::tick() set toping; // look for laggy requests - utime_t cutoff = ceph_clock_now(&g_ceph_context); + utime_t cutoff = ceph_clock_now(g_ceph_context); cutoff -= g_conf->objecter_timeout; // timeout for (hash_map::iterator p = ops.begin(); @@ -440,7 +440,7 @@ void Objecter::tick() void Objecter::resend_mon_ops() { - utime_t cutoff = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + op->last_submit = ceph_clock_now(g_ceph_context); } void Objecter::handle_fs_stats_reply(MStatfsReply *m) { diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index cfa17ea83ce70..1532681866fbc 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1061,7 +1061,7 @@ class Objecter { read_trunc(extents[0].oid, extents[0].oloc, extents[0].offset, extents[0].length, snap, bl, flags, trunc_size, trunc_seq, onfinish); } else { - C_Gather *g = new C_Gather(&g_ceph_context); + C_Gather *g = new C_Gather(g_ceph_context); vector resultbl(extents.size()); int i=0; for (vector::iterator p = extents.begin(); p != extents.end(); p++) { @@ -1085,9 +1085,9 @@ class Objecter { } else { C_Gather *gack = 0, *gcom = 0; if (onack) - gack = new C_Gather(&g_ceph_context, onack); + gack = new C_Gather(g_ceph_context, onack); if (oncommit) - gcom = new C_Gather(&g_ceph_context, oncommit); + gcom = new C_Gather(g_ceph_context, oncommit); for (vector::iterator p = extents.begin(); p != extents.end(); p++) { bufferlist cur; for (map<__u32,__u32>::iterator bit = p->buffer_extents.begin(); diff --git a/src/osdc/rados_bencher.h b/src/osdc/rados_bencher.h index 22a435b998567..9420fb4cbfc1b 100644 --- a/src/osdc/rados_bencher.h +++ b/src/osdc/rados_bencher.h @@ -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 = ceph_clock_now(&g_ceph_context); + data->start_time = ceph_clock_now(g_ceph_context); dataLock.Unlock(); for (int i = 0; iobject_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( ceph_clock_now(&g_ceph_context) < 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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context) - 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] = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context); + 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] = ceph_clock_now(&g_ceph_context); + 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 && (ceph_clock_now(&g_ceph_context) < 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 = ceph_clock_now(&g_ceph_context) - 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] = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context) - 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 = ceph_clock_now(&g_ceph_context) - 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)(ceph_clock_now(&g_ceph_context) - 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(&g_ceph_context, dataLock, ONE_SECOND); + cond.WaitInterval(g_ceph_context, dataLock, ONE_SECOND); } dataLock.Unlock(); return NULL; diff --git a/src/osdmaptool.cc b/src/osdmaptool.cc index 76a20c2024761..a8acb989c8edb 100644 --- a/src/osdmaptool.cc +++ b/src/osdmaptool.cc @@ -51,7 +51,7 @@ int main(int argc, const char **argv) global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); const char *me = argv[0]; @@ -148,7 +148,7 @@ int main(int argc, const char **argv) } ceph_fsid_t fsid; memset(&fsid, 0, sizeof(ceph_fsid_t)); - osdmap.build_simple(&g_ceph_context, 0, fsid, num_osd, num_dom, pg_bits, pgp_bits, lpg_bits); + osdmap.build_simple(g_ceph_context, 0, fsid, num_osd, num_dom, pg_bits, pgp_bits, lpg_bits); modified = true; } diff --git a/src/rados.cc b/src/rados.cc index d99a41f078798..ac71b561690f3 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -206,7 +206,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, // open rados Rados rados; - ret = rados.init_with_context(&g_ceph_context); + ret = rados.init_with_context(g_ceph_context); if (ret) { cerr << "couldn't initialize rados! error " << ret << std::endl; return ret; @@ -662,7 +662,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); std::map < std::string, std::string > opts; std::vector::iterator i; diff --git a/src/rados_sync.cc b/src/rados_sync.cc index f421db665460b..486a94bd6f56a 100644 --- a/src/rados_sync.cc +++ b/src/rados_sync.cc @@ -1113,7 +1113,7 @@ int rados_tool_sync(const std::map < std::string, std::string > &opts, // open rados Rados rados; - if (rados.init_with_context(&g_ceph_context) < 0) { + if (rados.init_with_context(g_ceph_context) < 0) { cerr << "rados" << ": failed to initialize Rados!" << std::endl; exit(1); } diff --git a/src/rbd.cc b/src/rbd.cc index 54bd0c4f5ce4a..94f8e7b189496 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -507,8 +507,8 @@ static int do_watch(librados::IoCtx& pp, const char *imgname) static int do_kernel_add(const char *poolname, const char *imgname, const char *secretfile, const char *user) { - MonMap monmap(ceph_clock_now(&g_ceph_context)); - int r = MonClient::build_initial_monmap(&g_ceph_context, monmap); + MonMap monmap(ceph_clock_now(g_ceph_context)); + int r = MonClient::build_initial_monmap(g_ceph_context, monmap); if (r < 0) return r; @@ -825,7 +825,7 @@ int main(int argc, const char **argv) int opt_cmd = OPT_NO_CMD; global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); const char *poolname = NULL; uint64_t size = 0; @@ -942,7 +942,7 @@ int main(int argc, const char **argv) } bool talk_to_cluster = (opt_cmd != OPT_MAP && opt_cmd != OPT_UNMAP); - if (talk_to_cluster && rados.init_with_context(&g_ceph_context) < 0) { + if (talk_to_cluster && rados.init_with_context(g_ceph_context) < 0) { cerr << "error: couldn't initialize rados!" << std::endl; exit(1); } diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 8c4833eae5db1..66d305dd479bd 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -48,10 +48,10 @@ int librgw_create(librgw_t *rgw, const char * const id) common_init_finish(cct); } else { - cct = &g_ceph_context; + cct = g_ceph_context; } librgw_init_mutex.Unlock(); - *rgw = &g_ceph_context; + *rgw = g_ceph_context; return 0; } diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index f366b7f06ebc0..6ab0479fb22fc 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -348,7 +348,7 @@ int main(int argc, char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); const char *user_id = 0; const char *access_key = 0; @@ -477,7 +477,7 @@ int main(int argc, char **argv) opt_cmd == OPT_SUBUSER_CREATE || opt_cmd == OPT_SUBUSER_RM || opt_cmd == OPT_KEY_CREATE || opt_cmd == OPT_KEY_RM); - store = RGWAccess::init_storage_provider("rados", &g_ceph_context); + store = RGWAccess::init_storage_provider("rados", g_ceph_context); if (!store) { cerr << "couldn't init storage provider" << std::endl; return 5; //EIO diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 25371631e8340..96aa4a15617e4 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -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 = ceph_clock_now(&g_ceph_context) - 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) { diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 4e1c95866030b..b29999fa2a9d2 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -75,9 +75,9 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); - if (!RGWAccess::init_storage_provider("rados", &g_ceph_context)) { + if (!RGWAccess::init_storage_provider("rados", g_ceph_context)) { derr << "Couldn't init storage provider (RADOS)" << dendl; return EIO; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index dd2a9b89e977f..5abaf979903ae 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -625,7 +625,7 @@ void RGWPutObj::execute() info.num = atoi(part_num.c_str()); info.etag = etag; info.size = s->obj_size; - info.modified = ceph_clock_now(&g_ceph_context); + 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; @@ -1310,7 +1310,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 = ceph_clock_now(&g_ceph_context); + s->time = ceph_clock_now(g_ceph_context); s->user.clear(); s->perm_mask = 0; } diff --git a/src/rgw/rgw_os_auth.cc b/src/rgw/rgw_os_auth.cc index c0c6b852d3758..302f05327a7ed 100644 --- a/src/rgw/rgw_os_auth.cc +++ b/src/rgw/rgw_os_auth.cc @@ -44,7 +44,7 @@ static int encode_token(string& os_user, string& key, bufferlist& bl) if (ret < 0) return ret; - utime_t expiration = ceph_clock_now(&g_ceph_context); + 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 < 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; + 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; } diff --git a/src/streamtest.cc b/src/streamtest.cc index 15bf13fc1bb77..4dc19ba43a99d 100644 --- a/src/streamtest.cc +++ b/src/streamtest.cc @@ -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, ceph_clock_now(&g_ceph_context)); + 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, ceph_clock_now(&g_ceph_context)); + set_commit(off, ceph_clock_now(g_ceph_context)); } }; @@ -97,7 +97,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); // args if (args.size() < 3) return -1; @@ -133,7 +133,7 @@ int main(int argc, const char **argv) ft.create_collection(coll_t()); fs->apply_transaction(ft); - utime_t now = ceph_clock_now(&g_ceph_context); + 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, ceph_clock_now(&g_ceph_context)); + 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)); diff --git a/src/test/TestDoutStreambuf.cc b/src/test/TestDoutStreambuf.cc index eb72e855a4eb2..1cce7d9f75655 100644 --- a/src/test/TestDoutStreambuf.cc +++ b/src/test/TestDoutStreambuf.cc @@ -38,7 +38,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); DoutStreambuf *dos = new DoutStreambuf(); diff --git a/src/test/TestSignalHandlers.cc b/src/test/TestSignalHandlers.cc index bf74a248f3001..3a8acefe6ac7e 100644 --- a/src/test/TestSignalHandlers.cc +++ b/src/test/TestSignalHandlers.cc @@ -95,7 +95,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); DEFINE_CONF_VARS(usage); FOR_EACH_ARG(args) { diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc index 6ef51a0040287..8ec059a55adb9 100644 --- a/src/test/TestTimers.cc +++ b/src/test/TestTimers.cc @@ -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 = ceph_clock_now(&g_ceph_context) + 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 = ceph_clock_now(&g_ceph_context) + 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 = ceph_clock_now(&g_ceph_context) + 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 = ceph_clock_now(&g_ceph_context) + 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 = ceph_clock_now(&g_ceph_context) + inc; + utime_t t = ceph_clock_now(g_ceph_context) + inc; safe_timer.add_event_at(t, test_contexts[i]); } safe_timer_lock.Unlock(); @@ -256,11 +256,11 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); int ret; Mutex safe_timer_lock("safe_timer_lock"); - SafeTimer safe_timer(&g_ceph_context, safe_timer_lock); + SafeTimer safe_timer(g_ceph_context, safe_timer_lock); ret = basic_timer_test (safe_timer, &safe_timer_lock); if (ret) diff --git a/src/test/gather.cc b/src/test/gather.cc index 5b64aecd54b3b..f6b4e62935439 100644 --- a/src/test/gather.cc +++ b/src/test/gather.cc @@ -25,7 +25,7 @@ class C_Checker : public Context { }; TEST(ContextGather, Constructor) { - C_Gather *gather = new C_Gather(&g_ceph_context ); + C_Gather *gather = new C_Gather(g_ceph_context ); EXPECT_TRUE(gather->empty()); EXPECT_EQ(0, gather->get_num()); EXPECT_EQ(0, gather->get_num_remaining()); @@ -33,7 +33,7 @@ TEST(ContextGather, Constructor) { } TEST(ContextGather, OneSub) { - C_Gather *gather = new C_Gather(&g_ceph_context); + C_Gather *gather = new C_Gather(g_ceph_context); Context *sub = gather->new_sub(); EXPECT_EQ(1, gather->get_num()); EXPECT_EQ(1, gather->get_num_remaining()); @@ -50,7 +50,7 @@ TEST(ContextGather, OneSub) { } TEST(ContextGather, ManySubs) { - C_Gather *gather = new C_Gather(&g_ceph_context); + C_Gather *gather = new C_Gather(g_ceph_context); int sub_count = 8; bool finish_called = false; int result = 0; @@ -81,7 +81,7 @@ TEST(ContextGather, ManySubs) { } TEST(ContextGather, AlternatingSubCreateFinish) { - C_Gather *gather = new C_Gather(&g_ceph_context); + C_Gather *gather = new C_Gather(g_ceph_context); int sub_count = 8; bool finish_called = false; int result = 0; diff --git a/src/test/old/test_disk_bw.cc b/src/test/old/test_disk_bw.cc index 8595455836b76..40d0df3fe8b3d 100644 --- a/src/test/old/test_disk_bw.cc +++ b/src/test/old/test_disk_bw.cc @@ -39,7 +39,7 @@ int main(int argc, char **argv) } - utime_t start = ceph_clock_now(&g_ceph_context); + 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 = ceph_clock_now(&g_ceph_context); + utime_t end = ceph_clock_now(g_ceph_context); end -= start; diff --git a/src/test/old/test_seek_read.c b/src/test/old/test_seek_read.c index 42548325de5fa..aedb32a2ae0b5 100644 --- a/src/test/old/test_seek_read.c +++ b/src/test/old/test_seek_read.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) int s = blocks*4096; - utime_t start = ceph_clock_now(&g_ceph_context); + utime_t start = ceph_clock_now(g_ceph_context); for (int i=0; i * * This program will go away as soon as we actually don't use g_ceph_context in * more programs. Obviously, at that point, those programs will provide an diff --git a/src/test/test_mutate.cc b/src/test/test_mutate.cc index b3faf7a86aa91..8ebb44176387d 100644 --- a/src/test/test_mutate.cc +++ b/src/test/test_mutate.cc @@ -44,7 +44,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); string val; string oid("test_object"); @@ -67,7 +67,7 @@ int main(int argc, const char **argv) } Rados rados; - if (rados.init_with_context(&g_ceph_context) < 0) { + if (rados.init_with_context(g_ceph_context) < 0) { cerr << "couldn't initialize rados!" << std::endl; return 1; } diff --git a/src/test_trans.cc b/src/test_trans.cc index 9167983846389..2a12c15b12d06 100644 --- a/src/test_trans.cc +++ b/src/test_trans.cc @@ -36,7 +36,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); // args if (args.size() < 2) return -1; diff --git a/src/testcrypto.cc b/src/testcrypto.cc index 49b3258705c23..f8abdad6e68cb 100644 --- a/src/testcrypto.cc +++ b/src/testcrypto.cc @@ -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, ceph_clock_now(&g_ceph_context), 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]; diff --git a/src/testkeys.cc b/src/testkeys.cc index 2ad90895c39e9..6d04305b089a0 100644 --- a/src/testkeys.cc +++ b/src/testkeys.cc @@ -12,9 +12,9 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); - KeyServer server(&g_ceph_context); + KeyServer server(g_ceph_context); dout(0) << "server created" << dendl; @@ -24,7 +24,7 @@ int main(int argc, const 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, ceph_clock_now(&g_ceph_context), 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]; diff --git a/src/testmsgr.cc b/src/testmsgr.cc index feb8d0b3171c9..6fb7198b763ea 100644 --- a/src/testmsgr.cc +++ b/src/testmsgr.cc @@ -47,7 +47,7 @@ uint64_t received = 0; class Admin : public Dispatcher { public: Admin() - : Dispatcher(&g_ceph_context) + : Dispatcher(g_ceph_context) { } private: @@ -77,14 +77,14 @@ int main(int argc, const char **argv, const char *envp[]) { env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); vec_to_argv(args, argc, argv); dout(0) << "i am mon " << args[0] << dendl; // get monmap - MonClient mc(&g_ceph_context); + MonClient mc(g_ceph_context); if (mc.build_initial_monmap() < 0) return -1; @@ -92,7 +92,7 @@ int main(int argc, const char **argv, const char *envp[]) { int whoami = mc.monmap.get_rank(args[0]); assert(whoami >= 0); g_conf->public_addr = mc.monmap.get_addr(whoami); - SimpleMessenger *rank = new SimpleMessenger(&g_ceph_context); + SimpleMessenger *rank = new SimpleMessenger(g_ceph_context); int err = rank->bind(getpid()); if (err < 0) return 1; diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index 92cb25eecf98a..33d0a14bd4f4c 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -117,7 +117,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); vec_to_argv(args, argc, argv); diff --git a/src/tools/common.cc b/src/tools/common.cc index 23da5449075c4..3392edb533d01 100644 --- a/src/tools/common.cc +++ b/src/tools/common.cc @@ -90,7 +90,7 @@ static void handle_observe(CephToolCtx *ctx, MMonObserve *observe) static void handle_notify(CephToolCtx *ctx, MMonObserveNotify *notify) { - utime_t now = ceph_clock_now(&g_ceph_context); + utime_t now = ceph_clock_now(g_ceph_context); dout(1) << notify->get_source() << " -> " << get_paxos_name(notify->machine_id) << " v" << notify->ver @@ -273,14 +273,14 @@ static void send_command(CephToolCtx *ctx) m->set_data(pending_bl); if (!ctx->concise) - *ctx->log << ceph_clock_now(&g_ceph_context) << " mon" << " <- " << pending_cmd << std::endl; + *ctx->log << ceph_clock_now(g_ceph_context) << " mon" << " <- " << pending_cmd << std::endl; ctx->mc.send_mon_message(m); } class Admin : public Dispatcher { public: Admin(CephToolCtx *ctx_) - : Dispatcher(&g_ceph_context), + : Dispatcher(g_ceph_context), ctx(ctx_) { } @@ -340,7 +340,7 @@ static int do_command(CephToolCtx *ctx, rs = rs; rbl = reply_bl; if (!ctx->concise) - *ctx->log << ceph_clock_now(&g_ceph_context) << " " + *ctx->log << ceph_clock_now(g_ceph_context) << " " << reply_from.name << " -> '" << reply_rs << "' (" << reply_rc << ")" << std::endl; @@ -530,7 +530,7 @@ CephToolCtx* ceph_tool_common_init(ceph_tool_mode_t mode, bool concise) ceph_tool_mode = mode; std::auto_ptr ctx; - ctx.reset(new CephToolCtx(&g_ceph_context, concise)); + ctx.reset(new CephToolCtx(g_ceph_context, concise)); // get monmap if (ctx->mc.build_initial_monmap() < 0) @@ -540,7 +540,7 @@ CephToolCtx* ceph_tool_common_init(ceph_tool_mode_t mode, bool concise) tok = tok_init(NULL); // start up network - messenger = new SimpleMessenger(&g_ceph_context); + messenger = new SimpleMessenger(g_ceph_context); messenger->register_entity(entity_name_t::CLIENT()); messenger->start_with_nonce(getpid()); ctx->dispatcher = new Admin(ctx.get()); diff --git a/src/tools/common.h b/src/tools/common.h index 17e61825e0fdb..e91d1ca6879f1 100644 --- a/src/tools/common.h +++ b/src/tools/common.h @@ -61,7 +61,7 @@ class CephToolCtx CephToolCtx(CephContext *cct_, bool concise_) : cct(cct_), mdsmap(cct_), - mc(&g_ceph_context), + mc(g_ceph_context), updates(EVERYTHING_UPDATE), log(&std::cout), slog(NULL), diff --git a/src/tools/gceph.cc b/src/tools/gceph.cc index 7a80fb3f33ccc..9fd0b9f5e5e84 100644 --- a/src/tools/gceph.cc +++ b/src/tools/gceph.cc @@ -79,7 +79,7 @@ int main(int argc, const char **argv) env_to_vec(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); - common_init_finish(&g_ceph_context); + common_init_finish(g_ceph_context); vec_to_argv(args, argc, argv); diff --git a/src/tools/gui.cc b/src/tools/gui.cc index ad8353fc542c8..f1c94dc325fba 100644 --- a/src/tools/gui.cc +++ b/src/tools/gui.cc @@ -133,7 +133,7 @@ class GuiMonitorThread : public Thread CephToolCtx *ctx = gui->ctx; ctx->lock.Lock(); while (true) { - utime_t t(ceph_clock_now(&g_ceph_context)); + utime_t t(ceph_clock_now(g_ceph_context)); t += 3.0; ctx->gui_cond.WaitUntil(ctx->lock, t); if (shutting_down) {