From 79abd0f4914b7f4a3d107bfddf49b47347acb101 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 18 Dec 2018 13:08:59 -0800 Subject: [PATCH] mds: scope using directives Signed-off-by: Patrick Donnelly --- src/mds/Locker.h | 15 +++---- src/mds/MDBalancer.h | 12 +++-- src/mds/Migrator.h | 102 +++++++++++++++++++++---------------------- 3 files changed, 60 insertions(+), 69 deletions(-) diff --git a/src/mds/Locker.h b/src/mds/Locker.h index 24b9d7820d1ad..38133be2f0945 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -26,9 +26,6 @@ #include #include #include -using std::map; -using std::list; -using std::set; class MDSRank; class Session; @@ -69,7 +66,7 @@ protected: void send_lock_message(SimpleLock *lock, int msg, const bufferlist &data); // -- locks -- - void _drop_locks(MutationImpl *mut, set *pneed_issue, bool drop_rdlocks); + void _drop_locks(MutationImpl *mut, std::set *pneed_issue, bool drop_rdlocks); public: void include_snap_rdlocks(CInode *in, MutationImpl::LockOpVec& lov); void include_snap_rdlocks_wlayout(CInode *in, MutationImpl::LockOpVec& lov, @@ -81,10 +78,10 @@ public: bool auth_pin_nonblock=false); void notify_freeze_waiter(MDSCacheObject *o); - void cancel_locking(MutationImpl *mut, set *pneed_issue); - void drop_locks(MutationImpl *mut, set *pneed_issue=0); + void cancel_locking(MutationImpl *mut, std::set *pneed_issue); + void drop_locks(MutationImpl *mut, std::set *pneed_issue=0); void set_xlocks_done(MutationImpl *mut, bool skip_dentry=false); - void drop_non_rdlocks(MutationImpl *mut, set *pneed_issue=0); + void drop_non_rdlocks(MutationImpl *mut, std::set *pneed_issue=0); void drop_rdlocks_for_early_reply(MutationImpl *mut); void drop_locks_for_fragment_unfreeze(MutationImpl *mut); @@ -99,7 +96,7 @@ public: void eval_scatter_gathers(CInode *in); - void eval_cap_gather(CInode *in, set *issue_set=0); + void eval_cap_gather(CInode *in, std::set *issue_set=0); bool eval(CInode *in, int mask, bool caps_imported=false); void try_eval(MDSCacheObject *p, int mask); @@ -244,7 +241,7 @@ public: version_t issue_file_data_version(CInode *in); Capability* issue_new_caps(CInode *in, int mode, Session *session, SnapRealm *conrealm, bool is_replay); bool issue_caps(CInode *in, Capability *only_cap=0); - void issue_caps_set(set& inset); + void issue_caps_set(std::set& inset); void issue_truncate(CInode *in); void revoke_stale_caps(Session *session); void revoke_stale_caps(Capability *cap); diff --git a/src/mds/MDBalancer.h b/src/mds/MDBalancer.h index e9cb6838a047a..e89b192d7b2a3 100644 --- a/src/mds/MDBalancer.h +++ b/src/mds/MDBalancer.h @@ -19,8 +19,6 @@ #include #include -using std::list; -using std::map; #include "include/types.h" #include "common/Clock.h" @@ -104,7 +102,7 @@ private: void handle_heartbeat(const MHeartbeat::const_ref &m); void find_exports(CDir *dir, double amount, - list& exports, + std::list& exports, double& have, set& already_exporting); @@ -151,10 +149,10 @@ private: set split_pending, merge_pending; // per-epoch scatter/gathered info - map mds_load; - map mds_meta_load; - map > mds_import_map; - map mds_last_epoch_under_map; + std::map mds_load; + std::map mds_meta_load; + std::map > mds_import_map; + std::map mds_last_epoch_under_map; // per-epoch state double my_load = 0; diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index 6a0095a802d01..c59a8c77e8d10 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -24,10 +24,6 @@ #include #include #include -using std::map; -using std::list; -using std::set; - class MDSRank; class CDir; @@ -125,9 +121,9 @@ protected: int state = 0; mds_rank_t peer = MDS_RANK_NONE; uint64_t tid = 0; - set warning_ack_waiting; - set notify_ack_waiting; - map > peer_imported; + std::set warning_ack_waiting; + std::set notify_ack_waiting; + std::map > peer_imported; MutationRef mut; size_t approx_size = 0; // for freeze tree deadlock detection @@ -138,13 +134,13 @@ protected: std::shared_ptr parent; }; - map export_state; + std::map export_state; typedef map::iterator export_state_iterator; uint64_t total_exporting_size = 0; unsigned num_locking_exports = 0; // exports in locking state (approx_size == 0) - list > export_queue; + std::list > export_queue; uint64_t export_queue_gen = 1; // import fun @@ -152,16 +148,16 @@ protected: int state; mds_rank_t peer; uint64_t tid; - set bystanders; - list bound_ls; - list updated_scatterlocks; - map > session_map; - map > peer_exports; + std::set bystanders; + std::list bound_ls; + std::list updated_scatterlocks; + std::map > session_map; + std::map > peer_exports; MutationRef mut; import_state_t() : state(0), peer(0), tid(0), mut() {} }; - map import_state; + std::map import_state; void handle_export_discover_ack(const MExportDirDiscoverAck::const_ref &m); void export_frozen(CDir *dir, uint64_t tid); @@ -172,7 +168,7 @@ protected: void export_try_cancel(CDir *dir, bool notify_peer=true); void export_cancel_finish(export_state_iterator& it); void export_reverse(CDir *dir, export_state_t& stat); - void export_notify_abort(CDir *dir, export_state_t& stat, set& bounds); + void export_notify_abort(CDir *dir, export_state_t& stat, std::set& bounds); void handle_export_ack(const MExportDirAck::const_ref &m); void export_logged_finish(CDir *dir); void handle_export_notify_ack(const MExportDirNotifyAck::const_ref &m); @@ -198,21 +194,21 @@ protected: void import_reverse_discovering(dirfrag_t df); void import_reverse_discovered(dirfrag_t df, CInode *diri); void import_reverse_prepping(CDir *dir, import_state_t& stat); - void import_remove_pins(CDir *dir, set& bounds); + void import_remove_pins(CDir *dir, std::set& bounds); void import_reverse_unfreeze(CDir *dir); void import_reverse_final(CDir *dir); - void import_notify_abort(CDir *dir, set& bounds); - void import_notify_finish(CDir *dir, set& bounds); + 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, - map >& imported_session_map); + std::map >& imported_session_map); void handle_export_finish(const MExportDirFinish::const_ref &m); void handle_export_caps(const MExportCaps::const_ref &m); void handle_export_caps_ack(const MExportCapsAck::const_ref &m); void logged_import_caps(CInode *in, mds_rank_t from, - map >& imported_session_map, - map >& cap_imports); + std::map >& imported_session_map, + std::map >& cap_imports); friend class C_MDS_ImportDirLoggedStart; @@ -235,41 +231,41 @@ public: // -- status -- int is_exporting(CDir *dir) const { - map::const_iterator it = export_state.find(dir); + auto it = export_state.find(dir); if (it != export_state.end()) return it->second.state; return 0; } bool is_exporting() const { return !export_state.empty(); } int is_importing(dirfrag_t df) const { - map::const_iterator it = import_state.find(df); + auto it = import_state.find(df); if (it != import_state.end()) return it->second.state; return 0; } bool is_importing() const { return !import_state.empty(); } bool is_ambiguous_import(dirfrag_t df) const { - map::const_iterator p = import_state.find(df); - if (p == import_state.end()) + auto it = import_state.find(df); + if (it == import_state.end()) return false; - if (p->second.state >= IMPORT_LOGGINGSTART && - p->second.state < IMPORT_ABORTING) + if (it->second.state >= IMPORT_LOGGINGSTART && + it->second.state < IMPORT_ABORTING) return true; return false; } int get_import_state(dirfrag_t df) const { - map::const_iterator it = import_state.find(df); + auto it = import_state.find(df); ceph_assert(it != import_state.end()); return it->second.state; } int get_import_peer(dirfrag_t df) const { - map::const_iterator it = import_state.find(df); + auto it = import_state.find(df); ceph_assert(it != import_state.end()); return it->second.peer; } int get_export_state(CDir *dir) const { - map::const_iterator it = export_state.find(dir); + auto it = export_state.find(dir); ceph_assert(it != export_state.end()); return it->second.state; } @@ -278,21 +274,21 @@ public: // be warned of ambiguous auth. // only returns meaningful results during EXPORT_WARNING state. bool export_has_warned(CDir *dir, mds_rank_t who) { - map::iterator it = export_state.find(dir); + auto it = export_state.find(dir); ceph_assert(it != export_state.end()); ceph_assert(it->second.state == EXPORT_WARNING); return (it->second.warning_ack_waiting.count(who) == 0); } bool export_has_notified(CDir *dir, mds_rank_t who) const { - map::const_iterator it = export_state.find(dir); + auto it = export_state.find(dir); ceph_assert(it != export_state.end()); ceph_assert(it->second.state == EXPORT_NOTIFYING); return (it->second.notify_ack_waiting.count(who) == 0); } void export_freeze_inc_num_waiters(CDir *dir) { - map::iterator it = export_state.find(dir); + auto it = export_state.find(dir); ceph_assert(it != export_state.end()); it->second.num_remote_waiters++; } @@ -321,28 +317,28 @@ public: void child_export_finish(std::shared_ptr& parent, bool success); void get_export_lock_set(CDir *dir, MutationImpl::LockOpVec& lov); - void get_export_client_set(CDir *dir, set &client_set); - void get_export_client_set(CInode *in, set &client_set); + void get_export_client_set(CDir *dir, std::set &client_set); + void get_export_client_set(CInode *in, std::set &client_set); void encode_export_inode(CInode *in, bufferlist& bl, - map& exported_client_map, - map& exported_client_metadata_map); + std::map& exported_client_map, + std::map& exported_client_metadata_map); void encode_export_inode_caps(CInode *in, bool auth_cap, bufferlist& bl, - map& exported_client_map, - map& exported_client_metadata_map); + std::map& exported_client_map, + std::map& exported_client_metadata_map); void finish_export_inode(CInode *in, mds_rank_t target, - map& peer_imported, + std::map& peer_imported, MDSInternalContextBase::vec& finished); void finish_export_inode_caps(CInode *in, mds_rank_t target, - map& peer_imported); + std::map& peer_imported); uint64_t encode_export_dir(bufferlist& exportbl, CDir *dir, - map& exported_client_map, - map& exported_client_metadata_map); + std::map& exported_client_map, + std::map& exported_client_metadata_map); void finish_export_dir(CDir *dir, mds_rank_t target, - map >& peer_imported, + std::map >& peer_imported, MDSInternalContextBase::vec& finished, int *num_dentries); void clear_export_proxy_pins(CDir *dir); @@ -351,21 +347,21 @@ public: void decode_import_inode(CDentry *dn, bufferlist::const_iterator& blp, mds_rank_t oldauth, LogSegment *ls, - map >& cap_imports, - list& updated_scatterlocks); + std::map >& cap_imports, + std::list& updated_scatterlocks); void decode_import_inode_caps(CInode *in, bool auth_cap, bufferlist::const_iterator &blp, - map >& cap_imports); + std::map >& cap_imports); void finish_import_inode_caps(CInode *in, mds_rank_t from, bool auth_cap, - const map >& smap, - const map &export_map, - map &import_map); + const std::map >& smap, + const std::map &export_map, + std::map &import_map); int decode_import_dir(bufferlist::const_iterator& blp, mds_rank_t oldauth, CDir *import_root, EImportStart *le, LogSegment *ls, - map >& cap_imports, - list& updated_scatterlocks); + std::map >& cap_imports, + std::list& updated_scatterlocks); void import_reverse(CDir *dir); -- 2.39.5