From edd96f9b05e6e665c5228ba28741568ca9d2ca6c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 17 Feb 2025 08:30:18 +0100 Subject: [PATCH] include/unordered_{map,set}: remove, use `std` directly instead This is only an alias for the `std` classes anyway. This effectively reverts commit 8e8672047ccc which added these aliases, probably because C++11 was new and not all compilers supported it properly, but that was 12 years ago and we're onl C++20 meanwhile. Signed-off-by: Max Kellermann --- doc/dev/network-encoding.rst | 6 ++-- fusetrace/fusetrace_ll.cc | 5 ++- src/client/Client.cc | 34 +++++++------------ src/client/Client.h | 14 ++++---- src/client/Dir.h | 3 +- src/client/SyntheticClient.cc | 33 +++++++----------- src/client/fuse_ll.cc | 10 +++--- src/cls/2pc_queue/cls_2pc_queue_types.h | 4 ++- src/common/LogEntry.h | 4 +-- src/common/WorkQueue.h | 6 ++-- src/common/lockdep.cc | 8 ++--- src/common/shared_cache.hpp | 5 +-- src/common/win32/errno.cc | 5 +-- src/include/encoding.h | 31 +++++++++-------- src/include/object.h | 1 - src/include/types.h | 7 ++-- src/include/unordered_map.h | 11 ------ src/include/unordered_set.h | 10 ------ src/librbd/cache/ObjectCacherWriteback.h | 5 +-- src/mds/LogSegment.h | 6 ++-- src/mds/MDCache.h | 5 +-- src/mds/Mutation.h | 3 +- src/mds/ScrubStack.cc | 2 +- src/mds/SessionMap.cc | 17 +++------- src/mds/SessionMap.h | 7 ++-- src/mds/journal.cc | 6 ++-- src/mgr/DaemonServer.h | 3 +- src/mon/LogMonitor.h | 2 +- src/mon/OSDMonitor.cc | 8 ++--- src/msg/async/AsyncMessenger.h | 5 ++- src/msg/async/rdma/RDMAStack.h | 3 +- src/os/bluestore/BlueStore.cc | 13 +++---- src/os/bluestore/BlueStore.h | 2 +- src/os/kstore/KStore.cc | 17 ++++------ src/os/kstore/KStore.h | 6 ++-- src/os/memstore/MemStore.cc | 11 +++--- src/os/memstore/MemStore.h | 7 ++-- src/osd/HitSet.cc | 8 ++--- src/osd/HitSet.h | 6 ++-- src/osd/OSD.h | 3 +- src/osd/PGLog.cc | 1 - src/osd/PGLog.h | 9 ++--- src/osdc/ObjectCacher.cc | 19 ++++------- src/osdc/ObjectCacher.h | 4 ++- src/rgw/driver/rados/rgw_notify.cc | 6 ++-- .../test_DomainSocket.cc | 5 ++- src/test/objectstore/ObjectStoreImitator.cc | 8 ++--- src/test/objectstore/store_test.cc | 1 - src/test/xattr_bench.cc | 2 -- src/tools/osdmaptool.cc | 4 +-- 50 files changed, 167 insertions(+), 234 deletions(-) delete mode 100644 src/include/unordered_map.h delete mode 100644 src/include/unordered_set.h diff --git a/doc/dev/network-encoding.rst b/doc/dev/network-encoding.rst index d5d1a6d1537..71328422e22 100644 --- a/doc/dev/network-encoding.rst +++ b/doc/dev/network-encoding.rst @@ -136,7 +136,7 @@ Lists are represented as an element count followed by that many elements. The size of the elements in the list are not necessarily uniform. Lists are used to encode ``std::list``, ``std::vector``, ``std::deque``, -``std::set`` and ``ceph::unordered_set``. +``std::set`` and ``std::unordered_set``. Blob ---- @@ -179,8 +179,8 @@ Maps are a list of pairs. ceph_pair entries[length]; } -Maps are used to encode ``std::map``, ``std::multimap`` and -``ceph::unordered_map``. +Maps are used to encode ``std::map``, ``std::multimap``, +``std::unordered_map`` and ``std::unordered_multimap``. Complex Types ============= diff --git a/fusetrace/fusetrace_ll.cc b/fusetrace/fusetrace_ll.cc index f10c29fd22e..46851fd177b 100644 --- a/fusetrace/fusetrace_ll.cc +++ b/fusetrace/fusetrace_ll.cc @@ -30,8 +30,6 @@ #endif #include - -#include "include/unordered_map.h" #include "include/hash_namespace.h" #ifndef __LP64__ @@ -50,6 +48,7 @@ CEPH_HASH_NAMESPACE_END #include #include #include +#include using namespace std; #include "common/ceph_mutex.h" @@ -87,7 +86,7 @@ struct Inode { }; Inode *root = 0; -ceph::unordered_map inode_map; +std::unordered_map inode_map; bool make_inode_path(string &buf, Inode *in) { diff --git a/src/client/Client.cc b/src/client/Client.cc index e7a45e1baba..57a4fbcb451 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -524,7 +524,7 @@ void Client::dump_inode(Formatter *f, Inode *in, set& did, bool disconne did.insert(in); if (in->dir) { ldout(cct, 1) << " dir " << in->dir << " size " << in->dir->dentries.size() << dendl; - for (ceph::unordered_map::iterator it = in->dir->dentries.begin(); + for (auto it = in->dir->dentries.begin(); it != in->dir->dentries.end(); ++it) { ldout(cct, 1) << " " << in->ino << " dn " << it->first << " " << it->second << " ref " << it->second->ref << dendl; @@ -552,9 +552,7 @@ void Client::dump_cache(Formatter *f) dump_inode(f, root.get(), did, true); // make a second pass to catch anything disconnected - for (ceph::unordered_map::iterator it = inode_map.begin(); - it != inode_map.end(); - ++it) { + for (auto it = inode_map.begin(); it != inode_map.end(); ++it) { if (did.count(it->second)) continue; dump_inode(f, it->second, did, true); @@ -1876,7 +1874,7 @@ int Client::verify_reply_trace(int r, MetaSession *session, bufferlist extra_bl; inodeno_t created_ino; bool got_created_ino = false; - ceph::unordered_map::iterator p; + std::unordered_map::iterator p; extra_bl = reply->get_extra_bl(); if (extra_bl.length() >= 8) { @@ -2858,9 +2856,7 @@ void Client::_handle_full_flag(int64_t pool) // field with -ENOSPC as long as we're sure all the ops we cancelled were // affecting this pool, and all the objectsets we're purging were also // in this pool. - for (unordered_map::iterator i = inode_map.begin(); - i != inode_map.end(); ++i) - { + for (auto i = inode_map.begin(); i != inode_map.end(); ++i) { Inode *inode = i->second; if (inode->oset.dirty_or_tx && (pool == -1 || inode->layout.pool_id == pool)) { @@ -3178,10 +3174,8 @@ void Client::send_reconnect(MetaSession *session) bool allow_multi = session->mds_features.test(CEPHFS_FEATURE_MULTI_RECONNECT); // i have an open session. - ceph::unordered_set did_snaprealm; - for (ceph::unordered_map::iterator p = inode_map.begin(); - p != inode_map.end(); - ++p) { + std::unordered_set did_snaprealm; + for (auto p = inode_map.begin(); p != inode_map.end(); ++p) { Inode *in = p->second; auto it = in->caps.find(mds); if (it != in->caps.end()) { @@ -4726,7 +4720,7 @@ void Client::_invalidate_kernel_dcache() if (can_invalidate_dentries) { if (dentry_invalidate_cb && root->dir) { - for (ceph::unordered_map::iterator p = root->dir->dentries.begin(); + for (auto p = root->dir->dentries.begin(); p != root->dir->dentries.end(); ++p) { if (p->second->inode) @@ -10208,7 +10202,7 @@ int Client::_lookup_vino(vinodeno_t vino, const UserPerm& perms, Inode **inode) int r = make_request(req, perms, NULL, NULL, rand() % mdsmap->get_num_in_mds()); if (r == 0 && inode != NULL) { - unordered_map::iterator p = inode_map.find(vino); + auto p = inode_map.find(vino); ceph_assert(p != inode_map.end()); *inode = p->second; _ll_get(*inode); @@ -13244,7 +13238,7 @@ int Client::ll_lookup_vino( ldout(cct, 3) << __func__ << " " << vino << dendl; // Check the cache first - unordered_map::iterator p = inode_map.find(vino); + auto p = inode_map.find(vino); if (p != inode_map.end()) { *inode = p->second; _ll_get(*inode); @@ -13400,10 +13394,8 @@ void Client::_ll_drop_pins() { ldout(cct, 10) << __func__ << dendl; std::set to_be_put; //this set will be deconstructed item by item when exit - ceph::unordered_map::iterator next; - for (ceph::unordered_map::iterator it = inode_map.begin(); - it != inode_map.end(); - it = next) { + std::unordered_map::iterator next; + for (auto it = inode_map.begin(); it != inode_map.end(); it = next) { Inode *in = it->second; next = it; ++next; @@ -13480,7 +13472,7 @@ Inode *Client::ll_get_inode(ino_t ino) std::scoped_lock lock(client_lock); vinodeno_t vino = _map_faked_ino(ino); - unordered_map::iterator p = inode_map.find(vino); + auto p = inode_map.find(vino); if (p == inode_map.end()) return NULL; Inode *in = p->second; @@ -13499,7 +13491,7 @@ Inode *Client::ll_get_inode(vinodeno_t vino) std::scoped_lock lock(client_lock); - unordered_map::iterator p = inode_map.find(vino); + auto p = inode_map.find(vino); if (p == inode_map.end()) return NULL; Inode *in = p->second; diff --git a/src/client/Client.h b/src/client/Client.h index 0b96be0c6aa..a3364b5327e 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -28,8 +28,6 @@ #include "include/interval_set.h" #include "include/lru.h" #include "include/types.h" -#include "include/unordered_map.h" -#include "include/unordered_set.h" #include "include/cephfs/metrics/Types.h" #include "mds/mdstypes.h" #include "mds/MDSAuthCaps.h" @@ -50,6 +48,8 @@ #include #include #include +#include +#include using std::set; using std::map; @@ -1876,16 +1876,16 @@ private: // file handles, etc. interval_set free_fd_set; // unused fds - ceph::unordered_map fd_map; + std::unordered_map fd_map; set ll_unclosed_fh_set; - ceph::unordered_set opened_dirs; + std::unordered_set opened_dirs; uint64_t fd_gen = 1; bool mount_aborted = false; bool blocklisted = false; - ceph::unordered_map inode_map; - ceph::unordered_map faked_ino_map; + std::unordered_map inode_map; + std::unordered_map faked_ino_map; interval_set free_faked_inos; ino_t last_used_faked_ino; ino_t last_used_faked_root; @@ -1903,7 +1903,7 @@ private: xlist delayed_list; int num_flushing_caps = 0; - ceph::unordered_map snap_realms; + std::unordered_map snap_realms; std::map metadata; ceph::coarse_mono_time last_auto_reconnect; diff --git a/src/client/Dir.h b/src/client/Dir.h index f98782e4392..80eeafbbf4c 100644 --- a/src/client/Dir.h +++ b/src/client/Dir.h @@ -2,6 +2,7 @@ #define CEPH_CLIENT_DIR_H #include +#include #include class Dentry; @@ -10,7 +11,7 @@ struct Inode; class Dir { public: Inode *parent_inode; // my inode - ceph::unordered_map dentries; + std::unordered_map dentries; unsigned num_null_dentries = 0; std::vector readdir_cache; diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 6b315d2dee3..1160b2dd7de 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -16,6 +16,7 @@ #include #include +#include #include "common/config.h" @@ -1014,12 +1015,12 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) utime_t start = ceph_clock_now(); - ceph::unordered_map open_files; - ceph::unordered_map open_dirs; + std::unordered_map open_files; + std::unordered_map open_dirs; - ceph::unordered_map ll_files; - ceph::unordered_map ll_dirs; - ceph::unordered_map ll_inos; + std::unordered_map ll_files; + std::unordered_map ll_dirs; + std::unordered_map ll_inos; Inode *i1, *i2; @@ -1514,27 +1515,19 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) dout(10) << "trace finished on line " << t.get_line() << dendl; // close open files - for (ceph::unordered_map::iterator fi = open_files.begin(); - fi != open_files.end(); - ++fi) { + for (auto fi = open_files.begin(); fi != open_files.end(); ++fi) { dout(1) << "leftover close " << fi->second << dendl; if (fi->second > 0) client->close(fi->second); } - for (ceph::unordered_map::iterator fi = open_dirs.begin(); - fi != open_dirs.end(); - ++fi) { + for (auto fi = open_dirs.begin(); fi != open_dirs.end(); ++fi) { dout(1) << "leftover closedir " << fi->second << dendl; if (fi->second != 0) client->closedir(fi->second); } - for (ceph::unordered_map::iterator fi = ll_files.begin(); - fi != ll_files.end(); - ++fi) { + for (auto fi = ll_files.begin(); fi != ll_files.end(); ++fi) { dout(1) << "leftover ll_release " << fi->second << dendl; if (fi->second) client->ll_release(fi->second); } - for (ceph::unordered_map::iterator fi = ll_dirs.begin(); - fi != ll_dirs.end(); - ++fi) { + for (auto fi = ll_dirs.begin(); fi != ll_dirs.end(); ++fi) { dout(1) << "leftover ll_releasedir " << fi->second << dendl; if (fi->second) client->ll_releasedir(fi->second); } @@ -1594,8 +1587,8 @@ int SyntheticClient::full_walk(string& basedir) frag_info_t empty; statq.push_back(empty); - ceph::unordered_map nlink; - ceph::unordered_map nlink_seen; + std::unordered_map nlink; + std::unordered_map nlink_seen; UserPerm perms = client->pick_my_perms(); while (!dirq.empty()) { @@ -1674,7 +1667,7 @@ int SyntheticClient::full_walk(string& basedir) } } - for (ceph::unordered_map::iterator p = nlink.begin(); p != nlink.end(); ++p) { + for (auto p = nlink.begin(); p != nlink.end(); ++p) { if (nlink_seen[p->first] != p->second) dout(0) << p->first << " nlink " << p->second << " != " << nlink_seen[p->first] << "seen" << dendl; } diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 1b86af94965..de6422c7c50 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -46,6 +46,8 @@ #include "fuse_ll.h" #include +#include + #define dout_context g_ceph_context #define FINO_INO(x) ((x) & ((1ull<<48)-1ull)) @@ -77,14 +79,14 @@ * reserved for CEPH_SNAPDIR. */ struct ceph_fuse_fake_inode_stag { - ceph::unordered_map snap_stag_map; // - ceph::unordered_map stag_snap_map; // + std::unordered_map snap_stag_map; // + std::unordered_map stag_snap_map; // int last_stag = 1; }; using namespace std; -static const ceph::unordered_map cephfs_errno_to_system_errno = { +static const std::unordered_map cephfs_errno_to_system_errno = { {EBLOCKLISTED, ESHUTDOWN}, {EPERM, EPERM}, {ESTALE, ESTALE}, @@ -182,7 +184,7 @@ public: ceph::mutex stag_lock = ceph::make_mutex("fuse_ll.cc stag_lock"); // a map of - ceph::unordered_map g_fino_maps; + std::unordered_map g_fino_maps; pthread_key_t fuse_req_key = 0; void set_fuse_req(fuse_req_t); diff --git a/src/cls/2pc_queue/cls_2pc_queue_types.h b/src/cls/2pc_queue/cls_2pc_queue_types.h index 093b69cb193..17c19b6ab0d 100644 --- a/src/cls/2pc_queue/cls_2pc_queue_types.h +++ b/src/cls/2pc_queue/cls_2pc_queue_types.h @@ -4,6 +4,8 @@ #include "include/types.h" +#include + struct cls_2pc_reservation { using id_t = uint32_t; @@ -50,7 +52,7 @@ struct cls_2pc_reservation }; WRITE_CLASS_ENCODER(cls_2pc_reservation) -using cls_2pc_reservations = ceph::unordered_map; +using cls_2pc_reservations = std::unordered_map; struct cls_2pc_urgent_data { diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index 08e2eca1c6a..2b77f77e01f 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -18,7 +18,6 @@ #include #include "include/types.h" // for version_t -#include "include/unordered_set.h" #include "include/utime.h" #include "include/utime_fmt.h" #include "msg/msg_fmt.h" @@ -32,6 +31,7 @@ #include #include #include +#include namespace ceph { class Formatter; @@ -161,7 +161,7 @@ struct LogSummary { // channel -> [(seq#, entry), ...] std::map>> tail_by_channel; uint64_t seq = 0; - ceph::unordered_set keys; + std::unordered_set keys; // ---- quincy+ ---- LRUSet recent_keys; diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index cc3695e46c2..f30dc08e6d1 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -31,7 +31,6 @@ struct ThreadPool { #include #include "common/ceph_mutex.h" -#include "include/unordered_map.h" #include "common/config_obs.h" #include "common/HeartbeatMap.h" #include "common/Thread.h" @@ -556,8 +555,7 @@ protected: int result = 0; { std::lock_guard locker(m_lock); - ceph::unordered_map::iterator it = - m_context_results.find(ctx); + auto it = m_context_results.find(ctx); if (it != m_context_results.end()) { result = it->second; m_context_results.erase(it); @@ -567,7 +565,7 @@ protected: } private: ceph::mutex m_lock = ceph::make_mutex("ContextWQ::m_lock"); - ceph::unordered_map m_context_results; + std::unordered_map m_context_results; }; class ShardedThreadPool { diff --git a/src/common/lockdep.cc b/src/common/lockdep.cc index 55e2f5e3f0d..81c1f776096 100644 --- a/src/common/lockdep.cc +++ b/src/common/lockdep.cc @@ -16,13 +16,13 @@ #include "common/ceph_context.h" #include "common/dout.h" #include "common/valgrind.h" -#include "include/unordered_map.h" #include // for std::for_each() #include #include #include #include +#include /******* Constants **********/ #define lockdep_dout(v) lsubdout(g_lockdep_ceph_ctx, lockdep, v) @@ -41,12 +41,12 @@ struct lockdep_stopper_t { static pthread_mutex_t lockdep_mutex = PTHREAD_MUTEX_INITIALIZER; static CephContext *g_lockdep_ceph_ctx = NULL; static lockdep_stopper_t lockdep_stopper; -static ceph::unordered_map lock_ids; +static std::unordered_map lock_ids; static std::map lock_names; static std::map lock_refs; static constexpr size_t MAX_LOCKS = 128 * 1024; // increase me as needed static std::bitset free_ids; // bit set = free -static ceph::unordered_map > held; +static std::unordered_map> held; static constexpr size_t NR_LOCKS = 4096; // the initial number of locks static std::vector> follows(NR_LOCKS); // follows[a][b] means b taken after a static std::vector> follows_bt(NR_LOCKS); @@ -165,7 +165,7 @@ static int _lockdep_register(const char *name) if (!g_lockdep) return id; - ceph::unordered_map::iterator p = lock_ids.find(name); + auto p = lock_ids.find(name); if (p == lock_ids.end()) { id = lockdep_get_free_id(); if (id < 0) { diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index 2735692dcc8..f20a930f6ab 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -25,7 +25,8 @@ #include "common/ceph_mutex.h" #include "common/ceph_context.h" #include "common/dout.h" -#include "include/unordered_map.h" + +#include template class SharedLRU { @@ -46,7 +47,7 @@ public: private: using C = std::less; using H = std::hash; - ceph::unordered_map >::iterator, H> contents; + std::unordered_map>::iterator, H> contents; std::list > lru; std::map, C> weak_refs; diff --git a/src/common/win32/errno.cc b/src/common/win32/errno.cc index 022f4c4f61c..b7fdf806799 100644 --- a/src/common/win32/errno.cc +++ b/src/common/win32/errno.cc @@ -24,7 +24,8 @@ #include "include/int_types.h" #include "include/types.h" #include "include/fs_types.h" -#include "include/unordered_map.h" + +#include // We're only converting errors defined in errno.h, not standard Windows // system error codes that are usually retrievied using GetLastErrorCode(). @@ -602,4 +603,4 @@ std::string win32_lasterror_str() { DWORD err = ::GetLastError(); return win32_strerror(err); -} \ No newline at end of file +} diff --git a/src/include/encoding.h b/src/include/encoding.h index d970d28b994..d5fcf77d660 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -23,12 +23,13 @@ #include #include #include +#include +#include + #include #include #include -#include "include/unordered_map.h" -#include "include/unordered_set.h" #include "common/ceph_time.h" #include "include/int_types.h" @@ -586,16 +587,16 @@ inline void encode(const std::multimap& m, bufferlist& bl); template inline void decode(std::multimap& m, bufferlist::const_iterator& p); template -inline void encode(const unordered_map& m, bufferlist& bl, +inline void encode(const std::unordered_map& m, bufferlist& bl, uint64_t features); template -inline void encode(const unordered_map& m, bufferlist& bl); +inline void encode(const std::unordered_map& m, bufferlist& bl); template -inline void decode(unordered_map& m, bufferlist::const_iterator& p); +inline void decode(std::unordered_map& m, bufferlist::const_iterator& p); template -inline void encode(const ceph::unordered_set& m, bufferlist& bl); +inline void encode(const std::unordered_set& m, bufferlist& bl); template -inline void decode(ceph::unordered_set& m, bufferlist::const_iterator& p); +inline void decode(std::unordered_set& m, bufferlist::const_iterator& p); template inline void encode(const std::deque& ls, bufferlist& bl, uint64_t features); template @@ -1299,9 +1300,9 @@ inline void decode(std::multimap& m, bufferlist::const_iterator& } } -// ceph::unordered_map +// std::unordered_map template -inline void encode(const unordered_map& m, bufferlist& bl, +inline void encode(const std::unordered_map& m, bufferlist& bl, uint64_t features) { __u32 n = (__u32)(m.size()); @@ -1312,7 +1313,7 @@ inline void encode(const unordered_map& m, bufferlist& bl, } } template -inline void encode(const unordered_map& m, bufferlist& bl) +inline void encode(const std::unordered_map& m, bufferlist& bl) { __u32 n = (__u32)(m.size()); encode(n, bl); @@ -1322,7 +1323,7 @@ inline void encode(const unordered_map& m, bufferlist& bl) } } template -inline void decode(unordered_map& m, bufferlist::const_iterator& p) +inline void decode(std::unordered_map& m, bufferlist::const_iterator& p) { __u32 n; decode(n, p); @@ -1335,7 +1336,7 @@ inline void decode(unordered_map& m, bufferlist::const_iter } template -inline void decode(unordered_map& m, bufferlist::const_iterator& p) +inline void decode(std::unordered_map& m, bufferlist::const_iterator& p) { __u32 n; decode(n, p); @@ -1349,9 +1350,9 @@ inline void decode(unordered_map& m, bufferlist::const_ } } -// ceph::unordered_set +// std::unordered_set template -inline void encode(const ceph::unordered_set& m, bufferlist& bl) +inline void encode(const std::unordered_set& m, bufferlist& bl) { __u32 n = (__u32)(m.size()); encode(n, bl); @@ -1359,7 +1360,7 @@ inline void encode(const ceph::unordered_set& m, bufferlist& encode(*p, bl); } template -inline void decode(ceph::unordered_set& m, bufferlist::const_iterator& p) +inline void decode(std::unordered_set& m, bufferlist::const_iterator& p) { __u32 n; decode(n, p); diff --git a/src/include/object.h b/src/include/object.h index 4e6001d09e6..211bd1d2237 100644 --- a/src/include/object.h +++ b/src/include/object.h @@ -27,7 +27,6 @@ #include #include "include/rados.h" -#include "include/unordered_map.h" #include "common/Formatter.h" #include "hash.h" diff --git a/src/include/types.h b/src/include/types.h index 25ce11190cc..d818e7426a0 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -46,9 +46,6 @@ extern "C" { #include #include - -#include "include/unordered_map.h" - #include "object.h" #include "intarith.h" @@ -296,8 +293,8 @@ inline std::ostream& operator<<(std::ostream& out, const boost::container::flat_ /* * comparators for stl containers */ -// for ceph::unordered_map: -// ceph::unordered_map, eqstr> vals; +// for std::unordered_map: +// std::unordered_map, eqstr> vals; struct eqstr { bool operator()(const char* s1, const char* s2) const diff --git a/src/include/unordered_map.h b/src/include/unordered_map.h deleted file mode 100644 index aee5f5a7639..00000000000 --- a/src/include/unordered_map.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CEPH_UNORDERED_MAP_H -#define CEPH_UNORDERED_MAP_H - -#include - -namespace ceph { - using std::unordered_map; - using std::unordered_multimap; -} - -#endif diff --git a/src/include/unordered_set.h b/src/include/unordered_set.h deleted file mode 100644 index e30e1799e5c..00000000000 --- a/src/include/unordered_set.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CEPH_UNORDERED_SET_H -#define CEPH_UNORDERED_SET_H - -#include - -namespace ceph { - using std::unordered_set; -} - -#endif diff --git a/src/librbd/cache/ObjectCacherWriteback.h b/src/librbd/cache/ObjectCacherWriteback.h index 169204c1385..ad924660544 100644 --- a/src/librbd/cache/ObjectCacherWriteback.h +++ b/src/librbd/cache/ObjectCacherWriteback.h @@ -5,10 +5,11 @@ #define CEPH_LIBRBD_CACHE_OBJECT_CACHER_WRITEBACK_H #include "common/snap_types.h" -#include "include/unordered_map.h" #include "osd/osd_types.h" #include "osdc/WritebackHandler.h" + #include +#include class Context; @@ -69,7 +70,7 @@ private: ceph_tid_t m_tid; ceph::mutex& m_lock; librbd::ImageCtx *m_ictx; - ceph::unordered_map > m_writes; + std::unordered_map> m_writes; friend class C_OrderedWrite; }; diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h index 04427ad8be8..6e1797de464 100644 --- a/src/mds/LogSegment.h +++ b/src/mds/LogSegment.h @@ -24,9 +24,7 @@ #include "CDentry.h" #include "CDir.h" -#include "include/unordered_set.h" - -using ceph::unordered_set; +#include class CDir; class CInode; @@ -87,7 +85,7 @@ class LogSegment { interval_set purging_inodes; MDSContext* purged_cb = nullptr; - std::map > pending_commit_tids; // mdstable + std::map> pending_commit_tids; // mdstable std::set uncommitted_leaders; std::set uncommitted_peers; std::set uncommitted_fragments; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 1b4c7ad3992..5e2af9c2659 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "common/DecayCounter.h" #include "common/MemoryModel.h" @@ -1293,7 +1294,7 @@ private: void repair_dirfrag_stats_work(const MDRequestRef& mdr); void rdlock_dirfrags_stats_work(const MDRequestRef& mdr); - ceph::unordered_map inode_map; // map of head inodes by ino + std::unordered_map inode_map; // map of head 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 @@ -1315,7 +1316,7 @@ private: std::map > > projected_subtree_renames; // renamed ino -> target dir // -- requests -- - ceph::unordered_map active_requests; + std::unordered_map active_requests; // -- recovery -- std::set recovery_set; diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index adf5c53d06b..7872733339d 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -16,6 +16,7 @@ #define CEPH_MDS_MUTATION_H #include +#include #include "include/interval_set.h" #include "include/elist.h" @@ -249,7 +250,7 @@ public: // flag mutation as peer mds_rank_t peer_to_mds = MDS_RANK_NONE; // this is a peer request if >= 0. - ceph::unordered_map object_states; + std::unordered_map object_states; int num_pins = 0; int num_auth_pins = 0; int num_remote_auth_pins = 0; diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 0443038813f..cc84a1866ef 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -1156,7 +1156,7 @@ void ScrubStack::handle_scrub_stats(const cref_t &m) bool any_finished = false; bool any_repaired = false; std::set scrubbing_tags; - std::unordered_map>> uninline_failed_meta_info; + std::unordered_map>> uninline_failed_meta_info; std::unordered_map<_inodeno_t, std::string> paths; std::unordered_map> counters; diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index f1d7b9d1f0e..b9d4ef8e08f 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -81,9 +81,7 @@ void SessionMap::register_perfcounters() void SessionMap::dump() { dout(10) << "dump" << dendl; - for (ceph::unordered_map::iterator p = session_map.begin(); - p != session_map.end(); - ++p) + for (auto p = session_map.begin(); p != session_map.end(); ++p) dout(10) << p->first << " " << p->second << " state " << p->second->get_state_name() << " completed " << p->second->info.completed_requests @@ -256,8 +254,7 @@ void SessionMap::_load_finish( } else { // I/O is complete. Update `by_state` dout(10) << __func__ << ": omap load complete" << dendl; - for (ceph::unordered_map::iterator i = session_map.begin(); - i != session_map.end(); ++i) { + for (auto i = session_map.begin(); i != session_map.end(); ++i) { Session *s = i->second; auto by_state_entry = by_state.find(s->get_state()); if (by_state_entry == by_state.end()) @@ -349,8 +346,7 @@ void SessionMap::_load_legacy_finish(int r, bufferlist &bl) // Mark all sessions dirty, so that on next save() we will write // a complete OMAP version of the data loaded from the legacy format - for (ceph::unordered_map::iterator i = session_map.begin(); - i != session_map.end(); ++i) { + for (auto i = session_map.begin(); i != session_map.end(); ++i) { // Don't use mark_dirty because on this occasion we want to ignore the // keys_per_op limit and do one big write (upgrade must be atomic) dirty_sessions.insert(i->first); @@ -503,8 +499,7 @@ void SessionMap::decode_legacy(bufferlist::const_iterator &p) SessionMapStore::decode_legacy(p); // Update `by_state` - for (ceph::unordered_map::iterator i = session_map.begin(); - i != session_map.end(); ++i) { + for (auto i = session_map.begin(); i != session_map.end(); ++i) { Session *s = i->second; auto by_state_entry = by_state.find(s->get_state()); if (by_state_entry == by_state.end()) @@ -669,9 +664,7 @@ void SessionMap::wipe() void SessionMap::wipe_ino_prealloc() { - for (ceph::unordered_map::iterator p = session_map.begin(); - p != session_map.end(); - ++p) { + for (auto p = session_map.begin(); p != session_map.end(); ++p) { p->second->pending_prealloc_inos.clear(); p->second->free_prealloc_inos.clear(); p->second->delegated_inos.clear(); diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index bfe7dcd4895..d5d7bbe2b51 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -16,8 +16,7 @@ #define CEPH_MDS_SESSIONMAP_H #include - -#include "include/unordered_map.h" +#include #include "include/Context.h" #include "include/xlist.h" @@ -587,7 +586,7 @@ public: protected: version_t version = 0; - ceph::unordered_map session_map; + std::unordered_map session_map; PerfCounters *logger =nullptr; // total request load avg @@ -673,7 +672,7 @@ public: session_map_entry-> second : nullptr); } const Session* get_session(entity_name_t w) const { - ceph::unordered_map::const_iterator p = session_map.find(w); + auto p = session_map.find(w); if (p == session_map.end()) { return NULL; } else { diff --git a/src/mds/journal.cc b/src/mds/journal.cc index e5f679b3343..e4a738ee378 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -319,14 +319,12 @@ void LogSegment::try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int o touched_sessions.clear(); // pending commit atids - for (map >::iterator p = pending_commit_tids.begin(); + for (auto p = pending_commit_tids.begin(); p != pending_commit_tids.end(); ++p) { MDSTableClient *client = mds->get_table_client(p->first); ceph_assert(client); - for (ceph::unordered_set::iterator q = p->second.begin(); - q != p->second.end(); - ++q) { + for (auto q = p->second.begin(); q != p->second.end(); ++q) { dout(10) << "try_to_expire " << get_mdstable_name(p->first) << " transaction " << *q << " pending commit (not yet acked), waiting" << dendl; ceph_assert(!client->has_committed(*q)); diff --git a/src/mgr/DaemonServer.h b/src/mgr/DaemonServer.h index beb396115f3..1da225ffb7e 100644 --- a/src/mgr/DaemonServer.h +++ b/src/mgr/DaemonServer.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "common/ceph_mutex.h" #include "common/LogClient.h" @@ -149,7 +150,7 @@ protected: std::set daemon_connections; /// connections for osds - ceph::unordered_map> osd_cons; + std::unordered_map> osd_cons; ServiceMap pending_service_map; // uncommitted diff --git a/src/mon/LogMonitor.h b/src/mon/LogMonitor.h index e9858523a73..7afd8cc5c46 100644 --- a/src/mon/LogMonitor.h +++ b/src/mon/LogMonitor.h @@ -44,7 +44,7 @@ class LogMonitor : public PaxosService, public md_config_obs_t { private: std::multimap pending_log; - unordered_set pending_keys; + std::unordered_set pending_keys; LogSummary summary; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a97f81c36b5..1ee81ce0114 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5224,9 +5224,7 @@ void OSDMonitor::tick() } // expire blocklisted items? - for (ceph::unordered_map::iterator p = osdmap.blocklist.begin(); - p != osdmap.blocklist.end(); - ++p) { + for (auto p = osdmap.blocklist.begin(); p != osdmap.blocklist.end(); ++p) { if (p->second < now) { dout(10) << "expiring blocklist item " << p->first << " expired " << p->second << " < now " << now << dendl; pending_inc.old_blocklist.push_back(p->first); @@ -5992,9 +5990,7 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) if (f) f->open_array_section("blocklist"); - for (ceph::unordered_map::iterator p = osdmap.blocklist.begin(); - p != osdmap.blocklist.end(); - ++p) { + for (auto p = osdmap.blocklist.begin(); p != osdmap.blocklist.end(); ++p) { if (f) { f->open_object_section("entry"); f->dump_string("addr", p->first.get_legacy_str()); diff --git a/src/msg/async/AsyncMessenger.h b/src/msg/async/AsyncMessenger.h index 0a3227dec5d..69909e8f411 100644 --- a/src/msg/async/AsyncMessenger.h +++ b/src/msg/async/AsyncMessenger.h @@ -19,12 +19,11 @@ #include #include +#include #include "include/types.h" #include "include/xlist.h" #include "include/spinlock.h" -#include "include/unordered_map.h" -#include "include/unordered_set.h" #include "common/ceph_mutex.h" #include "common/Cond.h" @@ -271,7 +270,7 @@ private: * NOTE: a Asyncconnection* with state CLOSED may still be in the map but is considered * invalid and can be replaced by anyone holding the msgr lock */ - ceph::unordered_map conns; + std::unordered_map conns; /** * list of connection are in the process of accepting diff --git a/src/msg/async/rdma/RDMAStack.h b/src/msg/async/rdma/RDMAStack.h index a36fd5fb7f9..3569765050c 100644 --- a/src/msg/async/rdma/RDMAStack.h +++ b/src/msg/async/rdma/RDMAStack.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "common/ceph_context.h" #include "common/debug.h" @@ -61,7 +62,7 @@ class RDMADispatcher { * * @param qp The qp needed to dead */ - ceph::unordered_map > qp_conns; + std::unordered_map > qp_conns; /// if a queue pair is closed when transmit buffers are active /// on it, the transmit buffers never get returned via tx_cq. To diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ba1e0aa4c25..6f65e2045cf 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2077,7 +2077,7 @@ BlueStore::OnodeRef BlueStore::OnodeSpace::lookup(const ghobject_t& oid) { std::lock_guard l(cache->lock); - ceph::unordered_map::iterator p = onode_map.find(oid); + auto p = onode_map.find(oid); if (p == onode_map.end()) { ldout(cache->cct, 30) << __func__ << " " << oid << " miss" << dendl; cache->logger->inc(l_bluestore_onode_misses); @@ -2122,9 +2122,8 @@ void BlueStore::OnodeSpace::rename( std::lock_guard l(cache->lock); ldout(cache->cct, 30) << __func__ << " " << old_oid << " -> " << new_oid << dendl; - ceph::unordered_map::iterator po, pn; - po = onode_map.find(old_oid); - pn = onode_map.find(new_oid); + auto po = onode_map.find(old_oid); + auto pn = onode_map.find(new_oid); ceph_assert(po != pn); ceph_assert(po != onode_map.end()); @@ -12147,7 +12146,7 @@ void BlueStore::_check_no_per_pg_or_pool_omap_alert() BlueStore::CollectionRef BlueStore::_get_collection(const coll_t& cid) { std::shared_lock l(coll_lock); - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -13261,9 +13260,7 @@ int BlueStore::list_collections(vector& ls) { std::shared_lock l(coll_lock); ls.reserve(coll_map.size()); - for (ceph::unordered_map::iterator p = coll_map.begin(); - p != coll_map.end(); - ++p) + for (auto p = coll_map.begin(); p != coll_map.end(); ++p) ls.push_back(p->first); return 0; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index cb8b1426971..33b057e7eaa 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -27,6 +27,7 @@ #include #include #include // for std::shared_lock +#include #include #include @@ -42,7 +43,6 @@ #include "include/ceph_assert.h" #include "include/interval_set.h" -#include "include/unordered_map.h" #include "include/mempool.h" #include "include/hash.h" #include "common/bloom_filter.hpp" diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index a069d429155..93c268884da 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -409,7 +409,7 @@ KStore::OnodeRef KStore::OnodeHashLRU::lookup(const ghobject_t& oid) { std::lock_guard l(lock); dout(30) << __func__ << dendl; - ceph::unordered_map::iterator p = onode_map.find(oid); + auto p = onode_map.find(oid); if (p == onode_map.end()) { dout(30) << __func__ << " " << oid << " miss" << dendl; return OnodeRef(); @@ -432,9 +432,8 @@ void KStore::OnodeHashLRU::rename(const ghobject_t& old_oid, { std::lock_guard l(lock); dout(30) << __func__ << " " << old_oid << " -> " << new_oid << dendl; - ceph::unordered_map::iterator po, pn; - po = onode_map.find(old_oid); - pn = onode_map.find(new_oid); + auto po = onode_map.find(old_oid); + auto pn = onode_map.find(new_oid); ceph_assert(po != onode_map.end()); if (pn != onode_map.end()) { @@ -466,14 +465,14 @@ bool KStore::OnodeHashLRU::get_next( if (lru.empty()) { return false; } - ceph::unordered_map::iterator p = onode_map.begin(); + auto p = onode_map.begin(); ceph_assert(p != onode_map.end()); next->first = p->first; next->second = p->second; return true; } - ceph::unordered_map::iterator p = onode_map.find(after); + auto p = onode_map.find(after); ceph_assert(p != onode_map.end()); // for now lru_list_t::iterator pi = lru.iterator_to(*p->second); ++pi; @@ -1090,7 +1089,7 @@ int KStore::pool_statfs(uint64_t pool_id, struct store_statfs_t *buf, KStore::CollectionRef KStore::_get_collection(coll_t cid) { std::shared_lock l{coll_lock}; - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -1386,9 +1385,7 @@ int KStore::getattrs( int KStore::list_collections(vector& ls) { std::shared_lock l{coll_lock}; - for (ceph::unordered_map::iterator p = coll_map.begin(); - p != coll_map.end(); - ++p) + for (auto p = coll_map.begin(); p != coll_map.end(); ++p) ls.push_back(p->first); return 0; } diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 05374e5ff8d..3aebd328df2 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -21,10 +21,10 @@ #include #include +#include #include #include "include/ceph_assert.h" -#include "include/unordered_map.h" #include "common/Finisher.h" #include "common/Throttle.h" #include "common/WorkQueue.h" @@ -115,7 +115,7 @@ public: &Onode::lru_item> > lru_list_t; std::mutex lock; - ceph::unordered_map onode_map; ///< forward lookups + std::unordered_map onode_map; ///< forward lookups lru_list_t lru; ///< lru OnodeHashLRU(CephContext* cct) : cct(cct) {} @@ -325,7 +325,7 @@ private: /// rwlock to protect coll_map ceph::shared_mutex coll_lock = ceph::make_shared_mutex("KStore::coll_lock"); - ceph::unordered_map coll_map; + std::unordered_map coll_map; std::map new_coll_map; std::mutex nid_lock; diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index f9d3bf0d8a2..01ca4c3fa51 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -23,7 +23,6 @@ #include "include/types.h" #include "include/stringify.h" -#include "include/unordered_map.h" #include "common/errno.h" #include "MemStore.h" #include "include/compat.h" @@ -248,7 +247,7 @@ objectstore_perf_stat_t MemStore::get_cur_stats() MemStore::CollectionRef MemStore::get_collection(const coll_t& cid) { std::shared_lock l{coll_lock}; - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -403,9 +402,7 @@ int MemStore::list_collections(std::vector& ls) { dout(10) << __func__ << dendl; std::shared_lock l{coll_lock}; - for (ceph::unordered_map::iterator p = coll_map.begin(); - p != coll_map.end(); - ++p) { + for (auto p = coll_map.begin(); p != coll_map.end(); ++p) { ls.push_back(p->first); } return 0; @@ -1373,7 +1370,7 @@ int MemStore::_destroy_collection(const coll_t& cid) { dout(10) << __func__ << " " << cid << dendl; std::lock_guard l{coll_lock}; - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return -ENOENT; { @@ -1502,7 +1499,7 @@ int MemStore::_merge_collection(const coll_t& cid, uint32_t bits, coll_t dest) { std::lock_guard l{coll_lock}; - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); ceph_assert(cp != coll_map.end()); used_bytes -= cp->second->used_bytes(); coll_map.erase(cp); diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 9621773598f..d9f04501b29 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -18,9 +18,10 @@ #include #include +#include + #include -#include "include/unordered_map.h" #include "common/Finisher.h" #include "common/RefCountedObj.h" #include "os/ObjectStore.h" @@ -93,7 +94,7 @@ public: int bits = 0; CephContext *cct; bool use_page_set; - ceph::unordered_map object_hash; ///< for lookup + std::unordered_map object_hash; ///< for lookup std::map object_map; ///< for iteration std::map xattr; /// for object_{map,hash} @@ -186,7 +187,7 @@ private: class OmapIteratorImpl; - ceph::unordered_map coll_map; + std::unordered_map coll_map; /// rwlock to protect coll_map ceph::shared_mutex coll_lock{ ceph::make_shared_mutex("MemStore::coll_lock")}; diff --git a/src/osd/HitSet.cc b/src/osd/HitSet.cc index 03475d36fba..1152faeec03 100644 --- a/src/osd/HitSet.cc +++ b/src/osd/HitSet.cc @@ -223,9 +223,7 @@ ostream& operator<<(ostream& out, const HitSet::Params& p) { void ExplicitHashHitSet::dump(Formatter *f) const { f->dump_unsigned("insert_count", count); f->open_array_section("hash_set"); - for (ceph::unordered_set::const_iterator p = hits.begin(); - p != hits.end(); - ++p) + for (auto p = hits.cbegin(); p != hits.cend(); ++p) f->dump_unsigned("hash", *p); f->close_section(); } @@ -233,9 +231,7 @@ void ExplicitHashHitSet::dump(Formatter *f) const { void ExplicitObjectHitSet::dump(Formatter *f) const { f->dump_unsigned("insert_count", count); f->open_array_section("set"); - for (ceph::unordered_set::const_iterator p = hits.begin(); - p != hits.end(); - ++p) { + for (auto p = hits.cbegin(); p != hits.cend(); ++p) { f->open_object_section("object"); p->dump(f); f->close_section(); diff --git a/src/osd/HitSet.h b/src/osd/HitSet.h index dedc45ed471..0972075df4d 100644 --- a/src/osd/HitSet.h +++ b/src/osd/HitSet.h @@ -16,11 +16,11 @@ #define CEPH_OSD_HITSET_H #include +#include #include #include "include/encoding.h" -#include "include/unordered_set.h" #include "common/bloom_filter.hpp" #include "common/hobject.h" @@ -180,7 +180,7 @@ std::ostream& operator<<(std::ostream& out, const HitSet::Params& p); */ class ExplicitHashHitSet : public HitSet::Impl { uint64_t count; - ceph::unordered_set hits; + std::unordered_set hits; public: class Params : public HitSet::Params::Impl { public: @@ -251,7 +251,7 @@ WRITE_CLASS_ENCODER(ExplicitHashHitSet) */ class ExplicitObjectHitSet : public HitSet::Impl { uint64_t count; - ceph::unordered_set hits; + std::unordered_set hits; public: class Params : public HitSet::Params::Impl { public: diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 0a4928fc20a..f338319699d 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -45,8 +45,7 @@ #include #include #include - -#include "include/unordered_map.h" +#include #include "common/intrusive_timer.h" #include "common/shared_cache.hpp" diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index b759a42290c..02813e22627 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -16,7 +16,6 @@ */ #include "PGLog.h" -#include "include/unordered_map.h" #include "common/ceph_context.h" using std::make_pair; diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 497805c1811..4f2a17b1778 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -22,6 +22,7 @@ #include "osd_types.h" #include "os/ObjectStore.h" #include +#include #ifdef WITH_SEASTAR #include @@ -146,10 +147,10 @@ public: * plus some methods to manipulate it all. */ struct IndexedLog : public pg_log_t { - mutable ceph::unordered_map objects; // ptrs into log. be careful! - mutable ceph::unordered_map caller_ops; - mutable ceph::unordered_multimap extra_caller_ops; - mutable ceph::unordered_map dup_index; + mutable std::unordered_map objects; // ptrs into log. be careful! + mutable std::unordered_map caller_ops; + mutable std::unordered_multimap extra_caller_ops; + mutable std::unordered_map dup_index; // recovery pointers std::list::iterator complete_to; // not inclusive of referenced item diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index e850f9a7cb0..7cf6d851e0e 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -11,6 +11,8 @@ #include "include/ceph_assert.h" +#include + #define MAX_FLUSH_UNDER_LOCK 20 ///< max bh's we start writeback on #define BUFFER_MEMORY_WEIGHT CEPH_PAGE_SHIFT // memory usage of BufferHead, count in (1< >::iterator i - = objects.begin(); + auto i = objects.begin(); while (i != objects.end()) { - ceph::unordered_map::iterator p = i->begin(); + auto p = i->begin(); while (p != i->end()) { - ceph::unordered_map::iterator n = p; + auto n = p; ++n; Object *ob = p->second; @@ -2603,14 +2604,8 @@ void ObjectCacher::verify_stats() const loff_t clean = 0, zero = 0, dirty = 0, rx = 0, tx = 0, missing = 0, error = 0; - for (vector >::const_iterator i - = objects.begin(); - i != objects.end(); - ++i) { - for (ceph::unordered_map::const_iterator p - = i->begin(); - p != i->end(); - ++p) { + for (auto i = objects.cbegin(); i != objects.cend(); ++i) { + for (auto p = i->cbegin(); p != i->cend(); ++p) { Object *ob = p->second; for (map::const_iterator q = ob->data.begin(); q != ob->data.end(); diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 68f796c3283..535b52ed8df 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -17,6 +17,8 @@ #include "Objecter.h" #include "Striper.h" +#include + class WritebackHandler; enum { @@ -418,7 +420,7 @@ class ObjectCacher { void *flush_set_callback_arg; // indexed by pool_id - std::vector > objects; + std::vector> objects; std::list waitfor_read; diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 14eeb73dac2..dcf6a74ea50 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -23,6 +23,8 @@ #include #include +#include + #define dout_subsys ceph_subsys_rgw_notification namespace rgw::notify { @@ -49,8 +51,8 @@ struct persistency_tracker { }; using queues_t = std::set; -using entries_persistency_tracker = ceph::unordered_map; -using queues_persistency_tracker = ceph::unordered_map; +using entries_persistency_tracker = std::unordered_map; +using queues_persistency_tracker = std::unordered_map; using rgw::persistent_topic_counters::CountersManager; // use mmap/mprotect to allocate 128k coroutine stacks diff --git a/src/test/immutable_object_cache/test_DomainSocket.cc b/src/test/immutable_object_cache/test_DomainSocket.cc index 98ef1722071..52c523f9008 100644 --- a/src/test/immutable_object_cache/test_DomainSocket.cc +++ b/src/test/immutable_object_cache/test_DomainSocket.cc @@ -2,11 +2,11 @@ // vim: ts=8 sw=2 smarttab #include +#include #include #include "gtest/gtest.h" #include "include/Context.h" -#include "include/unordered_set.h" #include "global/global_init.h" #include "global/global_context.h" @@ -14,7 +14,6 @@ #include "tools/immutable_object_cache/CacheClient.h" #include "tools/immutable_object_cache/CacheServer.h" -using ceph::unordered_set; using namespace ceph::immutable_obj_cache; class TestCommunication :public ::testing::Test { @@ -28,7 +27,7 @@ public: std::atomic m_send_request_index; std::atomic m_recv_ack_index; WaitEvent m_wait_event; - unordered_set m_hit_entry_set; + std::unordered_set m_hit_entry_set; TestCommunication() : m_cache_server(nullptr), m_cache_client(nullptr), diff --git a/src/test/objectstore/ObjectStoreImitator.cc b/src/test/objectstore/ObjectStoreImitator.cc index 14cc20c1622..1f5b2c657c7 100644 --- a/src/test/objectstore/ObjectStoreImitator.cc +++ b/src/test/objectstore/ObjectStoreImitator.cc @@ -318,7 +318,7 @@ int ObjectStoreImitator::queue_transactions(CollectionHandle &ch, ObjectStoreImitator::CollectionRef ObjectStoreImitator::_get_collection(const coll_t &cid) { std::shared_lock l(coll_lock); - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -939,7 +939,7 @@ int ObjectStoreImitator::_split_collection(CollectionRef &c, CollectionRef &d, ObjectStore::CollectionHandle ObjectStoreImitator::open_collection(const coll_t &cid) { std::shared_lock l(coll_lock); - ceph::unordered_map::iterator cp = coll_map.find(cid); + auto cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -996,9 +996,7 @@ int ObjectStoreImitator::set_collection_opts(CollectionHandle &ch, int ObjectStoreImitator::list_collections(std::vector &ls) { std::shared_lock l(coll_lock); ls.reserve(coll_map.size()); - for (ceph::unordered_map::iterator p = - coll_map.begin(); - p != coll_map.end(); ++p) + for (auto p = coll_map.begin(); p != coll_map.end(); ++p) ls.push_back(p->first); return 0; } diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 9c8368cbcc4..cde3a803bd2 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -45,7 +45,6 @@ #include "common/pretty_binary.h" #include "include/stringify.h" #include "include/coredumpctl.h" -#include "include/unordered_map.h" #include "os/kv.h" #include "store_test_fixture.h" diff --git a/src/test/xattr_bench.cc b/src/test/xattr_bench.cc index b117e16f26a..0fde5b0c886 100644 --- a/src/test/xattr_bench.cc +++ b/src/test/xattr_bench.cc @@ -30,8 +30,6 @@ #include #include -#include "include/unordered_map.h" - void usage(const string &name) { std::cerr << "Usage: " << name << " [xattr|omap] store_path" << std::endl; diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index b1e594d14f4..be75a326c82 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -20,11 +20,11 @@ #include "common/safe_io.h" #include "common/strtol.h" // for strict_strtoll() #include "crush/CrushWrapper.h" -#include "include/unordered_map.h" #include "include/random.h" #include "mon/health_check.h" #include #include +#include #include "global/global_init.h" #include "osd/OSDMap.h" @@ -890,7 +890,7 @@ skip_upmap: while (1) { cout << "pass " << ++pass << std::endl; - ceph::unordered_map > m; + std::unordered_map> m; for (map::const_iterator p = osdmap.get_pools().begin(); p != osdmap.get_pools().end(); ++p) { -- 2.39.5