From 19fb1b290d45d6a9e43e01e29167e66ff120ee72 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Mon, 25 Dec 2017 04:24:19 -0500 Subject: [PATCH] mon: Use unqualified encode/decode This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson --- src/ceph_mon.cc | 4 +- src/mon/AuthMonitor.cc | 60 +++++++++++----------- src/mon/AuthMonitor.h | 29 ++++++----- src/mon/CreatingPGs.h | 38 ++++++++------ src/mon/HealthMonitor.cc | 8 +-- src/mon/LogMonitor.cc | 10 ++-- src/mon/MDSMonitor.cc | 6 +-- src/mon/MgrMap.h | 48 +++++++++--------- src/mon/MgrMonitor.cc | 10 ++-- src/mon/MgrStatMonitor.cc | 12 ++--- src/mon/MonCap.cc | 4 +- src/mon/MonClient.cc | 10 ++-- src/mon/MonClient.h | 4 +- src/mon/MonCommand.h | 42 +++++++-------- src/mon/MonMap.cc | 72 +++++++++++++------------- src/mon/Monitor.cc | 20 ++++---- src/mon/MonitorDBStore.h | 43 ++++++++-------- src/mon/OSDMonitor.cc | 39 +++++++------- src/mon/PGMap.cc | 104 +++++++++++++++++++------------------- src/mon/PGMap.h | 14 ++--- src/mon/Paxos.cc | 4 +- src/mon/PaxosService.cc | 2 +- src/mon/PaxosService.h | 2 +- src/mon/mon_types.h | 73 +++++++++++++------------- 24 files changed, 336 insertions(+), 322 deletions(-) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 9139e8b83ef10..ea022d0c42fee 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -571,8 +571,8 @@ int main(int argc, const char **argv) bufferlist mapbl; tmp.encode(mapbl, CEPH_FEATURES_ALL); bufferlist final; - ::encode(v, final); - ::encode(mapbl, final); + encode(v, final); + encode(mapbl, final); auto t(std::make_shared()); // save it diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index c5e3786eea7b9..e2d303a0ae16e 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -103,7 +103,7 @@ void AuthMonitor::create_initial() KeyRing keyring; bufferlist::iterator p = bl.begin(); - ::decode(keyring, p); + decode(keyring, p); import_keyring(keyring); } } @@ -141,9 +141,9 @@ void AuthMonitor::update_from_paxos(bool *need_bootstrap) dout(7) << __func__ << " latest length " << latest_bl.length() << dendl; bufferlist::iterator p = latest_bl.begin(); __u8 struct_v; - ::decode(struct_v, p); - ::decode(max_global_id, p); - ::decode(mon->key_server, p); + decode(struct_v, p); + decode(max_global_id, p); + decode(mon->key_server, p); mon->key_server.set_ver(latest_full); keys_ver = latest_full; } @@ -168,10 +168,10 @@ void AuthMonitor::update_from_paxos(bool *need_bootstrap) bufferlist::iterator p = bl.begin(); __u8 v; - ::decode(v, p); + decode(v, p); while (!p.end()) { Incremental inc; - ::decode(inc, p); + decode(inc, p); switch (inc.inc_type) { case GLOBAL_ID: max_global_id = inc.max_global_id; @@ -181,7 +181,7 @@ void AuthMonitor::update_from_paxos(bool *need_bootstrap) { KeyServerData::Incremental auth_inc; bufferlist::iterator iter = inc.auth_data.begin(); - ::decode(auth_inc, iter); + decode(auth_inc, iter); mon->key_server.apply_data_incremental(auth_inc); break; } @@ -237,7 +237,7 @@ void AuthMonitor::encode_pending(MonitorDBStore::TransactionRef t) bufferlist bl; __u8 v = 1; - ::encode(v, bl); + encode(v, bl); vector::iterator p; for (p = pending_auth.begin(); p != pending_auth.end(); ++p) p->encode(bl, mon->get_quorum_con_features()); @@ -263,9 +263,9 @@ void AuthMonitor::encode_full(MonitorDBStore::TransactionRef t) << (mon->key_server.has_secrets() ? "" : "no ") << "secrets!" << dendl; __u8 v = 1; - ::encode(v, full_bl); - ::encode(max_global_id, full_bl); - ::encode(mon->key_server, full_bl); + encode(v, full_bl); + encode(max_global_id, full_bl); + encode(mon->key_server, full_bl); put_version_full(t, version, full_bl); put_version_latest_full(t, version); @@ -382,10 +382,10 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) try { __u8 struct_v = 1; - ::decode(struct_v, indata); - ::decode(supported, indata); - ::decode(entity_name, indata); - ::decode(s->global_id, indata); + decode(struct_v, indata); + decode(supported, indata); + decode(entity_name, indata); + decode(s->global_id, indata); } catch (const buffer::error &e) { dout(10) << "failed to decode initial auth message" << dendl; ret = -EINVAL; @@ -497,7 +497,7 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) bufferlist::iterator p = caps_info.caps.begin(); string str; try { - ::decode(str, p); + decode(str, p); } catch (const buffer::error &err) { derr << "corrupt cap data for " << entity_name << " in auth db" << dendl; str.clear(); @@ -689,7 +689,7 @@ bool AuthMonitor::entity_is_pending(EntityName& entity) if (p.inc_type == AUTH_DATA) { KeyServerData::Incremental inc; bufferlist::iterator q = p.auth_data.begin(); - ::decode(inc, q); + decode(inc, q); if (inc.op == KeyServerData::AUTH_INC_ADD && inc.name == entity) { return true; @@ -843,7 +843,7 @@ int AuthMonitor::do_osd_destroy( bufferlist _encode_cap(const string& cap) { bufferlist bl; - ::encode(cap, bl); + encode(cap, bl); return bl; } @@ -1061,7 +1061,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) bufferlist::iterator iter = bl.begin(); KeyRing keyring; try { - ::decode(keyring, iter); + decode(keyring, iter); } catch (const buffer::error &ex) { ss << "error decoding keyring" << " " << ex.what(); err = -EINVAL; @@ -1096,7 +1096,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) if (has_keyring) { bufferlist::iterator iter = bl.begin(); try { - ::decode(new_keyring, iter); + decode(new_keyring, iter); } catch (const buffer::error &ex) { ss << "error decoding keyring"; err = -EINVAL; @@ -1117,7 +1117,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) it += 2) { string sys = *it; bufferlist cap; - ::encode(*(it+1), cap); + encode(*(it+1), cap); new_caps[sys] = cap; } @@ -1188,7 +1188,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) it += 2) { const std::string &sys = *it; bufferlist cap; - ::encode(*(it+1), cap); + encode(*(it+1), cap); wanted_caps[sys] = cap; } @@ -1232,7 +1232,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) if (p->inc_type == AUTH_DATA) { KeyServerData::Incremental auth_inc; bufferlist::iterator q = p->auth_data.begin(); - ::decode(auth_inc, q); + decode(auth_inc, q); if (auth_inc.op == KeyServerData::AUTH_INC_ADD && auth_inc.name == entity) { wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs, @@ -1382,7 +1382,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op) map newcaps; for (vector::iterator it = caps_vec.begin(); it != caps_vec.end(); it += 2) - ::encode(*(it+1), newcaps[*it]); + encode(*(it+1), newcaps[*it]); auth_inc.op = KeyServerData::AUTH_INC_ADD; auth_inc.auth.caps = newcaps; @@ -1451,7 +1451,7 @@ void AuthMonitor::upgrade_format() continue; try { bufferlist::iterator it = p->second.caps["mon"].begin(); - ::decode(mon_caps, it); + decode(mon_caps, it); } catch (buffer::error) { dout(10) << __func__ << " unable to parse mon cap for " @@ -1481,7 +1481,7 @@ void AuthMonitor::upgrade_format() << mon_caps << " to " << new_caps << dendl; bufferlist bl; - ::encode(new_caps, bl); + encode(new_caps, bl); KeyServerData::Incremental auth_inc; auth_inc.name = p->first; @@ -1520,7 +1520,7 @@ void AuthMonitor::upgrade_format() if (newcap.length() > 0) { dout(5) << " giving " << n << " mgr '" << newcap << "'" << dendl; bufferlist bl; - ::encode(newcap, bl); + encode(newcap, bl); KeyServerData::Incremental auth_inc; auth_inc.name = p->first; @@ -1535,12 +1535,12 @@ void AuthMonitor::upgrade_format() // the kraken ceph-mgr@.service set the mon cap to 'allow *'. auto blp = p->second.caps["mon"].begin(); string oldcaps; - ::decode(oldcaps, blp); + decode(oldcaps, blp); if (oldcaps == "allow *") { dout(5) << " fixing " << n << " mon cap to 'allow profile mgr'" << dendl; bufferlist bl; - ::encode("allow profile mgr", bl); + encode("allow profile mgr", bl); KeyServerData::Incremental auth_inc; auth_inc.name = p->first; auth_inc.auth = p->second; @@ -1560,7 +1560,7 @@ void AuthMonitor::upgrade_format() if (!mon->key_server.contains(bootstrap_mgr_name)) { KeyServerData::Incremental auth_inc; auth_inc.name = bootstrap_mgr_name; - ::encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]); + encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]); auth_inc.op = KeyServerData::AUTH_INC_ADD; // generate key auth_inc.auth.key.create(g_ceph_context, CEPH_CRYPTO_AES); diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index 777f2e80361d3..1304c80d2f45f 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -46,41 +46,42 @@ public: Incremental() : inc_type(GLOBAL_ID), max_global_id(0), auth_type(0) {} void encode(bufferlist& bl, uint64_t features=-1) const { + using ceph::encode; if ((features & CEPH_FEATURE_MONENC) == 0) { __u8 v = 1; - ::encode(v, bl); + encode(v, bl); __u32 _type = (__u32)inc_type; - ::encode(_type, bl); + encode(_type, bl); if (_type == GLOBAL_ID) { - ::encode(max_global_id, bl); + encode(max_global_id, bl); } else { - ::encode(auth_type, bl); - ::encode(auth_data, bl); + encode(auth_type, bl); + encode(auth_data, bl); } return; } ENCODE_START(2, 2, bl); __u32 _type = (__u32)inc_type; - ::encode(_type, bl); + encode(_type, bl); if (_type == GLOBAL_ID) { - ::encode(max_global_id, bl); + encode(max_global_id, bl); } else { - ::encode(auth_type, bl); - ::encode(auth_data, bl); + encode(auth_type, bl); + encode(auth_data, bl); } ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); __u32 _type; - ::decode(_type, bl); + decode(_type, bl); inc_type = (IncType)_type; assert(inc_type >= GLOBAL_ID && inc_type <= AUTH_DATA); if (_type == GLOBAL_ID) { - ::decode(max_global_id, bl); + decode(max_global_id, bl); } else { - ::decode(auth_type, bl); - ::decode(auth_data, bl); + decode(auth_type, bl); + decode(auth_data, bl); } DECODE_FINISH(bl); } @@ -122,7 +123,7 @@ private: void push_cephx_inc(KeyServerData::Incremental& auth_inc) { Incremental inc; inc.inc_type = AUTH_DATA; - ::encode(auth_inc, inc.auth_data); + encode(auth_inc, inc.auth_data); inc.auth_type = CEPH_AUTH_CEPHX; pending_auth.push_back(inc); } diff --git a/src/mon/CreatingPGs.h b/src/mon/CreatingPGs.h index 49935108c442f..fae7e6f2ce5ab 100644 --- a/src/mon/CreatingPGs.h +++ b/src/mon/CreatingPGs.h @@ -5,7 +5,11 @@ #include #include + #include "include/encoding.h" +#include "include/utime.h" + +#include "osd/osd_types.h" struct creating_pgs_t { epoch_t last_scan_epoch = 0; @@ -22,16 +26,18 @@ struct creating_pgs_t { return start >= end; } void encode(bufferlist& bl) const { - ::encode(created, bl); - ::encode(modified, bl); - ::encode(start, bl); - ::encode(end, bl); + using ceph::encode; + encode(created, bl); + encode(modified, bl); + encode(start, bl); + encode(end, bl); } void decode(bufferlist::iterator& p) { - ::decode(created, p); - ::decode(modified, p); - ::decode(start, p); - ::decode(end, p); + using ceph::decode; + decode(created, p); + decode(modified, p); + decode(start, p); + decode(end, p); } }; @@ -65,19 +71,19 @@ struct creating_pgs_t { } void encode(bufferlist& bl) const { ENCODE_START(2, 1, bl); - ::encode(last_scan_epoch, bl); - ::encode(pgs, bl); - ::encode(created_pools, bl); - ::encode(queue, bl); + encode(last_scan_epoch, bl); + encode(pgs, bl); + encode(created_pools, bl); + encode(queue, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(2, bl); - ::decode(last_scan_epoch, bl); - ::decode(pgs, bl); - ::decode(created_pools, bl); + decode(last_scan_epoch, bl); + decode(pgs, bl); + decode(created_pools, bl); if (struct_v >= 2) - ::decode(queue, bl); + decode(queue, bl); DECODE_FINISH(bl); } void dump(ceph::Formatter *f) const { diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 16e3a069043bd..4c406732aacc4 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -61,7 +61,7 @@ void HealthMonitor::update_from_paxos(bool *need_bootstrap) mon->store->get(service_name, "quorum", qbl); if (qbl.length()) { auto p = qbl.begin(); - ::decode(quorum_checks, p); + decode(quorum_checks, p); } else { quorum_checks.clear(); } @@ -70,7 +70,7 @@ void HealthMonitor::update_from_paxos(bool *need_bootstrap) mon->store->get(service_name, "leader", lbl); if (lbl.length()) { auto p = lbl.begin(); - ::decode(leader_checks, p); + decode(leader_checks, p); } else { leader_checks.clear(); } @@ -102,10 +102,10 @@ void HealthMonitor::encode_pending(MonitorDBStore::TransactionRef t) put_last_committed(t, version); bufferlist qbl; - ::encode(quorum_checks, qbl); + encode(quorum_checks, qbl); t->put(service_name, "quorum", qbl); bufferlist lbl; - ::encode(leader_checks, lbl); + encode(leader_checks, lbl); t->put(service_name, "leader", lbl); health_check_map_t pending_health; diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index ffd50ba5050d6..0c1065d45ab09 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -93,7 +93,7 @@ void LogMonitor::update_from_paxos(bool *need_bootstrap) assert(latest_bl.length() != 0); dout(7) << __func__ << " loading summary e" << latest_full << dendl; bufferlist::iterator p = latest_bl.begin(); - ::decode(summary, p); + decode(summary, p); dout(7) << __func__ << " loaded summary e" << summary.version << dendl; } @@ -106,7 +106,7 @@ void LogMonitor::update_from_paxos(bool *need_bootstrap) bufferlist::iterator p = bl.begin(); __u8 v; - ::decode(v, p); + decode(v, p); while (!p.end()) { LogEntry le; le.decode(p); @@ -217,7 +217,7 @@ void LogMonitor::encode_pending(MonitorDBStore::TransactionRef t) bufferlist bl; dout(10) << __func__ << " v" << version << dendl; __u8 v = 1; - ::encode(v, bl); + encode(v, bl); multimap::iterator p; for (p = pending_log.begin(); p != pending_log.end(); ++p) p->second.encode(bl, mon->get_quorum_con_features()); @@ -232,7 +232,7 @@ void LogMonitor::encode_full(MonitorDBStore::TransactionRef t) assert(get_last_committed() == summary.version); bufferlist summary_bl; - ::encode(summary, summary_bl, mon->get_quorum_con_features()); + encode(summary, summary_bl, mon->get_quorum_con_features()); put_version_full(t, summary.version, summary_bl); put_version_latest_full(t, summary.version); @@ -654,7 +654,7 @@ void LogMonitor::_create_sub_incremental(MLog *mlog, int level, version_t sv) assert(bl.length()); bufferlist::iterator p = bl.begin(); __u8 v; - ::decode(v,p); + decode(v,p); while (!p.end()) { LogEntry le; le.decode(p); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 53bac5d8ce87b..a59a72a920f18 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1637,7 +1637,7 @@ void MDSMonitor::update_metadata(mds_gid_t gid, MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); bufferlist bl; - ::encode(pending_metadata, bl); + encode(pending_metadata, bl); t->put(MDS_METADATA_PREFIX, "last_metadata", bl); paxos->trigger_propose(); } @@ -1657,7 +1657,7 @@ void MDSMonitor::remove_from_metadata(MonitorDBStore::TransactionRef t) if (!update) return; bufferlist bl; - ::encode(pending_metadata, bl); + encode(pending_metadata, bl); t->put(MDS_METADATA_PREFIX, "last_metadata", bl); } @@ -1671,7 +1671,7 @@ int MDSMonitor::load_metadata(map& m) } bufferlist::iterator it = bl.begin(); - ::decode(m, it); + decode(m, it); return 0; } diff --git a/src/mon/MgrMap.h b/src/mon/MgrMap.h index 1af3a0ee7667e..79d5b3b0c2214 100644 --- a/src/mon/MgrMap.h +++ b/src/mon/MgrMap.h @@ -39,19 +39,19 @@ public: void encode(bufferlist& bl) const { ENCODE_START(2, 1, bl); - ::encode(gid, bl); - ::encode(name, bl); - ::encode(available_modules, bl); + encode(gid, bl); + encode(name, bl); + encode(available_modules, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(2, p); - ::decode(gid, p); - ::decode(name, p); + decode(gid, p); + decode(name, p); if (struct_v >= 2) { - ::decode(available_modules, p); + decode(available_modules, p); } DECODE_FINISH(p); } @@ -125,33 +125,33 @@ public: void encode(bufferlist& bl, uint64_t features) const { ENCODE_START(3, 1, bl); - ::encode(epoch, bl); - ::encode(active_addr, bl, features); - ::encode(active_gid, bl); - ::encode(available, bl); - ::encode(active_name, bl); - ::encode(standbys, bl); - ::encode(modules, bl); - ::encode(available_modules, bl); - ::encode(services, bl); + encode(epoch, bl); + encode(active_addr, bl, features); + encode(active_gid, bl); + encode(available, bl); + encode(active_name, bl); + encode(standbys, bl); + encode(modules, bl); + encode(available_modules, bl); + encode(services, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(2, p); - ::decode(epoch, p); - ::decode(active_addr, p); - ::decode(active_gid, p); - ::decode(available, p); - ::decode(active_name, p); - ::decode(standbys, p); + decode(epoch, p); + decode(active_addr, p); + decode(active_gid, p); + decode(available, p); + decode(active_name, p); + decode(standbys, p); if (struct_v >= 2) { - ::decode(modules, p); - ::decode(available_modules, p); + decode(modules, p); + decode(available_modules, p); } if (struct_v >= 3) { - ::decode(services, p); + decode(services, p); } DECODE_FINISH(p); } diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index f47dbfb3f62ac..302221ca968ef 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -113,7 +113,7 @@ void MgrMonitor::update_from_paxos(bool *need_bootstrap) derr << "Failed to load mgr commands: " << cpp_strerror(r) << dendl; } else { auto p = loaded_commands.begin(); - ::decode(command_descs, p); + decode(command_descs, p); } } } @@ -189,7 +189,7 @@ void MgrMonitor::encode_pending(MonitorDBStore::TransactionRef t) p.set_flag(MonCommand::FLAG_MGR); } bufferlist bl; - ::encode(pending_command_descs, bl); + encode(pending_command_descs, bl); t->put(command_descs_prefix, "", bl); pending_command_descs.clear(); } @@ -366,7 +366,7 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op) pending_map.active_gid = m->get_gid(); pending_map.active_name = m->get_name(); pending_map.available_modules = m->get_available_modules(); - ::encode(m->get_metadata(), pending_metadata[m->get_name()]); + encode(m->get_metadata(), pending_metadata[m->get_name()]); pending_metadata_rm.erase(m->get_name()); mon->clog->info() << "Activating manager daemon " @@ -392,7 +392,7 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op) << " started"; pending_map.standbys[m->get_gid()] = {m->get_gid(), m->get_name(), m->get_available_modules()}; - ::encode(m->get_metadata(), pending_metadata[m->get_name()]); + encode(m->get_metadata(), pending_metadata[m->get_name()]); pending_metadata_rm.erase(m->get_name()); updated = true; } @@ -935,7 +935,7 @@ int MgrMonitor::load_metadata(const string& name, std::map& m, return r; try { bufferlist::iterator p = bl.begin(); - ::decode(m, p); + decode(m, p); } catch (buffer::error& e) { if (err) diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index 471f9748cd7db..8df859c899824 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -32,7 +32,7 @@ void MgrStatMonitor::create_initial() dout(10) << __func__ << dendl; version = 0; service_map.epoch = 1; - ::encode(service_map, pending_service_map_bl, CEPH_FEATURES_ALL); + encode(service_map, pending_service_map_bl, CEPH_FEATURES_ALL); } void MgrStatMonitor::update_from_paxos(bool *need_bootstrap) @@ -46,8 +46,8 @@ void MgrStatMonitor::update_from_paxos(bool *need_bootstrap) assert(bl.length()); try { auto p = bl.begin(); - ::decode(digest, p); - ::decode(service_map, p); + decode(digest, p); + decode(service_map, p); dout(10) << __func__ << " v" << version << " service_map e" << service_map.epoch << dendl; } @@ -106,7 +106,7 @@ void MgrStatMonitor::create_pending() pending_digest = digest; pending_health_checks = get_health_checks(); pending_service_map_bl.clear(); - ::encode(service_map, pending_service_map_bl, mon->get_quorum_con_features()); + encode(service_map, pending_service_map_bl, mon->get_quorum_con_features()); } void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t) @@ -114,7 +114,7 @@ void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t) ++version; dout(10) << " " << version << dendl; bufferlist bl; - ::encode(pending_digest, bl, mon->get_quorum_con_features()); + encode(pending_digest, bl, mon->get_quorum_con_features()); assert(pending_service_map_bl.length()); bl.append(pending_service_map_bl); put_version(t, version, bl); @@ -181,7 +181,7 @@ bool MgrStatMonitor::prepare_report(MonOpRequestRef op) auto m = static_cast(op->get_req()); bufferlist bl = m->get_data(); auto p = bl.begin(); - ::decode(pending_digest, p); + decode(pending_digest, p); pending_health_checks.swap(m->health_checks); if (m->service_map_bl.length()) { pending_service_map_bl.swap(m->service_map_bl); diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index f40b9d6669197..ef2872aea1d49 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -426,7 +426,7 @@ bool MonCap::is_capable(CephContext *cct, void MonCap::encode(bufferlist& bl) const { ENCODE_START(4, 4, bl); // legacy MonCaps was 3, 3 - ::encode(text, bl); + encode(text, bl); ENCODE_FINISH(bl); } @@ -434,7 +434,7 @@ void MonCap::decode(bufferlist::iterator& bl) { string s; DECODE_START(4, bl); - ::decode(s, bl); + decode(s, bl); DECODE_FINISH(bl); parse(s, NULL); } diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 35323e9c4de18..fd48ee6e125d9 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -328,7 +328,7 @@ void MonClient::handle_monmap(MMonMap *m) string cur_mon = monmap.get_name(peer); bufferlist::iterator p = m->monmapbl.begin(); - ::decode(monmap, p); + decode(monmap, p); ldout(cct, 10) << " got monmap " << monmap.epoch << ", mon." << cur_mon << " is now rank " << monmap.get_rank(cur_mon) @@ -1205,10 +1205,10 @@ void MonConnection::start(epoch_t epoch, m->protocol = 0; m->monmap_epoch = epoch; __u8 struct_v = 1; - ::encode(struct_v, m->auth_payload); - ::encode(auth_supported.get_supported_set(), m->auth_payload); - ::encode(entity_name, m->auth_payload); - ::encode(global_id, m->auth_payload); + encode(struct_v, m->auth_payload); + encode(auth_supported.get_supported_set(), m->auth_payload); + encode(entity_name, m->auth_payload); + encode(global_id, m->auth_payload); con->send_message(m); } diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 703da88fa2bbb..3dc95f71c7d49 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -33,7 +33,7 @@ class MMonCommandAck; struct MAuthReply; class MAuthRotating; class LogClient; -struct AuthAuthorizer; +class AuthAuthorizer; class AuthMethodList; class AuthClientHandler; class KeyRing; @@ -75,7 +75,7 @@ struct MonClientPinger : public Dispatcher { bufferlist &payload = m->get_payload(); if (result && payload.length() > 0) { bufferlist::iterator p = payload.begin(); - ::decode(*result, p); + decode(*result, p); } done = true; ping_recvd_cond.SignalAll(); diff --git a/src/mon/MonCommand.h b/src/mon/MonCommand.h index ce2429fbc949c..b15b0915374e6 100644 --- a/src/mon/MonCommand.h +++ b/src/mon/MonCommand.h @@ -38,14 +38,14 @@ struct MonCommand { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); encode_bare(bl); - ::encode(flags, bl); + encode(flags, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); decode_bare(bl); - ::decode(flags, bl); + decode(flags, bl); DECODE_FINISH(bl); } @@ -53,18 +53,20 @@ struct MonCommand { * Unversioned encoding for use within encode_array. */ void encode_bare(bufferlist &bl) const { - ::encode(cmdstring, bl); - ::encode(helpstring, bl); - ::encode(module, bl); - ::encode(req_perms, bl); - ::encode(availability, bl); + using ceph::encode; + encode(cmdstring, bl); + encode(helpstring, bl); + encode(module, bl); + encode(req_perms, bl); + encode(availability, bl); } void decode_bare(bufferlist::iterator &bl) { - ::decode(cmdstring, bl); - ::decode(helpstring, bl); - ::decode(module, bl); - ::decode(req_perms, bl); - ::decode(availability, bl); + using ceph::decode; + decode(cmdstring, bl); + decode(helpstring, bl); + decode(module, bl); + decode(req_perms, bl); + decode(availability, bl); } bool is_compat(const MonCommand* o) const { return cmdstring == o->cmdstring && @@ -91,12 +93,12 @@ struct MonCommand { static void encode_array(const MonCommand *cmds, int size, bufferlist &bl) { ENCODE_START(2, 1, bl); uint16_t s = size; - ::encode(s, bl); + encode(s, bl); for (int i = 0; i < size; ++i) { cmds[i].encode_bare(bl); } for (int i = 0; i < size; i++) { - ::encode(cmds[i].flags, bl); + encode(cmds[i].flags, bl); } ENCODE_FINISH(bl); } @@ -104,7 +106,7 @@ struct MonCommand { bufferlist::iterator &bl) { DECODE_START(2, bl); uint16_t s = 0; - ::decode(s, bl); + decode(s, bl); *size = s; *cmds = new MonCommand[*size]; for (int i = 0; i < *size; ++i) { @@ -112,7 +114,7 @@ struct MonCommand { } if (struct_v >= 2) { for (int i = 0; i < *size; i++) - ::decode((*cmds)[i].flags, bl); + decode((*cmds)[i].flags, bl); } else { for (int i = 0; i < *size; i++) (*cmds)[i].flags = 0; @@ -125,12 +127,12 @@ struct MonCommand { bufferlist &bl) { ENCODE_START(2, 1, bl); uint16_t s = cmds.size(); - ::encode(s, bl); + encode(s, bl); for (unsigned i = 0; i < s; ++i) { cmds[i].encode_bare(bl); } for (unsigned i = 0; i < s; i++) { - ::encode(cmds[i].flags, bl); + encode(cmds[i].flags, bl); } ENCODE_FINISH(bl); } @@ -138,14 +140,14 @@ struct MonCommand { bufferlist::iterator &bl) { DECODE_START(2, bl); uint16_t s = 0; - ::decode(s, bl); + decode(s, bl); cmds.resize(s); for (unsigned i = 0; i < s; ++i) { cmds[i].decode_bare(bl); } if (struct_v >= 2) { for (unsigned i = 0; i < s; i++) - ::decode(cmds[i].flags, bl); + decode(cmds[i].flags, bl); } else { for (unsigned i = 0; i < s; i++) cmds[i].flags = 0; diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 7a1b9420e77fd..74b39e927f691 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -21,19 +21,19 @@ using ceph::Formatter; void mon_info_t::encode(bufferlist& bl, uint64_t features) const { ENCODE_START(2, 1, bl); - ::encode(name, bl); - ::encode(public_addr, bl, features); - ::encode(priority, bl); + encode(name, bl); + encode(public_addr, bl, features); + encode(priority, bl); ENCODE_FINISH(bl); } void mon_info_t::decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(name, p); - ::decode(public_addr, p); + decode(name, p); + decode(public_addr, p); if (struct_v >= 2) { - ::decode(priority, p); + decode(priority, p); } DECODE_FINISH(p); } @@ -151,39 +151,41 @@ void MonMap::encode(bufferlist& blist, uint64_t con_features) const } if ((con_features & CEPH_FEATURE_MONNAMES) == 0) { + using ceph::encode; __u16 v = 1; - ::encode(v, blist); - ::encode_raw(fsid, blist); - ::encode(epoch, blist); + encode(v, blist); + encode_raw(fsid, blist); + encode(epoch, blist); vector mon_inst(mon_addr.size()); for (unsigned n = 0; n < mon_addr.size(); n++) mon_inst[n] = get_inst(n); - ::encode(mon_inst, blist, con_features); - ::encode(last_changed, blist); - ::encode(created, blist); + encode(mon_inst, blist, con_features); + encode(last_changed, blist); + encode(created, blist); return; } if ((con_features & CEPH_FEATURE_MONENC) == 0) { + using ceph::encode; __u16 v = 2; - ::encode(v, blist); - ::encode_raw(fsid, blist); - ::encode(epoch, blist); - ::encode(mon_addr, blist, con_features); - ::encode(last_changed, blist); - ::encode(created, blist); + encode(v, blist); + encode_raw(fsid, blist); + encode(epoch, blist); + encode(mon_addr, blist, con_features); + encode(last_changed, blist); + encode(created, blist); } ENCODE_START(5, 3, blist); - ::encode_raw(fsid, blist); - ::encode(epoch, blist); - ::encode(mon_addr, blist, con_features); - ::encode(last_changed, blist); - ::encode(created, blist); - ::encode(persistent_features, blist); - ::encode(optional_features, blist); + encode_raw(fsid, blist); + encode(epoch, blist); + encode(mon_addr, blist, con_features); + encode(last_changed, blist); + encode(created, blist); + encode(persistent_features, blist); + encode(optional_features, blist); // this superseeds 'mon_addr' - ::encode(mon_info, blist, con_features); + encode(mon_info, blist, con_features); ENCODE_FINISH(blist); } @@ -191,11 +193,11 @@ void MonMap::decode(bufferlist::iterator &p) { map mon_addr; DECODE_START_LEGACY_COMPAT_LEN_16(5, 3, 3, p); - ::decode_raw(fsid, p); - ::decode(epoch, p); + decode_raw(fsid, p); + decode(epoch, p); if (struct_v == 1) { vector mon_inst; - ::decode(mon_inst, p); + decode(mon_inst, p); for (unsigned i = 0; i < mon_inst.size(); i++) { char n[2]; n[0] = '0' + i; @@ -204,16 +206,16 @@ void MonMap::decode(bufferlist::iterator &p) mon_addr[name] = mon_inst[i].addr; } } else { - ::decode(mon_addr, p); + decode(mon_addr, p); } - ::decode(last_changed, p); - ::decode(created, p); + decode(last_changed, p); + decode(created, p); if (struct_v >= 4) { - ::decode(persistent_features, p); - ::decode(optional_features, p); + decode(persistent_features, p); + decode(optional_features, p); } if (struct_v >= 5) { - ::decode(mon_info, p); + decode(mon_info, p); } else { // we may be decoding to an existing monmap; if we do not // clear the mon_info map now, we will likely incur in problems diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 488e3a4a6e4e6..d6341cb0a0cf6 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -682,7 +682,7 @@ int Monitor::preinit() // Attempt to decode and extract keyring only if it is found. KeyRing keyring; bufferlist::iterator p = bl.begin(); - ::decode(keyring, p); + decode(keyring, p); extract_save_mon_key(keyring); } } @@ -809,7 +809,7 @@ void Monitor::refresh_from_paxos(bool *need_bootstrap) if (r >= 0) { try { bufferlist::iterator p = bl.begin(); - ::decode(fingerprint, p); + decode(fingerprint, p); } catch (buffer::error& e) { dout(10) << __func__ << " failed to decode cluster_fingerprint" << dendl; @@ -1433,7 +1433,7 @@ void Monitor::handle_sync_get_chunk(MonOpRequestRef op) sync_providers.erase(sp.cookie); } - ::encode(*tx, reply->chunk_bl); + encode(*tx, reply->chunk_bl); m->get_connection()->send_message(reply); } @@ -1951,7 +1951,7 @@ void Monitor::win_election(epoch_t epoch, set& active, uint64_t features, // do that anyway for other reasons, though. MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); bufferlist bl; - ::encode(m, bl); + encode(m, bl); t->put(MONITOR_STORE_PREFIX, "last_metadata", bl); } @@ -4270,7 +4270,7 @@ void Monitor::handle_ping(MonOpRequestRef op) f->close_section(); stringstream ss; f->flush(ss); - ::encode(ss.str(), payload); + encode(ss.str(), payload); reply->set_payload(payload); dout(10) << __func__ << " reply payload len " << reply->get_payload().length() << dendl; messenger->send_message(reply, inst); @@ -4903,7 +4903,7 @@ void Monitor::update_mon_metadata(int from, Metadata&& m) MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); bufferlist bl; - ::encode(pending_metadata, bl); + encode(pending_metadata, bl); t->put(MONITOR_STORE_PREFIX, "last_metadata", bl); paxos->trigger_propose(); } @@ -4915,7 +4915,7 @@ int Monitor::load_metadata() if (r) return r; bufferlist::iterator it = bl.begin(); - ::decode(mon_metadata, it); + decode(mon_metadata, it); pending_metadata = mon_metadata; return 0; @@ -5389,7 +5389,7 @@ void Monitor::prepare_new_fingerprint(MonitorDBStore::TransactionRef t) dout(10) << __func__ << " proposing cluster_fingerprint " << nf << dendl; bufferlist bl; - ::encode(nf, bl); + encode(nf, bl); t->put(MONITOR_NAME, "cluster_fingerprint", bl); } @@ -5645,11 +5645,11 @@ bool Monitor::ms_get_authorizer(int service_id, AuthAuthorizer **authorizer, return false; } bufferlist ticket_data; - ::encode(blob, ticket_data); + encode(blob, ticket_data); bufferlist::iterator iter = ticket_data.begin(); CephXTicketHandler handler(g_ceph_context, service_id); - ::decode(handler.ticket, iter); + decode(handler.ticket, iter); handler.session_key = info.session_key; diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 8569fc23940ec..f1e0efd7da879 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -65,22 +65,22 @@ class MonitorDBStore void encode(bufferlist& encode_bl) const { ENCODE_START(2, 1, encode_bl); - ::encode(type, encode_bl); - ::encode(prefix, encode_bl); - ::encode(key, encode_bl); - ::encode(bl, encode_bl); - ::encode(endkey, encode_bl); + encode(type, encode_bl); + encode(prefix, encode_bl); + encode(key, encode_bl); + encode(bl, encode_bl); + encode(endkey, encode_bl); ENCODE_FINISH(encode_bl); } void decode(bufferlist::iterator& decode_bl) { DECODE_START(2, decode_bl); - ::decode(type, decode_bl); - ::decode(prefix, decode_bl); - ::decode(key, decode_bl); - ::decode(bl, decode_bl); + decode(type, decode_bl); + decode(prefix, decode_bl); + decode(key, decode_bl); + decode(bl, decode_bl); if (struct_v >= 2) - ::decode(endkey, decode_bl); + decode(endkey, decode_bl); DECODE_FINISH(decode_bl); } @@ -125,8 +125,9 @@ class MonitorDBStore } void put(string prefix, string key, version_t ver) { + using ceph::encode; bufferlist bl; - ::encode(ver, bl); + encode(ver, bl); put(prefix, key, bl); } @@ -152,18 +153,18 @@ class MonitorDBStore void encode(bufferlist& bl) const { ENCODE_START(2, 1, bl); - ::encode(ops, bl); - ::encode(bytes, bl); - ::encode(keys, bl); + encode(ops, bl); + encode(bytes, bl); + encode(keys, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(2, bl); - ::decode(ops, bl); + decode(ops, bl); if (struct_v >= 2) { - ::decode(bytes, bl); - ::decode(keys, bl); + decode(bytes, bl); + decode(keys, bl); } DECODE_FINISH(bl); } @@ -395,9 +396,9 @@ class MonitorDBStore last_key.second = key; if (g_conf->mon_sync_debug) { - ::encode(prefix, crc_bl); - ::encode(key, crc_bl); - ::encode(value, crc_bl); + encode(prefix, crc_bl); + encode(key, crc_bl); + encode(value, crc_bl); } return true; @@ -538,7 +539,7 @@ class MonitorDBStore assert(bl.length()); version_t ver; bufferlist::iterator p = bl.begin(); - ::decode(ver, p); + decode(ver, p); return ver; } diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a0d6c6c3c50f0..aea742fdc6c7a 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -153,7 +153,8 @@ epoch_t LastEpochClean::get_lower_bound(const OSDMap& latest) const } -struct C_UpdateCreatingPGs : public Context { +class C_UpdateCreatingPGs : public Context { +public: OSDMonitor *osdmon; utime_t start; epoch_t epoch; @@ -1179,7 +1180,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) << " legacy removed_snaps" << dendl; string k = make_snap_epoch_key(p.first, pending_inc.epoch); bufferlist v; - ::encode(p.second.removed_snaps, v); + encode(p.second.removed_snaps, v); t->put(OSD_SNAP_PREFIX, k, v); for (auto q = p.second.removed_snaps.begin(); q != p.second.removed_snaps.end(); @@ -1253,7 +1254,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) dout(10) << __func__ << " encoding full map with " << features << dendl; bufferlist fullbl; - ::encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED); + encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED); pending_inc.full_crc = tmp.get_crc(); // include full map in the txn. note that old monitors will @@ -1265,7 +1266,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) // encode assert(get_last_committed() + 1 == pending_inc.epoch); bufferlist bl; - ::encode(pending_inc, bl, features | CEPH_FEATURE_RESERVED); + encode(pending_inc, bl, features | CEPH_FEATURE_RESERVED); dout(20) << " full_crc " << tmp.get_crc() << " inc_crc " << pending_inc.inc_crc << dendl; @@ -1289,7 +1290,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) // and pg creating, also! auto pending_creatings = update_pending_pgs(pending_inc); bufferlist creatings_bl; - ::encode(pending_creatings, creatings_bl); + encode(pending_creatings, creatings_bl); t->put(OSD_PG_CREATING_PREFIX, "creating", creatings_bl); // removed_snaps @@ -1299,7 +1300,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) // all snaps removed this epoch string k = make_snap_epoch_key(i.first, pending_inc.epoch); bufferlist v; - ::encode(i.second, v); + encode(i.second, v); t->put(OSD_SNAP_PREFIX, k, v); } for (auto q = i.second.begin(); @@ -1355,7 +1356,7 @@ int OSDMonitor::load_metadata(int osd, map& m, ostream *err) return r; try { bufferlist::iterator p = bl.begin(); - ::decode(m, p); + decode(m, p); } catch (buffer::error& e) { if (err) @@ -2382,7 +2383,7 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op) // metadata bufferlist osd_metadata; - ::encode(m->metadata, osd_metadata); + encode(m->metadata, osd_metadata); pending_metadata[from] = osd_metadata; pending_metadata_rm.erase(from); @@ -3101,7 +3102,7 @@ void OSDMonitor::get_removed_snaps_range( if (v.length()) { auto q = v.begin(); OSDMap::snap_interval_set_t snaps; - ::decode(snaps, q); + decode(snaps, q); t.union_of(snaps); } } @@ -4984,9 +4985,9 @@ string OSDMonitor::make_snap_key_value( { // encode the *last* epoch in the key so that we can use forward // iteration only to search for an epoch in an interval. - ::encode(snap, *v); - ::encode(snap + num, *v); - ::encode(epoch, *v); + encode(snap, *v); + encode(snap + num, *v); + encode(epoch, *v); return make_snap_key(pool, snap + num - 1); } @@ -5003,9 +5004,9 @@ string OSDMonitor::make_snap_purged_key_value( { // encode the *last* epoch in the key so that we can use forward // iteration only to search for an epoch in an interval. - ::encode(snap, *v); - ::encode(snap + num, *v); - ::encode(epoch, *v); + encode(snap, *v); + encode(snap + num, *v); + encode(epoch, *v); return make_snap_purged_key(pool, snap + num - 1); } @@ -5023,8 +5024,8 @@ int OSDMonitor::lookup_pruned_snap(int64_t pool, snapid_t snap, } bufferlist v = it->value(); auto p = v.begin(); - ::decode(*begin, p); - ::decode(*end, p); + decode(*begin, p); + decode(*end, p); if (snap < *begin || snap >= *end) { return -ENOENT; } @@ -5408,7 +5409,7 @@ bool OSDMonitor::validate_crush_against_features(const CrushWrapper *newcrush, stringstream& ss) { OSDMap::Incremental new_pending = pending_inc; - ::encode(*newcrush, new_pending.crush, mon->get_quorum_con_features()); + encode(*newcrush, new_pending.crush, mon->get_quorum_con_features()); OSDMap newmap; newmap.deepish_copy_from(osdmap); newmap.apply_incremental(new_pending); @@ -11136,7 +11137,7 @@ bool OSDMonitor::prepare_pool_op(MonOpRequestRef op) { uint64_t snapid; pp.add_unmanaged_snap(snapid); - ::encode(snapid, reply_data); + encode(snapid, reply_data); changed = true; } break; diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 335969315605e..13c2af0b5e6d1 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -32,33 +32,33 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const v = 1; } ENCODE_START(v, 1, bl); - ::encode(num_pg, bl); - ::encode(num_pg_active, bl); - ::encode(num_pg_unknown, bl); - ::encode(num_osd, bl); - ::encode(pg_pool_sum, bl, features); - ::encode(pg_sum, bl, features); - ::encode(osd_sum, bl); + encode(num_pg, bl); + encode(num_pg_active, bl); + encode(num_pg_unknown, bl); + encode(num_osd, bl); + encode(pg_pool_sum, bl, features); + encode(pg_sum, bl, features); + encode(osd_sum, bl); if (v >= 2) { - ::encode(num_pg_by_state, bl); + encode(num_pg_by_state, bl); } else { uint32_t n = num_pg_by_state.size(); - ::encode(n, bl); + encode(n, bl); for (auto p : num_pg_by_state) { - ::encode((uint32_t)p.first, bl); - ::encode(p.second, bl); - } - } - ::encode(num_pg_by_osd, bl); - ::encode(num_pg_by_pool, bl); - ::encode(osd_last_seq, bl); - ::encode(per_pool_sum_delta, bl, features); - ::encode(per_pool_sum_deltas_stamps, bl); - ::encode(pg_sum_delta, bl, features); - ::encode(stamp_delta, bl); - ::encode(avail_space_by_rule, bl); + encode((uint32_t)p.first, bl); + encode(p.second, bl); + } + } + encode(num_pg_by_osd, bl); + encode(num_pg_by_pool, bl); + encode(osd_last_seq, bl); + encode(per_pool_sum_delta, bl, features); + encode(per_pool_sum_deltas_stamps, bl); + encode(pg_sum_delta, bl, features); + encode(stamp_delta, bl); + encode(avail_space_by_rule, bl); if (struct_v >= 3) { - ::encode(purged_snaps, bl); + encode(purged_snaps, bl); } ENCODE_FINISH(bl); } @@ -66,32 +66,32 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const void PGMapDigest::decode(bufferlist::iterator& p) { DECODE_START(3, p); - ::decode(num_pg, p); - ::decode(num_pg_active, p); - ::decode(num_pg_unknown, p); - ::decode(num_osd, p); - ::decode(pg_pool_sum, p); - ::decode(pg_sum, p); - ::decode(osd_sum, p); + decode(num_pg, p); + decode(num_pg_active, p); + decode(num_pg_unknown, p); + decode(num_osd, p); + decode(pg_pool_sum, p); + decode(pg_sum, p); + decode(osd_sum, p); if (struct_v >= 2) { - ::decode(num_pg_by_state, p); + decode(num_pg_by_state, p); } else { map nps; - ::decode(nps, p); + decode(nps, p); for (auto i : nps) { num_pg_by_state[i.first] = i.second; } } - ::decode(num_pg_by_osd, p); - ::decode(num_pg_by_pool, p); - ::decode(osd_last_seq, p); - ::decode(per_pool_sum_delta, p); - ::decode(per_pool_sum_deltas_stamps, p); - ::decode(pg_sum_delta, p); - ::decode(stamp_delta, p); - ::decode(avail_space_by_rule, p); + decode(num_pg_by_osd, p); + decode(num_pg_by_pool, p); + decode(osd_last_seq, p); + decode(per_pool_sum_delta, p); + decode(per_pool_sum_deltas_stamps, p); + decode(pg_sum_delta, p); + decode(stamp_delta, p); + decode(avail_space_by_rule, p); if (struct_v >= 3) { - ::decode(purged_snaps, p); + decode(purged_snaps, p); } DECODE_FINISH(p); } @@ -1338,24 +1338,24 @@ void PGMap::encode_digest(const OSDMap& osdmap, void PGMap::encode(bufferlist &bl, uint64_t features) const { ENCODE_START(7, 7, bl); - ::encode(version, bl); - ::encode(pg_stat, bl); - ::encode(osd_stat, bl); - ::encode(last_osdmap_epoch, bl); - ::encode(last_pg_scan, bl); - ::encode(stamp, bl); + encode(version, bl); + encode(pg_stat, bl); + encode(osd_stat, bl); + encode(last_osdmap_epoch, bl); + encode(last_pg_scan, bl); + encode(stamp, bl); ENCODE_FINISH(bl); } void PGMap::decode(bufferlist::iterator &bl) { DECODE_START(7, bl); - ::decode(version, bl); - ::decode(pg_stat, bl); - ::decode(osd_stat, bl); - ::decode(last_osdmap_epoch, bl); - ::decode(last_pg_scan, bl); - ::decode(stamp, bl); + decode(version, bl); + decode(pg_stat, bl); + decode(osd_stat, bl); + decode(last_osdmap_epoch, bl); + decode(last_pg_scan, bl); + decode(stamp, bl); DECODE_FINISH(bl); calc_stats(); diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index ea43ba3dc41b0..42719df952c13 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -58,14 +58,16 @@ public: int32_t up = 0; int32_t primary = 0; void encode(bufferlist& bl) const { - ::encode(acting, bl); - ::encode(up, bl); - ::encode(primary, bl); + using ceph::encode; + encode(acting, bl); + encode(up, bl); + encode(primary, bl); } void decode(bufferlist::iterator& p) { - ::decode(acting, p); - ::decode(up, p); - ::decode(primary, p); + using ceph::decode; + decode(acting, p); + decode(up, p); + decode(primary, p); } }; mempool::pgmap::unordered_map num_pg_by_osd; diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 3a9968e0a533c..24b3d60964404 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -1128,7 +1128,7 @@ void Paxos::handle_lease(MonOpRequestRef op) ack->last_committed = last_committed; ack->first_committed = first_committed; ack->lease_timestamp = ceph_clock_now(); - ::encode(mon->session_map.feature_map, ack->feature_map); + encode(mon->session_map.feature_map, ack->feature_map); lease->get_connection()->send_message(ack); // (re)set timeout event. @@ -1155,7 +1155,7 @@ void Paxos::handle_lease_ack(MonOpRequestRef op) if (ack->feature_map.length()) { auto p = ack->feature_map.begin(); FeatureMap& t = mon->quorum_feature_map[from]; - ::decode(t, p); + decode(t, p); } if (acked_lease == mon->get_quorum()) { // yay! diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index de732c3223019..8f36197b0558f 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -437,6 +437,6 @@ void PaxosService::load_health() mon->store->get("health", service_name, bl); if (bl.length()) { auto p = bl.begin(); - ::decode(health_checks, p); + decode(health_checks, p); } } diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 8b025aa0fec15..94a9ebdb083b1 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -428,7 +428,7 @@ public: void encode_health(const health_check_map_t& next, MonitorDBStore::TransactionRef t) { bufferlist bl; - ::encode(next, bl); + encode(next, bl); t->put("health", service_name, bl); mon->log_health(next, health_checks, t); } diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index 68139a40bc9ef..bbb1f3e60c1ab 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -92,13 +92,13 @@ struct FeatureMap { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(m, bl); + encode(m, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(m, p); + decode(m, p); DECODE_FINISH(p); } @@ -154,21 +154,21 @@ struct LevelDBStoreStats { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(bytes_total, bl); - ::encode(bytes_sst, bl); - ::encode(bytes_log, bl); - ::encode(bytes_misc, bl); - ::encode(last_update, bl); + encode(bytes_total, bl); + encode(bytes_sst, bl); + encode(bytes_log, bl); + encode(bytes_misc, bl); + encode(last_update, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &p) { DECODE_START(1, p); - ::decode(bytes_total, p); - ::decode(bytes_sst, p); - ::decode(bytes_log, p); - ::decode(bytes_misc, p); - ::decode(last_update, p); + decode(bytes_total, p); + decode(bytes_sst, p); + decode(bytes_log, p); + decode(bytes_misc, p); + decode(last_update, p); DECODE_FINISH(p); } @@ -206,34 +206,34 @@ struct DataStats { void encode(bufferlist &bl) const { ENCODE_START(3, 1, bl); - ::encode(fs_stats.byte_total, bl); - ::encode(fs_stats.byte_used, bl); - ::encode(fs_stats.byte_avail, bl); - ::encode(fs_stats.avail_percent, bl); - ::encode(last_update, bl); - ::encode(store_stats, bl); + encode(fs_stats.byte_total, bl); + encode(fs_stats.byte_used, bl); + encode(fs_stats.byte_avail, bl); + encode(fs_stats.avail_percent, bl); + encode(last_update, bl); + encode(store_stats, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &p) { DECODE_START(1, p); // we moved from having fields in kb to fields in byte if (struct_v > 2) { - ::decode(fs_stats.byte_total, p); - ::decode(fs_stats.byte_used, p); - ::decode(fs_stats.byte_avail, p); + decode(fs_stats.byte_total, p); + decode(fs_stats.byte_used, p); + decode(fs_stats.byte_avail, p); } else { uint64_t t; - ::decode(t, p); + decode(t, p); fs_stats.byte_total = t*1024; - ::decode(t, p); + decode(t, p); fs_stats.byte_used = t*1024; - ::decode(t, p); + decode(t, p); fs_stats.byte_avail = t*1024; } - ::decode(fs_stats.avail_percent, p); - ::decode(last_update, p); + decode(fs_stats.avail_percent, p); + decode(last_update, p); if (struct_v > 1) - ::decode(store_stats, p); + decode(store_stats, p); DECODE_FINISH(p); } @@ -250,14 +250,14 @@ struct ScrubResult { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(prefix_crc, bl); - ::encode(prefix_keys, bl); + encode(prefix_crc, bl); + encode(prefix_keys, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(1, p); - ::decode(prefix_crc, p); - ::decode(prefix_keys, p); + decode(prefix_crc, p); + decode(prefix_keys, p); DECODE_FINISH(p); } void dump(Formatter *f) const { @@ -279,7 +279,7 @@ struct ScrubResult { }; WRITE_CLASS_ENCODER(ScrubResult) -static inline ostream& operator<<(ostream& out, const ScrubResult& r) { +inline ostream& operator<<(ostream& out, const ScrubResult& r) { return out << "ScrubResult(keys " << r.prefix_keys << " crc " << r.prefix_crc << ")"; } @@ -472,12 +472,12 @@ public: void encode(bufferlist& bl) const { ENCODE_START(HEAD_VERSION, COMPAT_VERSION, bl); - ::encode(features, bl); + encode(features, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& p) { DECODE_START(COMPAT_VERSION, p); - ::decode(features, p); + decode(features, p); DECODE_FINISH(p); } }; @@ -545,8 +545,7 @@ static inline const char *ceph::features::mon::get_feature_name(uint64_t b) { return "unknown"; } -static inline -mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) { +inline mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) { if (n == "kraken") { return FEATURE_KRAKEN; @@ -560,7 +559,7 @@ mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) { return FEATURE_NONE; } -static inline ostream& operator<<(ostream& out, const mon_feature_t& f) { +inline ostream& operator<<(ostream& out, const mon_feature_t& f) { out << "mon_feature_t("; f.print(out); out << ")"; -- 2.39.5