From 9b29dc55a3adbd71d488901aed4d5f7f3bc7d558 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 11 Aug 2021 11:46:14 +0800 Subject: [PATCH] mds: build without "using namespace std" * add "std::" prefix in headers * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai --- src/ceph_mds.cc | 4 + src/mds/Anchor.cc | 2 +- src/mds/Anchor.h | 2 +- src/mds/Beacon.cc | 5 +- src/mds/CDentry.cc | 1 + src/mds/CDir.cc | 2 + src/mds/CDir.h | 10 +- src/mds/CInode.cc | 2 + src/mds/FSMap.cc | 1 + src/mds/FSMap.h | 12 +-- src/mds/Locker.cc | 3 + src/mds/LogEvent.h | 4 +- src/mds/LogSegment.h | 14 +-- src/mds/MDBalancer.cc | 7 +- src/mds/MDBalancer.h | 10 +- src/mds/MDCache.cc | 3 + src/mds/MDCache.h | 188 ++++++++++++++++----------------- src/mds/MDLog.cc | 2 + src/mds/MDLog.h | 8 +- src/mds/MDSDaemon.cc | 4 + src/mds/MDSDaemon.h | 4 +- src/mds/MDSMap.cc | 3 +- src/mds/MDSRank.cc | 6 ++ src/mds/MDSRank.h | 18 ++-- src/mds/MDSTable.cc | 1 + src/mds/MDSTable.h | 2 +- src/mds/MDSTableClient.cc | 8 +- src/mds/MDSTableClient.h | 14 +-- src/mds/MDSTableServer.cc | 2 + src/mds/MDSTableServer.h | 12 +-- src/mds/Migrator.cc | 1 + src/mds/Migrator.h | 16 +-- src/mds/Mutation.cc | 2 + src/mds/OpenFileTable.cc | 5 +- src/mds/OpenFileTable.h | 12 ++- src/mds/PurgeQueue.cc | 3 + src/mds/RecoveryQueue.cc | 2 + src/mds/ScrubStack.cc | 5 +- src/mds/Server.cc | 2 + src/mds/Server.h | 42 ++++---- src/mds/SessionMap.cc | 2 + src/mds/SnapClient.cc | 2 + src/mds/SnapClient.h | 16 +-- src/mds/SnapRealm.cc | 7 +- src/mds/SnapServer.cc | 3 +- src/mds/SnapServer.h | 21 ++-- src/mds/StrayManager.cc | 3 + src/mds/cephfs_features.cc | 4 +- src/mds/events/ECommitted.h | 2 +- src/mds/events/EExport.h | 6 +- src/mds/events/EFragment.h | 2 +- src/mds/events/EImportFinish.h | 2 +- src/mds/events/EImportStart.h | 6 +- src/mds/events/EMetaBlob.h | 64 +++++------ src/mds/events/EOpen.h | 6 +- src/mds/events/EPeerUpdate.h | 10 +- src/mds/events/EPurged.h | 2 +- src/mds/events/EResetJournal.h | 2 +- src/mds/events/ESession.h | 2 +- src/mds/events/ESessions.h | 10 +- src/mds/events/ESubtreeMap.h | 6 +- src/mds/events/ETableClient.h | 2 +- src/mds/events/ETableServer.h | 2 +- src/mds/events/EUpdate.h | 4 +- src/mds/journal.cc | 7 ++ src/mds/snap.cc | 1 + 66 files changed, 353 insertions(+), 285 deletions(-) diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc index b5674befc86..0d6c5ed7064 100644 --- a/src/ceph_mds.cc +++ b/src/ceph_mds.cc @@ -54,6 +54,10 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_mds +using std::cerr; +using std::cout; +using std::vector; + static void usage() { cout << "usage: ceph-mds -i [flags]\n" diff --git a/src/mds/Anchor.cc b/src/mds/Anchor.cc index 609b91188ac..81d55e6b115 100644 --- a/src/mds/Anchor.cc +++ b/src/mds/Anchor.cc @@ -57,7 +57,7 @@ void Anchor::generate_test_instances(std::list& ls) ls.back()->d_type = DT_DIR; } -ostream& operator<<(ostream& out, const Anchor &a) +std::ostream& operator<<(std::ostream& out, const Anchor &a) { return out << "a(" << a.ino << " " << a.dirino << "/'" << a.d_name << "' " << a.d_type << ")"; } diff --git a/src/mds/Anchor.h b/src/mds/Anchor.h index 9e55ec807bf..f2e9469d30d 100644 --- a/src/mds/Anchor.h +++ b/src/mds/Anchor.h @@ -69,5 +69,5 @@ public: mutable int nref = 0; // how many children }; -ostream& operator<<(ostream& out, const Anchor &a); +std::ostream& operator<<(std::ostream& out, const Anchor &a); #endif diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index 6548970ec87..766e4c5d267 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -34,6 +34,9 @@ #undef dout_prefix #define dout_prefix *_dout << "mds.beacon." << name << ' ' +using std::map; +using std::string; + using namespace std::chrono_literals; Beacon::Beacon(CephContext *cct, MonClient *monc, std::string_view name) @@ -360,7 +363,7 @@ void Beacon::notify_health(MDSRank const *mds) // // Detect clients failing to advance their old_client_tid { - set sessions; + std::set sessions; mds->sessionmap.get_client_session_set(sessions); const auto min_caps_working_set = g_conf().get_val("mds_min_caps_working_set"); diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 70d33a00165..85d8bc5fb58 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -30,6 +30,7 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << dir->mdcache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") " +using namespace std; ostream& CDentry::print_db_line_prefix(ostream& out) { diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 8e78c1caa1f..8bbe34192e7 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -45,6 +45,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mdcache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") " +using namespace std; + int CDir::num_frozen_trees = 0; int CDir::num_freezing_trees = 0; diff --git a/src/mds/CDir.h b/src/mds/CDir.h index a6793e6a837..c8d3e417ad4 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -58,7 +58,7 @@ public: } struct dentry_commit_item { - string key; + std::string key; snapid_t first; bool is_remote = false; @@ -646,7 +646,7 @@ protected: void _omap_fetch(MDSContext *fin, const std::set& keys); void _omap_fetch_more(version_t omap_version, bufferlist& hdrbl, - map& omap, MDSContext *fin); + std::map& omap, MDSContext *fin); CDentry *_load_dentry( std::string_view key, std::string_view dname, @@ -673,14 +673,14 @@ protected: // -- commit -- void _commit(version_t want, int op_prio); void _omap_commit_ops(int r, int op_prio, int64_t metapool, version_t version, bool _new, - vector &to_set, bufferlist &dfts, - vector &to_remove, + std::vector &to_set, bufferlist &dfts, + std::vector &to_remove, mempool::mds_co::compact_set &_stale); void _encode_primary_inode_base(dentry_commit_item &item, bufferlist &dfts, bufferlist &bl); void _omap_commit(int op_prio); void _parse_dentry(CDentry *dn, dentry_commit_item &item, - const set *snaps, bufferlist &bl); + const std::set *snaps, bufferlist &bl); void _committed(int r, version_t v); static fnode_const_ptr empty_fnode; diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 4e47fdf7869..b7b78e64824 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -51,6 +51,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mdcache->mds->get_nodeid() << ".cache.ino(" << ino() << ") " +using namespace std; + void CInodeCommitOperation::update(ObjectOperation &op, inode_backtrace_t &bt) { using ceph::encode; diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index 7fa5ca9904b..d3e5ab836b5 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -30,6 +30,7 @@ using std::list; using std::pair; using std::ostream; using std::string; +using std::string_view; using ceph::bufferlist; using ceph::Formatter; diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h index 7deee53bef7..4f732128cc9 100644 --- a/src/mds/FSMap.h +++ b/src/mds/FSMap.h @@ -252,21 +252,21 @@ public: const CompatSet &get_default_compat() const {return default_compat;} - void filter(const std::vector& allowed) + void filter(const std::vector& allowed) { if (allowed.empty()) { return; } for (auto &f : filesystems) { - string_view fs_name = f.second->mds_map.get_fs_name(); + std::string_view fs_name = f.second->mds_map.get_fs_name(); if (std::find(allowed.begin(), allowed.end(), fs_name) == allowed.end()) { filesystems.erase(f.first); } } for (auto r : mds_roles) { - string_view fs_name = fs_name_from_gid(r.first); + std::string_view fs_name = fs_name_from_gid(r.first); if (std::find(allowed.begin(), allowed.end(), fs_name) == allowed.end()) { mds_roles.erase(r.first); } @@ -324,10 +324,10 @@ public: * Does a daemon exist with this GID? */ bool gid_exists(mds_gid_t gid, - const std::vector& in = {}) const + const std::vector& in = {}) const { try { - string_view m = fs_name_from_gid(gid); + std::string_view m = fs_name_from_gid(gid); return in.empty() || std::find(in.begin(), in.end(), m) != in.end(); } catch (const std::out_of_range&) { return false; @@ -537,7 +537,7 @@ public: std::string_view role_str, mds_role_t *role, std::ostream &ss, - const std::vector &filter) const; + const std::vector &filter) const; int parse_role( std::string_view role_str, diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index e6b6e41c2a7..78895a40eff 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -35,6 +35,9 @@ #undef dout_prefix #define dout_context g_ceph_context #define dout_prefix _prefix(_dout, mds) + +using namespace std; + static ostream& _prefix(std::ostream *_dout, MDSRank *mds) { return *_dout << "mds." << mds->get_nodeid() << ".locker "; } diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index 4e368c97b5e..317b6579fc1 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -89,7 +89,7 @@ public: ENCODE_FINISH(bl); } - virtual void print(ostream& out) const { + virtual void print(std::ostream& out) const { out << "event(" << _type << ")"; } @@ -125,7 +125,7 @@ private: LogSegment *_segment = nullptr; }; -inline ostream& operator<<(ostream& out, const LogEvent &le) { +inline std::ostream& operator<<(std::ostream& out, const LogEvent &le) { le.print(out); return out; } diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h index a7f3f39710d..405760c47a8 100644 --- a/src/mds/LogSegment.h +++ b/src/mds/LogSegment.h @@ -83,17 +83,17 @@ class LogSegment { elist dirty_dirfrag_nest; elist dirty_dirfrag_dirfragtree; - set truncating_inodes; + std::set truncating_inodes; interval_set purging_inodes; MDSContext* purged_cb = nullptr; - map > pending_commit_tids; // mdstable - set uncommitted_leaders; - set uncommitted_peers; - set uncommitted_fragments; + std::map > pending_commit_tids; // mdstable + std::set uncommitted_leaders; + std::set uncommitted_peers; + std::set uncommitted_fragments; // client request ids - map last_client_tids; + std::map last_client_tids; // potentially dirty sessions std::set touched_sessions; @@ -101,7 +101,7 @@ class LogSegment { // table version version_t inotablev = 0; version_t sessionmapv = 0; - map tablev; + std::map tablev; MDSContext::vec expiry_waiters; }; diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 5ea313560da..cb63f605444 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -31,9 +31,8 @@ #include #include #include -using std::map; -using std::vector; -using std::chrono::duration_cast; + +using namespace std; #include "common/config.h" #include "common/errno.h" @@ -240,7 +239,7 @@ void MDBalancer::tick() if (mds->get_nodeid() == 0 && mds->is_active() && bal_interval > 0 - && duration_cast(now - last_heartbeat).count() >= bal_interval + && chrono::duration_cast(now - last_heartbeat).count() >= bal_interval && (num_bal_times || (bal_max_until >= 0 && mds->get_uptime().count() > bal_max_until))) { last_heartbeat = now; send_heartbeat(); diff --git a/src/mds/MDBalancer.h b/src/mds/MDBalancer.h index d9172e565e1..e3ee3deabcf 100644 --- a/src/mds/MDBalancer.h +++ b/src/mds/MDBalancer.h @@ -96,7 +96,7 @@ private: double amount, std::vector* exports, double& have, - set& already_exporting); + std::set& already_exporting); double try_match(balance_state_t &state, mds_rank_t ex, double& maxex, @@ -127,8 +127,8 @@ private: MonClient *mon_client; int beat_epoch = 0; - string bal_code; - string bal_version; + std::string bal_code; + std::string bal_version; time last_heartbeat = clock::zero(); time last_sample = clock::zero(); @@ -144,12 +144,12 @@ private: // just as soon as a delayed context comes back and triggers it. // These sets just prevent us from spawning extra timer contexts for // dirfrags that already have one in flight. - set split_pending, merge_pending; + std::set split_pending, merge_pending; // per-epoch scatter/gathered info std::map mds_load; std::map mds_meta_load; - std::map > mds_import_map; + std::map > mds_import_map; std::map mds_last_epoch_under_map; // per-epoch state diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e824beade1f..9f9b3047faf 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -76,6 +76,9 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, mds) + +using namespace std; + static ostream& _prefix(std::ostream *_dout, MDSRank *mds) { return *_dout << "mds." << mds->get_nodeid() << ".cache "; } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index c04f38e1c12..0d4659155a0 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -176,7 +176,7 @@ class MDCache { bool path_locked = false; mds_rank_t hint = MDS_RANK_NONE; mds_rank_t checking = MDS_RANK_NONE; - set checked; + std::set checked; }; friend class C_MDC_RejoinOpenInoFinish; @@ -303,17 +303,17 @@ class MDCache { void adjust_subtree_auth(CDir *root, mds_rank_t a, mds_rank_t b=CDIR_AUTH_UNKNOWN) { adjust_subtree_auth(root, mds_authority_t(a,b)); } - void adjust_bounded_subtree_auth(CDir *dir, const set& bounds, mds_authority_t auth); - void adjust_bounded_subtree_auth(CDir *dir, const set& bounds, mds_rank_t a) { + void adjust_bounded_subtree_auth(CDir *dir, const std::set& bounds, mds_authority_t auth); + void adjust_bounded_subtree_auth(CDir *dir, const std::set& bounds, mds_rank_t a) { adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN)); } - void adjust_bounded_subtree_auth(CDir *dir, const vector& bounds, const mds_authority_t &auth); - void adjust_bounded_subtree_auth(CDir *dir, const vector& bounds, mds_rank_t a) { + void adjust_bounded_subtree_auth(CDir *dir, const std::vector& bounds, const mds_authority_t &auth); + void adjust_bounded_subtree_auth(CDir *dir, const std::vector& bounds, mds_rank_t a) { adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN)); } - void map_dirfrag_set(const list& dfs, set& result); + void map_dirfrag_set(const std::list& dfs, std::set& result); void try_subtree_merge(CDir *root); - void try_subtree_merge_at(CDir *root, set *to_eval, bool adjust_pop=true); + void try_subtree_merge_at(CDir *root, std::set *to_eval, bool adjust_pop=true); void eval_subtree_root(CInode *diri); CDir *get_subtree_root(CDir *dir); CDir *get_projected_subtree_root(CDir *dir); @@ -325,10 +325,10 @@ class MDCache { bool is_subtree(CDir *root) { return subtrees.count(root); } - void get_subtree_bounds(CDir *root, set& bounds); - void get_wouldbe_subtree_bounds(CDir *root, set& bounds); - void verify_subtree_bounds(CDir *root, const set& bounds); - void verify_subtree_bounds(CDir *root, const list& bounds); + void get_subtree_bounds(CDir *root, std::set& bounds); + void get_wouldbe_subtree_bounds(CDir *root, std::set& bounds); + void verify_subtree_bounds(CDir *root, const std::set& bounds); + void verify_subtree_bounds(CDir *root, const std::list& bounds); void project_subtree_rename(CInode *diri, CDir *olddir, CDir *newdir); void adjust_subtree_after_rename(CInode *diri, CDir *olddir, bool pop); @@ -389,7 +389,7 @@ class MDCache { return active_requests.count(rid); } MDRequestRef request_get(metareqid_t rid); - void request_pin_ref(MDRequestRef& r, CInode *ref, vector& trace); + void request_pin_ref(MDRequestRef& r, CInode *ref, std::vector& trace); void request_finish(MDRequestRef& mdr); void request_forward(MDRequestRef& mdr, mds_rank_t mds, int port=0); void dispatch_request(MDRequestRef& mdr); @@ -422,7 +422,7 @@ class MDCache { snapid_t follows=CEPH_NOSNAP); // peers - void add_uncommitted_leader(metareqid_t reqid, LogSegment *ls, set &peers, bool safe=false) { + void add_uncommitted_leader(metareqid_t reqid, LogSegment *ls, std::set &peers, bool safe=false) { uncommitted_leaders[reqid].ls = ls; uncommitted_leaders[reqid].peers = peers; uncommitted_leaders[reqid].safe = safe; @@ -448,7 +448,7 @@ class MDCache { MDPeerUpdate* get_uncommitted_peer(metareqid_t reqid, mds_rank_t leader); void _logged_peer_commit(mds_rank_t from, metareqid_t reqid); - void set_recovery_set(set& s); + void set_recovery_set(std::set& s); void handle_mds_failure(mds_rank_t who); void handle_mds_recovery(mds_rank_t who); @@ -477,12 +477,12 @@ class MDCache { void finish_rollback(metareqid_t reqid, MDRequestRef& mdr); // ambiguous imports - void add_ambiguous_import(dirfrag_t base, const vector& bounds); - void add_ambiguous_import(CDir *base, const set& bounds); + void add_ambiguous_import(dirfrag_t base, const std::vector& bounds); + void add_ambiguous_import(CDir *base, const std::set& bounds); bool have_ambiguous_import(dirfrag_t base) { return my_ambiguous_imports.count(base); } - void get_ambiguous_import_bounds(dirfrag_t base, vector& bounds) { + void get_ambiguous_import_bounds(dirfrag_t base, std::vector& bounds) { ceph_assert(my_ambiguous_imports.count(base)); bounds = my_ambiguous_imports[base]; } @@ -496,7 +496,7 @@ class MDCache { } void _move_subtree_map_bound(dirfrag_t df, dirfrag_t oldparent, dirfrag_t newparent, - map >& subtrees); + std::map >& subtrees); ESubtreeMap *create_subtree_map(); void clean_open_file_lists(); @@ -563,16 +563,16 @@ class MDCache { void rejoin_open_ino_finish(inodeno_t ino, int ret); void rejoin_prefetch_ino_finish(inodeno_t ino, int ret); - void rejoin_open_sessions_finish(map >& session_map); + void rejoin_open_sessions_finish(std::map >& session_map); bool process_imported_caps(); void choose_lock_states_and_reconnect_caps(); void prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t ino, - map>& splits); - void prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm, map>& splits); - void send_snaps(map>& splits); + std::map>& splits); + void prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm, std::map>& splits); + void send_snaps(std::map>& splits); Capability* rejoin_import_cap(CInode *in, client_t client, const cap_reconnect_t& icr, mds_rank_t frommds); void finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snapid_t seq, - map>& updates); + std::map>& updates); Capability* try_reconnect_cap(CInode *in, Session *session); void export_remaining_imported_caps(); @@ -742,8 +742,8 @@ class MDCache { CDir *get_auth_container(CDir *in); CDir *get_export_container(CDir *dir); - void find_nested_exports(CDir *dir, set& s); - void find_nested_exports_under(CDir *import, CDir *dir, set& s); + void find_nested_exports(CDir *dir, std::set& s); + void find_nested_exports_under(CDir *import, CDir *dir, std::set& s); void init_layouts(); void create_unlinked_system_inode(CInode *in, inodeno_t ino, @@ -813,16 +813,16 @@ class MDCache { */ int path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, const filepath& path, int flags, - vector *pdnvec, CInode **pin=nullptr); + std::vector *pdnvec, CInode **pin=nullptr); CInode *cache_traverse(const filepath& path); void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin); CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false); - bool parallel_fetch(map& pathmap, set& missing); + bool parallel_fetch(std::map& pathmap, std::set& missing); bool parallel_fetch_traverse_dir(inodeno_t ino, filepath& path, - set& fetch_queue, set& missing, + std::set& fetch_queue, std::set& missing, C_GatherBuilder &gather_bld); void open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin, @@ -830,12 +830,12 @@ class MDCache { void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin, bool want_xlocked, int r); - void make_trace(vector& trace, CInode *in); + void make_trace(std::vector& trace, CInode *in); void kick_open_ino_peers(mds_rank_t who); void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin, bool want_replica=true, bool want_xlocked=false, - vector *ancestors_hint=nullptr, + std::vector *ancestors_hint=nullptr, mds_rank_t auth_hint=MDS_RANK_NONE); void find_ino_peers(inodeno_t ino, MDSContext *c, @@ -967,30 +967,30 @@ class MDCache { // -- client caps -- uint64_t last_cap_id = 0; - map discovers; + std::map discovers; ceph_tid_t discover_last_tid = 0; // waiters - map > waiting_for_base_ino; + std::map > waiting_for_base_ino; - map > reconnected_caps; // inode -> client -> snap_follows,realmino - map > reconnected_snaprealms; // realmino -> client -> realmseq + std::map > reconnected_caps; // inode -> client -> snap_follows,realmino + std::map > reconnected_snaprealms; // realmino -> client -> realmseq // realm inodes - set rejoin_pending_snaprealms; + std::set rejoin_pending_snaprealms; // cap imports. delayed snap parent opens. - map > delayed_imported_caps; + std::map > delayed_imported_caps; // subsystems std::unique_ptr migrator; bool did_shutdown_log_cap = false; - map find_ino_peer; + std::map find_ino_peer; ceph_tid_t find_ino_peer_last_tid = 0; // delayed cache expire - map delayed_expire; // subtree root -> expire msg + std::map delayed_expire; // subtree root -> expire msg /* Because exports may fail, this set lets us keep track of inodes that need exporting. */ std::set export_pin_queue; @@ -1005,7 +1005,7 @@ class MDCache { // track leader requests whose peers haven't acknowledged commit struct uleader { uleader() {} - set peers; + std::set peers; LogSegment *ls = nullptr; MDSContext::vec waiters; bool safe = false; @@ -1023,8 +1023,8 @@ class MDCache { struct open_ino_info_t { open_ino_info_t() {} - vector ancestors; - set checked; + std::vector ancestors; + std::set checked; mds_rank_t checking = MDS_RANK_NONE; mds_rank_t auth_hint = MDS_RANK_NONE; bool check_peers = true; @@ -1071,8 +1071,8 @@ class MDCache { CDir* rejoin_invent_dirfrag(dirfrag_t df); void handle_cache_rejoin_strong(const cref_t &m); void rejoin_scour_survivor_replicas(mds_rank_t from, const cref_t &ack, - set& acked_inodes, - set& gather_locks); + std::set& acked_inodes, + std::set& gather_locks); void handle_cache_rejoin_ack(const cref_t &m); void rejoin_send_acks(); void rejoin_trim_undef_inodes(); @@ -1087,8 +1087,8 @@ class MDCache { } void inode_remove_replica(CInode *in, mds_rank_t rep, bool rejoin, - set& gather_locks); - void dentry_remove_replica(CDentry *dn, mds_rank_t rep, set& gather_locks); + std::set& gather_locks); + void dentry_remove_replica(CDentry *dn, mds_rank_t rep, std::set& gather_locks); void rename_file(CDentry *srcdn, CDentry *destdn); @@ -1097,7 +1097,7 @@ class MDCache { void _open_ino_traverse_dir(inodeno_t ino, open_ino_info_t& info, int err); void _open_ino_fetch_dir(inodeno_t ino, const cref_t &m, CDir *dir, bool parent); int open_ino_traverse_dir(inodeno_t ino, const cref_t &m, - const vector& ancestors, + const std::vector& ancestors, bool discover, bool want_xlocked, mds_rank_t *hint); void open_ino_finish(inodeno_t ino, open_ino_info_t& info, int err); void do_open_ino(inodeno_t ino, open_ino_info_t& info, int err); @@ -1129,7 +1129,7 @@ class MDCache { void rdlock_dirfrags_stats_work(MDRequestRef& mdr); ceph::unordered_map inode_map; // map of head inodes by ino - map snap_inode_map; // map of snap inodes by ino + std::map snap_inode_map; // map of snap inodes by ino CInode *root = nullptr; // root inode CInode *myin = nullptr; // .ceph/mds%d dir @@ -1138,7 +1138,7 @@ class MDCache { int stray_index = 0; int stray_fragmenting_index = -1; - set base_inodes; + std::set base_inodes; std::unique_ptr logger; @@ -1146,71 +1146,71 @@ class MDCache { std::array, client_lease_pools> client_leases{}; /* subtree keys and each tree's non-recursive nested subtrees (the "bounds") */ - map > subtrees; - map > > projected_subtree_renames; // renamed ino -> target dir + std::map > subtrees; + std::map > > projected_subtree_renames; // renamed ino -> target dir // -- requests -- ceph::unordered_map active_requests; // -- recovery -- - set recovery_set; + std::set recovery_set; // [resolve] // from EImportStart w/o EImportFinish during journal replay - map > my_ambiguous_imports; + std::map > my_ambiguous_imports; // from MMDSResolves - map > > other_ambiguous_imports; + std::map > > other_ambiguous_imports; - map uncommitted_peer_rename_olddir; // peer: preserve the non-auth dir until seeing commit. - map uncommitted_peer_unlink; // peer: preserve the unlinked inode until seeing commit. + std::map uncommitted_peer_rename_olddir; // peer: preserve the non-auth dir until seeing commit. + std::map uncommitted_peer_unlink; // peer: preserve the unlinked inode until seeing commit. - map uncommitted_leaders; // leader: req -> peer set - map uncommitted_peers; // peer: preserve the peer req until seeing commit. + std::map uncommitted_leaders; // leader: req -> peer set + std::map uncommitted_peers; // peer: preserve the peer req until seeing commit. - set pending_leaders; - map > ambiguous_peer_updates; + std::set pending_leaders; + std::map > ambiguous_peer_updates; bool resolves_pending = false; - set resolve_gather; // nodes i need resolves from - set resolve_ack_gather; // nodes i need a resolve_ack from - set resolve_snapclient_commits; - map resolve_need_rollback; // rollbacks i'm writing to the journal - map> delayed_resolve; + std::set resolve_gather; // nodes i need resolves from + std::set resolve_ack_gather; // nodes i need a resolve_ack from + std::set resolve_snapclient_commits; + std::map resolve_need_rollback; // rollbacks i'm writing to the journal + std::map> delayed_resolve; // [rejoin] bool rejoins_pending = false; - set rejoin_gather; // nodes from whom i need a rejoin - set rejoin_sent; // nodes i sent a rejoin to - set rejoin_ack_sent; // nodes i sent a rejoin to - set rejoin_ack_gather; // nodes from whom i need a rejoin ack - map > > rejoin_imported_caps; - map > > rejoin_peer_exports; - - map rejoin_client_map; - map rejoin_client_metadata_map; - map > rejoin_session_map; - - map > > cap_exports; // ino -> target, client -> capex - - map > > cap_imports; // ino -> client -> frommds -> capex - set cap_imports_missing; - map cap_reconnect_waiters; + std::set rejoin_gather; // nodes from whom i need a rejoin + std::set rejoin_sent; // nodes i sent a rejoin to + std::set rejoin_ack_sent; // nodes i sent a rejoin to + std::set rejoin_ack_gather; // nodes from whom i need a rejoin ack + std::map > > rejoin_imported_caps; + std::map > > rejoin_peer_exports; + + std::map rejoin_client_map; + std::map rejoin_client_metadata_map; + std::map > rejoin_session_map; + + std::map > > cap_exports; // ino -> target, client -> capex + + std::map > > cap_imports; // ino -> client -> frommds -> capex + std::set cap_imports_missing; + std::map cap_reconnect_waiters; int cap_imports_num_opening = 0; - set rejoin_undef_inodes; - set rejoin_potential_updated_scatterlocks; - set rejoin_undef_dirfrags; - map > rejoin_unlinked_inodes; + std::set rejoin_undef_inodes; + std::set rejoin_potential_updated_scatterlocks; + std::set rejoin_undef_dirfrags; + std::map > rejoin_unlinked_inodes; - vector rejoin_recover_q, rejoin_check_q; - list rejoin_eval_locks; + std::vector rejoin_recover_q, rejoin_check_q; + std::list rejoin_eval_locks; MDSContext::vec rejoin_waiters; std::unique_ptr rejoin_done; std::unique_ptr resolve_done; ceph_tid_t open_ino_last_tid = 0; - map opening_inodes; + std::map opening_inodes; StrayManager stray_manager; @@ -1234,7 +1234,7 @@ class MDCache { std::vector dirs; std::vector resultfrags; MDRequestRef mdr; - set notify_ack_waiting; + std::set notify_ack_waiting; bool finishing = false; // for deadlock detection @@ -1244,7 +1244,7 @@ class MDCache { int num_remote_waiters = 0; // number of remote authpin waiters }; - typedef map::iterator fragment_info_iterator; + typedef std::map::iterator fragment_info_iterator; friend class EFragment; friend class C_MDC_FragmentFrozen; @@ -1281,7 +1281,7 @@ class MDCache { MDSContext::vec& waiters, bool replay); CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true); - void get_force_dirfrag_bound_set(const vector& dfs, set& bounds); + void get_force_dirfrag_bound_set(const std::vector& dfs, std::set& bounds); bool can_fragment(CInode *diri, const std::vector& dirs); void fragment_freeze_dirs(const std::vector& dirs); @@ -1319,8 +1319,8 @@ class MDCache { RecoveryQueue recovery_queue; // shutdown - set shutdown_exporting_strays; - pair shutdown_export_next; + std::set shutdown_exporting_strays; + std::pair shutdown_export_next; bool opening_root = false, open = false; MDSContext::vec waiting_for_open; @@ -1328,9 +1328,9 @@ class MDCache { // -- snaprealms -- SnapRealm *global_snaprealm = nullptr; - map uncommitted_fragments; + std::map uncommitted_fragments; - map fragments; + std::map fragments; DecayCounter trim_counter; diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index 090b315674b..d9c26d37672 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -36,6 +36,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".log " +using namespace std; + // cons/des MDLog::~MDLog() { diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h index bb91c39e2cd..b6b0be60f9d 100644 --- a/src/mds/MDLog.h +++ b/src/mds/MDLog.h @@ -173,7 +173,7 @@ public: MDSRank *mds; // replay state - std::map> pending_exports; + std::map> pending_exports; protected: struct PendingEvent { @@ -276,15 +276,15 @@ protected: // -- segments -- std::map segments; - set expiring_segments; - set expired_segments; + std::set expiring_segments; + std::set expired_segments; std::size_t pre_segments_size = 0; // the num of segments when the mds finished replay-journal, to calc the num of segments growing uint64_t event_seq = 0; int expiring_events = 0; int expired_events = 0; int64_t mdsmap_up_features = 0; - std::map > pending_events; // log segment -> event list + std::map > pending_events; // log segment -> event list ceph::mutex submit_mutex = ceph::make_mutex("MDLog::submit_mutex"); ceph::condition_variable submit_cond; diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index f5c96773691..4147eec4f03 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -59,7 +59,11 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix *_dout << "mds." << name << ' ' + +using std::string; +using std::vector; using TOPNSPC::common::cmd_getval; + // cons/des MDSDaemon::MDSDaemon(std::string_view n, Messenger *m, MonClient *mc, boost::asio::io_context& ioctx) : diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index d92658934bd..b0491f61caf 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -50,9 +50,9 @@ class MDSDaemon : public Dispatcher { mono_time get_starttime() const { return starttime; } - chrono::duration get_uptime() const { + std::chrono::duration get_uptime() const { mono_time now = mono_clock::now(); - return chrono::duration(now-starttime); + return std::chrono::duration(now-starttime); } // handle a signal (e.g., SIGTERM) diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index 724d6d37f0b..956dff2d930 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -27,8 +27,9 @@ using std::map; using std::multimap; using std::ostream; using std::pair; -using std::string; using std::set; +using std::string; +using std::vector; using ceph::bufferlist; using ceph::Formatter; diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index dfbabb04470..2b40cfb3389 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -45,7 +45,13 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix *_dout << "mds." << whoami << '.' << incarnation << ' ' + +using std::ostream; +using std::set; +using std::string; +using std::vector; using TOPNSPC::common::cmd_getval; + class C_Flush_Journal : public MDSInternalContext { public: C_Flush_Journal(MDCache *mdcache, MDLog *mdlog, MDSRank *mds, diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index a67f6f1c6b9..acdf11ee4c0 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -185,9 +185,9 @@ class MDSRank { mono_time get_starttime() const { return starttime; } - chrono::duration get_uptime() const { + std::chrono::duration get_uptime() const { mono_time now = mono_clock::now(); - return chrono::duration(now-starttime); + return std::chrono::duration(now-starttime); } bool is_daemon_stopping() const; @@ -354,7 +354,7 @@ class MDSRank { void hit_export_target(mds_rank_t rank, double amount=-1.0); bool is_export_target(mds_rank_t rank) { - const set& map_targets = mdsmap->get_mds_info(get_nodeid()).export_targets; + const std::set& map_targets = mdsmap->get_mds_info(get_nodeid()).export_targets; return map_targets.count(rank); } @@ -466,7 +466,7 @@ class MDSRank { void dump_clientreplay_status(Formatter *f) const; void command_scrub_start(Formatter *f, std::string_view path, std::string_view tag, - const vector& scrubop_vec, Context *on_finish); + const std::vector& scrubop_vec, Context *on_finish); void command_tag_path(Formatter *f, std::string_view path, std::string_view tag); // scrub control commands @@ -559,7 +559,7 @@ class MDSRank { MetricsHandler metrics_handler; std::unique_ptr metric_aggregator; - list> waiting_for_nolaggy; + std::list> waiting_for_nolaggy; MDSContext::que finished_queue; // Dispatch, retry, queues int dispatch_depth = 0; @@ -567,7 +567,7 @@ class MDSRank { ceph::heartbeat_handle_d *hb = nullptr; // Heartbeat for threads using mds_lock double heartbeat_grace; - map peer_mdsmap_epoch; + std::map peer_mdsmap_epoch; ceph_tid_t last_tid = 0; // for mds-initiated requests (e.g. stray rename) @@ -577,8 +577,8 @@ class MDSRank { MDSContext::que replay_queue; bool replaying_requests_done = false; - map waiting_for_active_peer; - map waiting_for_mdsmap; + std::map waiting_for_active_peer; + std::map waiting_for_mdsmap; epoch_t osd_epoch_barrier = 0; @@ -588,7 +588,7 @@ class MDSRank { int mds_slow_req_count = 0; - map export_targets; /* targets this MDS is exporting to or wants/tries to */ + std::map export_targets; /* targets this MDS is exporting to or wants/tries to */ Messenger *messenger; MonClient *monc; diff --git a/src/mds/MDSTable.cc b/src/mds/MDSTable.cc index 679633f0c78..80b84b86971 100644 --- a/src/mds/MDSTable.cc +++ b/src/mds/MDSTable.cc @@ -33,6 +33,7 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << rank << "." << table_name << ": " +using namespace std; class MDSTableIOContext : public MDSIOContextBase { diff --git a/src/mds/MDSTable.h b/src/mds/MDSTable.h index 07e12f574e3..daa745ce8df 100644 --- a/src/mds/MDSTable.h +++ b/src/mds/MDSTable.h @@ -86,6 +86,6 @@ protected: version_t version = 0, committing_version = 0, committed_version = 0, projected_version = 0; - map waitfor_save; + std::map waitfor_save; }; #endif diff --git a/src/mds/MDSTableClient.cc b/src/mds/MDSTableClient.cc index 38f2122180d..9ded20bb8a8 100644 --- a/src/mds/MDSTableClient.cc +++ b/src/mds/MDSTableClient.cc @@ -226,9 +226,7 @@ void MDSTableClient::got_journaled_ack(version_t tid) void MDSTableClient::resend_commits() { - for (map::iterator p = pending_commit.begin(); - p != pending_commit.end(); - ++p) { + for (auto p = pending_commit.begin(); p != pending_commit.end(); ++p) { dout(10) << "resending commit on " << p->first << dendl; auto req = make_message(table, TABLESERVER_OP_COMMIT, 0, p->first); mds->send_message_mds(req, mds->get_mds_map()->get_tableserver()); @@ -242,9 +240,7 @@ void MDSTableClient::resend_prepares() waiting_for_reqid.pop_front(); } - for (map::iterator p = pending_prepare.begin(); - p != pending_prepare.end(); - ++p) { + for (auto p = pending_prepare.begin(); p != pending_prepare.end(); ++p) { dout(10) << "resending prepare on " << p->first << dendl; auto req = make_message(table, TABLESERVER_OP_PREPARE, p->first); req->bl = p->second.mutation; diff --git a/src/mds/MDSTableClient.h b/src/mds/MDSTableClient.h index 2952ec4069d..7d57f9d85b5 100644 --- a/src/mds/MDSTableClient.h +++ b/src/mds/MDSTableClient.h @@ -49,8 +49,8 @@ public: ack_waiters[tid].push_back(c); } - set get_journaled_tids() const { - set tids; + std::set get_journaled_tids() const { + std::set tids; for (auto p : pending_commit) tids.insert(p.first); return tids; @@ -88,12 +88,12 @@ protected: bool server_ready = false; - map pending_prepare; - map prepared_update; - list<_pending_prepare> waiting_for_reqid; + std::map pending_prepare; + std::map prepared_update; + std::list<_pending_prepare> waiting_for_reqid; // pending commits - map pending_commit; - map ack_waiters; + std::map pending_commit; + std::map ack_waiters; }; #endif diff --git a/src/mds/MDSTableServer.cc b/src/mds/MDSTableServer.cc index 3666e0db9e4..6e542b4e396 100644 --- a/src/mds/MDSTableServer.cc +++ b/src/mds/MDSTableServer.cc @@ -24,6 +24,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << rank << ".tableserver(" << get_mdstable_name(table) << ") " +using namespace std; + void MDSTableServer::handle_request(const cref_t &req) { ceph_assert(req->op >= 0); diff --git a/src/mds/MDSTableServer.h b/src/mds/MDSTableServer.h index 84dc5b87d24..74800db974c 100644 --- a/src/mds/MDSTableServer.h +++ b/src/mds/MDSTableServer.h @@ -83,7 +83,7 @@ public: } // recovery - void finish_recovery(set& active); + void finish_recovery(std::set& active); void _do_server_recovery(); void handle_mds_recovery(mds_rank_t who); @@ -91,11 +91,11 @@ public: protected: int table; bool recovered = false; - set active_clients; + std::set active_clients; private: struct notify_info_t { notify_info_t() {} - set notify_ack_gather; + std::set notify_ack_gather; mds_rank_t mds; ref_t reply = NULL; MDSContext *onfinish = nullptr; @@ -119,9 +119,9 @@ private: void handle_notify_ack(const cref_t &m); - map pending_for_mds; // ** child should encode this! ** - set committing_tids; + std::map pending_for_mds; // ** child should encode this! ** + std::set committing_tids; - map pending_notifies; + std::map pending_notifies; }; #endif diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 13bd2652aab..ce5e4dbd90e 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -66,6 +66,7 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".mig " << __func__ << " " +using namespace std; class MigratorContext : public MDSContext { protected: diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index f7c094294ae..be24e311100 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -197,7 +197,7 @@ public: } void maybe_split_export(CDir* dir, uint64_t max_size, bool null_okay, - vector >& results); + std::vector >& results); bool export_try_grab_locks(CDir *dir, MutationRef& mut); void get_export_client_set(CDir *dir, std::set &client_set); @@ -236,7 +236,7 @@ public: void decode_import_inode_caps(CInode *in, bool auth_cap, bufferlist::const_iterator &blp, std::map >& cap_imports); void finish_import_inode_caps(CInode *in, mds_rank_t from, bool auth_cap, - const std::map >& smap, + const std::map >& smap, const std::map &export_map, std::map &import_map); void decode_import_dir(bufferlist::const_iterator& blp, @@ -290,12 +290,12 @@ protected: std::set bystanders; std::list bound_ls; std::list updated_scatterlocks; - std::map > session_map; + std::map > session_map; std::map > peer_exports; MutationRef mut; }; - typedef map::iterator export_state_iterator; + typedef std::map::iterator export_state_iterator; friend class C_MDC_ExportFreeze; friend class C_MDS_ExportFinishLogged; @@ -325,7 +325,7 @@ protected: void export_finish(CDir *dir); void child_export_finish(std::shared_ptr& parent, bool success); void encode_export_prep_trace(bufferlist& bl, CDir *bound, CDir *dir, export_state_t &es, - set &inodes_added, set &dirfrags_added); + std::set &inodes_added, std::set &dirfrags_added); void decode_export_prep_trace(bufferlist::const_iterator& blp, mds_rank_t oldauth, MDSContext::vec &finished); void handle_gather_caps(const cref_t &m); @@ -345,14 +345,14 @@ protected: void import_notify_abort(CDir *dir, std::set& bounds); void import_notify_finish(CDir *dir, std::set& bounds); void import_logged_start(dirfrag_t df, CDir *dir, mds_rank_t from, - std::map >& imported_session_map); + std::map >& imported_session_map); void handle_export_finish(const cref_t &m); void handle_export_caps(const cref_t &m); void handle_export_caps_ack(const cref_t &m); void logged_import_caps(CInode *in, mds_rank_t from, - std::map >& imported_session_map, + std::map >& imported_session_map, std::map >& cap_imports); // bystander @@ -363,7 +363,7 @@ protected: uint64_t total_exporting_size = 0; unsigned num_locking_exports = 0; // exports in locking state (approx_size == 0) - std::list > export_queue; + std::list > export_queue; uint64_t export_queue_gen = 1; std::map import_state; diff --git a/src/mds/Mutation.cc b/src/mds/Mutation.cc index 7e3fb22bd20..39eee47217b 100644 --- a/src/mds/Mutation.cc +++ b/src/mds/Mutation.cc @@ -17,6 +17,8 @@ #include "CInode.h" #include "CDir.h" +using namespace std; + // MutationImpl void MutationImpl::pin(MDSCacheObject *o) diff --git a/src/mds/OpenFileTable.cc b/src/mds/OpenFileTable.cc index d3b0a33bbb5..a438ee1ddca 100644 --- a/src/mds/OpenFileTable.cc +++ b/src/mds/OpenFileTable.cc @@ -36,7 +36,10 @@ enum { #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, mds) -static ostream& _prefix(std::ostream *_dout, MDSRank *mds) { + +using namespace std; + +static std::ostream& _prefix(std::ostream *_dout, MDSRank *mds) { return *_dout << "mds." << mds->get_nodeid() << ".openfiles "; } diff --git a/src/mds/OpenFileTable.h b/src/mds/OpenFileTable.h index 058055575e4..d3934f753b4 100644 --- a/src/mds/OpenFileTable.h +++ b/src/mds/OpenFileTable.h @@ -24,6 +24,8 @@ class CDir; class CInode; class MDSRank; +struct ObjectOperation; + class OpenFileTable { public: @@ -59,7 +61,7 @@ public: bool should_log_open(CInode *in); - void note_destroyed_inos(uint64_t seq, const vector& inos); + void note_destroyed_inos(uint64_t seq, const std::vector& inos); void trim_destroyed_inos(uint64_t seq); protected: @@ -105,7 +107,7 @@ protected: void _prefetch_dirfrags(); void _get_ancestors(const Anchor& parent, - vector& ancestors, + std::vector& ancestors, mds_rank_t& auth_hint); MDSRank *mds; @@ -115,7 +117,7 @@ protected: unsigned omap_num_objs = 0; std::vector omap_num_items; - map anchor_map; + std::map anchor_map; std::map dirty_items; // ino -> dirty state @@ -130,7 +132,7 @@ protected: int journal_state = 0; std::vector > loaded_journals; - map loaded_anchor_map; + std::map loaded_anchor_map; MDSContext::vec waiting_for_load; bool load_done = false; @@ -144,7 +146,7 @@ protected: unsigned num_opening_inodes = 0; MDSContext::vec waiting_for_prefetch; - std::map > logseg_destroyed_inos; + std::map > logseg_destroyed_inos; std::set destroyed_inos_set; std::unique_ptr logger; diff --git a/src/mds/PurgeQueue.cc b/src/mds/PurgeQueue.cc index 56c962d19ba..cb6c389dd43 100644 --- a/src/mds/PurgeQueue.cc +++ b/src/mds/PurgeQueue.cc @@ -23,6 +23,9 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, rank) << __func__ << ": " + +using namespace std; + static ostream& _prefix(std::ostream *_dout, mds_rank_t rank) { return *_dout << "mds." << rank << ".purge_queue "; } diff --git a/src/mds/RecoveryQueue.cc b/src/mds/RecoveryQueue.cc index 6d215ccdbbe..111b270658d 100644 --- a/src/mds/RecoveryQueue.cc +++ b/src/mds/RecoveryQueue.cc @@ -25,6 +25,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << " RecoveryQueue::" << __func__ << " " +using namespace std; + class C_MDC_Recover : public MDSIOContextBase { public: C_MDC_Recover(RecoveryQueue *rq_, CInode *i) : diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 84441fcf662..f709ecbe271 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -22,7 +22,10 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, mdcache->mds) -static ostream& _prefix(std::ostream *_dout, MDSRank *mds) { + +using namespace std; + +static std::ostream& _prefix(std::ostream *_dout, MDSRank *mds) { return *_dout << "mds." << mds->get_nodeid() << ".scrubstack "; } diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 98b7bb6cc70..d40831cd52f 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -65,6 +65,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".server " +using namespace std; + class ServerContext : public MDSContext { protected: Server *server; diff --git a/src/mds/Server.h b/src/mds/Server.h index 7297fd56b62..ec1eddf144a 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -121,12 +121,12 @@ public: void _session_logged(Session *session, uint64_t state_seq, bool open, version_t pv, const interval_set& inos_to_free, version_t piv, const interval_set& inos_to_purge, LogSegment *ls); - version_t prepare_force_open_sessions(map &cm, - map& cmm, - map >& smap); - void finish_force_open_sessions(const map >& smap, + version_t prepare_force_open_sessions(std::map &cm, + std::map& cmm, + std::map >& smap); + void finish_force_open_sessions(const std::map >& smap, bool dec_import=true); - void flush_client_sessions(set& client_set, MDSGatherBuilder& gather); + void flush_client_sessions(std::set& client_set, MDSGatherBuilder& gather); void finish_flush_session(Session *session, version_t seq); void terminate_sessions(); void find_idle_sessions(); @@ -210,13 +210,13 @@ public: void handle_client_setlayout(MDRequestRef& mdr); void handle_client_setdirlayout(MDRequestRef& mdr); - int parse_quota_vxattr(string name, string value, quota_info_t *quota); + int parse_quota_vxattr(std::string name, std::string value, quota_info_t *quota); void create_quota_realm(CInode *in); - int parse_layout_vxattr(string name, string value, const OSDMap& osdmap, + int parse_layout_vxattr(std::string name, std::string value, const OSDMap& osdmap, file_layout_t *layout, bool validate=true); int check_layout_vxattr(MDRequestRef& mdr, - string name, - string value, + std::string name, + std::string value, file_layout_t *layout); void handle_set_vxattr(MDRequestRef& mdr, CInode *cur); void handle_remove_vxattr(MDRequestRef& mdr, CInode *cur); @@ -252,7 +252,7 @@ public: void handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t &m); void do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr); void _link_rollback_finish(MutationRef& mut, MDRequestRef& mdr, - map>& split); + std::map>& split); // unlink void handle_client_unlink(MDRequestRef& mdr); @@ -262,7 +262,7 @@ public: void _unlink_local_finish(MDRequestRef& mdr, CDentry *dn, CDentry *straydn, version_t); - bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector& trace, CDentry *straydn); + bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::vector& trace, CDentry *straydn); void handle_peer_rmdir_prep(MDRequestRef& mdr); void _logged_peer_rmdir(MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn); void _commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn); @@ -284,8 +284,8 @@ public: void _renamesnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid); // helpers - bool _rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set &witnesse, - vector& srctrace, vector& dsttrace, CDentry *straydn); + bool _rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::set &witnesse, + std::vector& srctrace, std::vector& dsttrace, CDentry *straydn); version_t _rename_prepare_import(MDRequestRef& mdr, CDentry *srcdn, bufferlist *client_map_bl); bool _need_force_journal(CInode *diri, bool empty); void _rename_prepare(MDRequestRef& mdr, @@ -306,7 +306,7 @@ public: void _commit_peer_rename(MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn); void do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr, bool finish_mdr=false); void _rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv, - CDentry *destdn, CDentry *staydn, map> splits[2], + CDentry *destdn, CDentry *staydn, std::map> splits[2], bool finish_mdr); void evict_cap_revoke_non_responders(); @@ -314,7 +314,7 @@ public: bool terminating_sessions = false; - set client_reclaim_gather; + std::set client_reclaim_gather; private: friend class MDSContinuation; @@ -414,10 +414,10 @@ private: return xattr_name.rfind("ceph.dir.layout", 0) == 0 || xattr_name.rfind("ceph.file.layout", 0) == 0 || xattr_name.rfind("ceph.quota", 0) == 0 || - xattr_name == "ceph.dir.subvolume"sv || - xattr_name == "ceph.dir.pin"sv || - xattr_name == "ceph.dir.pin.random"sv || - xattr_name == "ceph.dir.pin.distributed"sv; + xattr_name == "ceph.dir.subvolume" || + xattr_name == "ceph.dir.pin" || + xattr_name == "ceph.dir.pin.random" || + xattr_name == "ceph.dir.pin.distributed"; } static bool is_allowed_ceph_xattr(std::string_view xattr_name) { @@ -448,8 +448,8 @@ private: // before proceeding to reconnect_gather_finish time reconnect_start = clock::zero(); time reconnect_last_seen = clock::zero(); - set client_reconnect_gather; // clients i need a reconnect msg from. - set client_reconnect_denied; // clients whose reconnect msg have been denied . + std::set client_reconnect_gather; // clients i need a reconnect msg from. + std::set client_reconnect_denied; // clients whose reconnect msg have been denied . feature_bitset_t supported_features; feature_bitset_t required_client_features; diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index b96fc37d607..2364c973e67 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -30,6 +30,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << rank << ".sessionmap " +using namespace std; + namespace { class SessionMapIOContext : public MDSIOContextBase { diff --git a/src/mds/SnapClient.cc b/src/mds/SnapClient.cc index 9f83ed79e90..93abb4afaed 100644 --- a/src/mds/SnapClient.cc +++ b/src/mds/SnapClient.cc @@ -26,6 +26,8 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".snapclient " +using namespace std; + void SnapClient::resend_queries() { if (!waiting_for_version.empty() || (!synced && sync_reqid > 0)) { diff --git a/src/mds/SnapClient.h b/src/mds/SnapClient.h index e259f792493..92a1136d342 100644 --- a/src/mds/SnapClient.h +++ b/src/mds/SnapClient.h @@ -88,23 +88,23 @@ public: snapid_t get_last_created() const { return cached_last_created; } snapid_t get_last_destroyed() const { return cached_last_destroyed; } - void get_snaps(set& snaps) const; - set filter(const set& snaps) const; + void get_snaps(std::set& snaps) const; + std::set filter(const std::set& snaps) const; const SnapInfo* get_snap_info(snapid_t snapid) const; - void get_snap_infos(map& infomap, const set& snaps) const; + void get_snap_infos(std::map& infomap, const std::set& snaps) const; int dump_cache(Formatter *f) const; private: version_t cached_version = 0; snapid_t cached_last_created = 0, cached_last_destroyed = 0; - map cached_snaps; - map cached_pending_update; - map > cached_pending_destroy; + std::map cached_snaps; + std::map cached_pending_update; + std::map > cached_pending_destroy; - set committing_tids; + std::set committing_tids; - map waiting_for_version; + std::map waiting_for_version; uint64_t sync_reqid = 0; bool synced = false; diff --git a/src/mds/SnapRealm.cc b/src/mds/SnapRealm.cc index 09ddd9181ed..3eb8976adf5 100644 --- a/src/mds/SnapRealm.cc +++ b/src/mds/SnapRealm.cc @@ -28,8 +28,11 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, mdcache->mds->get_nodeid(), inode, srnode.seq, this) -static ostream& _prefix(std::ostream *_dout, int whoami, const CInode *inode, - uint64_t seq, const SnapRealm *realm) { + +using namespace std; + +static std::ostream& _prefix(std::ostream *_dout, int whoami, const CInode *inode, + uint64_t seq, const SnapRealm *realm) { return *_dout << " mds." << whoami << ".cache.snaprealm(" << inode->ino() << " seq " << seq << " " << realm << ") "; diff --git a/src/mds/SnapServer.cc b/src/mds/SnapServer.cc index f1648003585..08e27339f95 100644 --- a/src/mds/SnapServer.cc +++ b/src/mds/SnapServer.cc @@ -32,6 +32,7 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << rank << ".snap " +using namespace std; void SnapServer::reset_state() { @@ -109,7 +110,7 @@ void SnapServer::_prepare(const bufferlist& bl, uint64_t reqid, mds_rank_t bymds // bump last_snap... we use it as a version value on the snaprealm. ++last_snap; - pending_destroy[version] = pair(snapid, last_snap); + pending_destroy[version] = {snapid, last_snap}; dout(10) << "prepare v" << version << " destroy " << snapid << " seq " << last_snap << dendl; encode(last_snap, out); diff --git a/src/mds/SnapServer.h b/src/mds/SnapServer.h index a1019c3c864..fcab5f3c45a 100644 --- a/src/mds/SnapServer.h +++ b/src/mds/SnapServer.h @@ -68,7 +68,7 @@ public: static void generate_test_instances(std::list& ls); bool force_update(snapid_t last, snapid_t v2_since, - map& _snaps); + std::map& _snaps); protected: void encode_server_state(bufferlist& bl) const override { @@ -93,11 +93,12 @@ protected: if (struct_v >= 2) decode(pending_destroy, bl); else { - map t; + std::map t; decode(t, bl); - for (map::iterator p = t.begin(); p != t.end(); ++p) - pending_destroy[p->first].first = p->second; - } + for (auto& [ver, snapid] : t) { + pending_destroy[ver].first = snapid; + } + } decode(pending_noop, bl); if (struct_v >= 4) { decode(last_created, bl); @@ -127,12 +128,12 @@ protected: snapid_t last_snap = 0; snapid_t last_created, last_destroyed; snapid_t snaprealm_v2_since; - map snaps; - map > need_to_purge; + std::map snaps; + std::map > need_to_purge; - map pending_update; - map > pending_destroy; // (removed_snap, seq) - set pending_noop; + std::map pending_update; + std::map > pending_destroy; // (removed_snap, seq) + std::set pending_noop; version_t last_checked_osdmap = 0; }; diff --git a/src/mds/StrayManager.cc b/src/mds/StrayManager.cc index 9bf1a83d3a6..61e4f23fd7a 100644 --- a/src/mds/StrayManager.cc +++ b/src/mds/StrayManager.cc @@ -29,6 +29,9 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix _prefix(_dout, mds) + +using namespace std; + static ostream& _prefix(std::ostream *_dout, MDSRank *mds) { return *_dout << "mds." << mds->get_nodeid() << ".cache.strays "; } diff --git a/src/mds/cephfs_features.cc b/src/mds/cephfs_features.cc index eb5271c1ba8..3709ca8b9b4 100644 --- a/src/mds/cephfs_features.cc +++ b/src/mds/cephfs_features.cc @@ -29,13 +29,13 @@ static_assert(feature_names.size() == CEPHFS_FEATURE_MAX + 1); std::string_view cephfs_feature_name(size_t id) { if (id > feature_names.size()) - return "unknown"sv; + return "unknown"; return feature_names[id]; } int cephfs_feature_from_name(std::string_view name) { - if (name == "reserved"sv) { + if (name == "reserved") { return -1; } for (size_t i = 0; i < feature_names.size(); ++i) { diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h index 41b1208133f..6273bf00c82 100644 --- a/src/mds/events/ECommitted.h +++ b/src/mds/events/ECommitted.h @@ -26,7 +26,7 @@ public: explicit ECommitted(metareqid_t r) : LogEvent(EVENT_COMMITTED), reqid(r) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "ECommitted " << reqid; } diff --git a/src/mds/events/EExport.h b/src/mds/events/EExport.h index 589062db2a1..297b9e99d33 100644 --- a/src/mds/events/EExport.h +++ b/src/mds/events/EExport.h @@ -28,7 +28,7 @@ public: EMetaBlob metablob; // exported dir protected: dirfrag_t base; - set bounds; + std::set bounds; mds_rank_t target; public: @@ -38,9 +38,9 @@ public: LogEvent(EVENT_EXPORT), base(dir->dirfrag()), target(t) { } - set &get_bounds() { return bounds; } + std::set &get_bounds() { return bounds; } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EExport " << base << " to mds." << target << " " << metablob; } diff --git a/src/mds/events/EFragment.h b/src/mds/events/EFragment.h index 1cbbf7a8a36..bb10bf0a51d 100644 --- a/src/mds/events/EFragment.h +++ b/src/mds/events/EFragment.h @@ -41,7 +41,7 @@ public: LogEvent(EVENT_FRAGMENT), op(o), ino(df.ino), basefrag(df.frag), bits(b) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EFragment " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << " " << metablob; } diff --git a/src/mds/events/EImportFinish.h b/src/mds/events/EImportFinish.h index 24bb1cd1353..3848b6c2aaf 100644 --- a/src/mds/events/EImportFinish.h +++ b/src/mds/events/EImportFinish.h @@ -32,7 +32,7 @@ class EImportFinish : public LogEvent { success(s) { } EImportFinish() : LogEvent(EVENT_IMPORTFINISH), base(), success(false) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EImportFinish " << base; if (success) out << " success"; diff --git a/src/mds/events/EImportStart.h b/src/mds/events/EImportStart.h index d4673a84acc..1d94a161b0a 100644 --- a/src/mds/events/EImportStart.h +++ b/src/mds/events/EImportStart.h @@ -27,7 +27,7 @@ class MDSRank; class EImportStart : public LogEvent { protected: dirfrag_t base; - vector bounds; + std::vector bounds; mds_rank_t from; public: @@ -35,13 +35,13 @@ public: bufferlist client_map; // encoded map<__u32,entity_inst_t> version_t cmapv{0}; - EImportStart(MDLog *log, dirfrag_t di, const vector& b, mds_rank_t f) : + EImportStart(MDLog *log, dirfrag_t di, const std::vector& b, mds_rank_t f) : LogEvent(EVENT_IMPORTSTART), base(di), bounds(b), from(f) { } EImportStart() : LogEvent(EVENT_IMPORTSTART), from(MDS_RANK_NONE) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EImportStart " << base << " from mds." << from << " " << metablob; } diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index d555627a3c6..a766504f5f4 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -112,7 +112,7 @@ public: bool need_snapflush() const { return (state & STATE_NEED_SNAPFLUSH); } bool is_export_ephemeral_random() const { return (state & STATE_EPHEMERAL_RANDOM); } - void print(ostream& out) const { + void print(std::ostream& out) const { out << " fullbit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv << " inode " << inode->ino << " state=" << state; @@ -121,8 +121,8 @@ public: } out << std::endl; } - string state_string() const { - string state_string; + std::string state_string() const { + std::string state_string; bool marked_already = false; if (is_dirty()) { state_string.append("dirty"); @@ -156,7 +156,7 @@ public: void encode(bufferlist& bl) const; void decode(bufferlist::const_iterator &bl); - void print(ostream& out) const { + void print(std::ostream& out) const { out << " remotebit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv << " ino " << ino << " dirty=" << dirty; @@ -188,7 +188,7 @@ public: void decode(bufferlist::const_iterator &bl); void dump(Formatter *f) const; static void generate_test_instances(std::list& ls); - void print(ostream& out) const { + void print(std::ostream& out) const { out << " nullbit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv << " dirty=" << dirty << std::endl; } @@ -214,9 +214,9 @@ public: private: mutable bufferlist dnbl; mutable bool dn_decoded; - mutable list dfull; - mutable vector dremote; - mutable vector dnull; + mutable std::list dfull; + mutable std::vector dremote; + mutable std::vector dnull; public: dirlump() : state(0), nfull(0), nremote(0), nnull(0), dn_decoded(true) { } @@ -234,10 +234,10 @@ public: bool is_dirty_dft() { return state & STATE_DIRTYDFT; } void mark_dirty_dft() { state |= STATE_DIRTYDFT; } - const list &get_dfull() const { return dfull; } - list &_get_dfull() { return dfull; } - const vector &get_dremote() const { return dremote; } - const vector &get_dnull() const { return dnull; } + const std::list &get_dfull() const { return dfull; } + std::list &_get_dfull() { return dfull; } + const std::vector &get_dremote() const { return dremote; } + const std::vector &get_dnull() const { return dnull; } template< class... Args> void add_dfull(Args&&... args) { @@ -252,7 +252,7 @@ public: dnull.emplace_back(std::forward(args)...); } - void print(dirfrag_t dirfrag, ostream& out) const { + void print(dirfrag_t dirfrag, std::ostream& out) const { out << "dirlump " << dirfrag << " v " << fnode->version << " state " << state << " num " << nfull << "/" << nremote << "/" << nnull @@ -266,8 +266,8 @@ public: p.print(out); } - string state_string() const { - string state_string; + std::string state_string() const { + std::string state_string; bool marked_already = false; if (is_complete()) { state_string.append("complete"); @@ -309,16 +309,16 @@ public: WRITE_CLASS_ENCODER_FEATURES(dirlump) // my lumps. preserve the order we added them in a list. - vector lump_order; - map lump_map; - list roots; + std::vector lump_order; + std::map lump_map; + std::list roots; public: - vector > table_tids; // tableclient transactions + std::vector > table_tids; // tableclient transactions inodeno_t opened_ino; public: inodeno_t renamed_dirino; - vector renamed_dir_frags; + std::vector renamed_dir_frags; private: // ino (pre)allocation. may involve both inotable AND session state. @@ -329,16 +329,16 @@ private: entity_name_t client_name; // session // inodes i've truncated - vector truncate_start; // start truncate - map truncate_finish; // finished truncate (started in segment blah) + std::vector truncate_start; // start truncate + std::map truncate_finish; // finished truncate (started in segment blah) public: - vector destroyed_inodes; + std::vector destroyed_inodes; private: // idempotent op(s) - vector > client_reqs; - vector > client_flushes; + std::vector > client_reqs; + std::vector > client_flushes; public: void encode(bufferlist& bl, uint64_t features) const; @@ -365,20 +365,20 @@ private: ~EMetaBlob() { } EMetaBlob& operator=(const EMetaBlob&) = delete; - void print(ostream& out) { + void print(std::ostream& out) { for (const auto &p : lump_order) lump_map[p].print(p, out); } void add_client_req(metareqid_t r, uint64_t tid=0) { - client_reqs.push_back(pair(r, tid)); + client_reqs.push_back(std::pair(r, tid)); } void add_client_flush(metareqid_t r, uint64_t tid=0) { - client_flushes.push_back(pair(r, tid)); + client_flushes.push_back(std::pair(r, tid)); } void add_table_transaction(int table, version_t tid) { - table_tids.push_back(pair<__u8, version_t>(table, tid)); + table_tids.emplace_back(table, tid); } void add_opened_ino(inodeno_t ino) { @@ -527,7 +527,7 @@ private: } } - string empty; + std::string empty; roots.emplace_back(empty, "", in->first, in->last, 0, pi, pdft, px, in->symlink, in->oldest_snap, snapbl, (dirty ? fullbit::STATE_DIRTY : 0), in->get_old_inodes()); @@ -578,7 +578,7 @@ private: opened_ino == 0 && inotablev == 0 && sessionmapv == 0; } - void print(ostream& out) const { + void print(std::ostream& out) const { out << "[metablob"; if (!lump_order.empty()) out << " " << lump_order.front() << ", " << lump_map.size() << " dirs"; @@ -605,7 +605,7 @@ WRITE_CLASS_ENCODER(EMetaBlob::remotebit) WRITE_CLASS_ENCODER(EMetaBlob::nullbit) WRITE_CLASS_ENCODER_FEATURES(EMetaBlob::dirlump) -inline ostream& operator<<(ostream& out, const EMetaBlob& t) { +inline std::ostream& operator<<(std::ostream& out, const EMetaBlob& t) { t.print(out); return out; } diff --git a/src/mds/events/EOpen.h b/src/mds/events/EOpen.h index 06bfd3e882e..35aeee3f9c5 100644 --- a/src/mds/events/EOpen.h +++ b/src/mds/events/EOpen.h @@ -21,14 +21,14 @@ class EOpen : public LogEvent { public: EMetaBlob metablob; - vector inos; - vector snap_inos; + std::vector inos; + std::vector snap_inos; EOpen() : LogEvent(EVENT_OPEN) { } explicit EOpen(MDLog *mdlog) : LogEvent(EVENT_OPEN) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EOpen " << metablob << ", " << inos.size() << " open files"; } diff --git a/src/mds/events/EPeerUpdate.h b/src/mds/events/EPeerUpdate.h index 38f53735eb1..88ddaa264a3 100644 --- a/src/mds/events/EPeerUpdate.h +++ b/src/mds/events/EPeerUpdate.h @@ -52,9 +52,9 @@ WRITE_CLASS_ENCODER(link_rollback) struct rmdir_rollback { metareqid_t reqid; dirfrag_t src_dir; - string src_dname; + std::string src_dname; dirfrag_t dest_dir; - string dest_dname; + std::string dest_dname; bufferlist snapbl; void encode(bufferlist& bl) const; @@ -70,7 +70,7 @@ struct rename_rollback { utime_t dirfrag_old_mtime; utime_t dirfrag_old_rctime; inodeno_t ino, remote_ino; - string dname; + std::string dname; char remote_d_type; utime_t old_ctime; @@ -118,7 +118,7 @@ public: */ EMetaBlob commit; bufferlist rollback; - string type; + std::string type; metareqid_t reqid; mds_rank_t leader; __u8 op; // prepare, commit, abort @@ -132,7 +132,7 @@ public: leader(leadermds), op(o), origop(oo) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { if (type.length()) out << type << " "; out << " " << (int)op; diff --git a/src/mds/events/EPurged.h b/src/mds/events/EPurged.h index cda1b2ecf2d..56e136a343d 100644 --- a/src/mds/events/EPurged.h +++ b/src/mds/events/EPurged.h @@ -29,7 +29,7 @@ public: void encode(bufferlist& bl, uint64_t features) const override; void decode(bufferlist::const_iterator& bl) override; void dump(Formatter *f) const override; - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "Eurged " << inos.size() << " inos, inotable v" << inotablev; } diff --git a/src/mds/events/EResetJournal.h b/src/mds/events/EResetJournal.h index 302227fc643..fba634abba0 100644 --- a/src/mds/events/EResetJournal.h +++ b/src/mds/events/EResetJournal.h @@ -28,7 +28,7 @@ class EResetJournal : public LogEvent { void decode(bufferlist::const_iterator& bl) override; void dump(Formatter *f) const override; static void generate_test_instances(std::list& ls); - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "EResetJournal"; } diff --git a/src/mds/events/ESession.h b/src/mds/events/ESession.h index c6586e3b575..3e755db9071 100644 --- a/src/mds/events/ESession.h +++ b/src/mds/events/ESession.h @@ -52,7 +52,7 @@ class ESession : public LogEvent { void dump(Formatter *f) const override; static void generate_test_instances(std::list& ls); - void print(ostream& out) const override { + void print(std::ostream& out) const override { if (open) out << "ESession " << client_inst << " open cmapv " << cmapv; else diff --git a/src/mds/events/ESessions.h b/src/mds/events/ESessions.h index fad70212084..e334675f2a7 100644 --- a/src/mds/events/ESessions.h +++ b/src/mds/events/ESessions.h @@ -26,12 +26,12 @@ protected: bool old_style_encode; public: - map client_map; - map client_metadata_map; + std::map client_map; + std::map client_metadata_map; ESessions() : LogEvent(EVENT_SESSIONS), cmapv(0), old_style_encode(false) { } - ESessions(version_t pv, map&& cm, - map&& cmm) : + ESessions(version_t pv, std::map&& cm, + std::map&& cmm) : LogEvent(EVENT_SESSIONS), cmapv(pv), old_style_encode(false), client_map(std::move(cm)), @@ -49,7 +49,7 @@ public: void dump(Formatter *f) const override; static void generate_test_instances(std::list& ls); - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "ESessions " << client_map.size() << " opens cmapv " << cmapv; } diff --git a/src/mds/events/ESubtreeMap.h b/src/mds/events/ESubtreeMap.h index 3dc824087f5..ebddff0439e 100644 --- a/src/mds/events/ESubtreeMap.h +++ b/src/mds/events/ESubtreeMap.h @@ -21,14 +21,14 @@ class ESubtreeMap : public LogEvent { public: EMetaBlob metablob; - map > subtrees; - set ambiguous_subtrees; + std::map > subtrees; + std::set ambiguous_subtrees; uint64_t expire_pos; uint64_t event_seq; ESubtreeMap() : LogEvent(EVENT_SUBTREEMAP), expire_pos(0), event_seq(0) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "ESubtreeMap " << subtrees.size() << " subtrees " << ", " << ambiguous_subtrees.size() << " ambiguous " << metablob; diff --git a/src/mds/events/ETableClient.h b/src/mds/events/ETableClient.h index 3f6e454e646..18f08923ffe 100644 --- a/src/mds/events/ETableClient.h +++ b/src/mds/events/ETableClient.h @@ -36,7 +36,7 @@ struct ETableClient : public LogEvent { void dump(Formatter *f) const override; static void generate_test_instances(std::list& ls); - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "ETableClient " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (tid) out << " tid " << tid; } diff --git a/src/mds/events/ETableServer.h b/src/mds/events/ETableServer.h index 59fe8ff1cbd..b5762d5e727 100644 --- a/src/mds/events/ETableServer.h +++ b/src/mds/events/ETableServer.h @@ -41,7 +41,7 @@ struct ETableServer : public LogEvent { void dump(Formatter *f) const override; static void generate_test_instances(std::list& ls); - void print(ostream& out) const override { + void print(std::ostream& out) const override { out << "ETableServer " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (reqid) out << " reqid " << reqid; diff --git a/src/mds/events/EUpdate.h b/src/mds/events/EUpdate.h index d320014a1f0..bebd278bf74 100644 --- a/src/mds/events/EUpdate.h +++ b/src/mds/events/EUpdate.h @@ -23,7 +23,7 @@ class EUpdate : public LogEvent { public: EMetaBlob metablob; - string type; + std::string type; bufferlist client_map; version_t cmapv; metareqid_t reqid; @@ -34,7 +34,7 @@ public: LogEvent(EVENT_UPDATE), type(s), cmapv(0), had_peers(false) { } - void print(ostream& out) const override { + void print(std::ostream& out) const override { if (type.length()) out << "EUpdate " << type << " "; out << metablob; diff --git a/src/mds/journal.cc b/src/mds/journal.cc index ae64a4232a4..6496f228d59 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -58,6 +58,13 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".journal " +using std::list; +using std::map; +using std::ostream; +using std::pair; +using std::set; +using std::string; +using std::vector; // ----------------------- // LogSegment diff --git a/src/mds/snap.cc b/src/mds/snap.cc index f988ca51367..c5b8728e927 100644 --- a/src/mds/snap.cc +++ b/src/mds/snap.cc @@ -18,6 +18,7 @@ #include "common/Formatter.h" +using namespace std; /* * SnapInfo */ -- 2.39.5