From 4c4e1d0d470beba7690d1c0e39bfd1146a25f465 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Tue, 29 Oct 2013 07:46:24 -0700 Subject: [PATCH] libc++: use ceph:: namespaced data types Switches the implemetnation of smart pointers and unordered map/set to use the ceph:: versions. Signed-off-by: Noah Watkins --- fusetrace/fusetrace_ll.cc | 10 +-- src/client/Client.cc | 20 ++--- src/client/Client.h | 11 ++- src/client/Dir.h | 2 +- src/client/SyntheticClient.cc | 24 +++--- src/client/Trace.cc | 1 - src/client/fuse_ll.cc | 4 +- src/common/TrackedOp.h | 4 +- src/common/hobject.h | 10 +-- src/common/lockdep.cc | 15 ++-- src/common/map_cacher.hpp | 2 +- src/common/shared_cache.hpp | 4 +- src/common/sharedptr_registry.hpp | 4 +- src/include/Context.h | 4 +- src/include/encoding.h | 38 ++++----- src/include/object.h | 12 +-- src/include/types.h | 19 ++--- src/librbd/LibrbdWriteback.h | 2 +- src/mds/LogSegment.h | 6 +- src/mds/MDCache.cc | 26 +++--- src/mds/MDCache.h | 6 +- src/mds/SessionMap.cc | 8 +- src/mds/SessionMap.h | 9 +- src/mds/events/EMetaBlob.h | 14 ++-- src/mds/journal.cc | 16 ++-- src/mds/mdstypes.h | 13 +-- src/mon/DataHealthService.cc | 2 +- src/mon/LogMonitor.cc | 2 +- src/mon/Monitor.h | 2 +- src/mon/MonitorDBStore.h | 4 +- src/mon/OSDMonitor.cc | 12 +-- src/mon/PGMap.cc | 84 +++++++++---------- src/mon/PGMap.h | 22 ++--- src/mon/PGMonitor.cc | 38 ++++----- src/msg/Pipe.cc | 2 +- src/msg/SimpleMessenger.cc | 2 +- src/msg/SimpleMessenger.h | 9 +- src/msg/msg_types.h | 13 +-- src/os/CollectionIndex.h | 14 ++-- src/os/DBObjectMap.cc | 2 +- src/os/DBObjectMap.h | 10 +-- src/os/FDCache.h | 2 +- src/os/FileStore.h | 3 +- src/os/FlatIndex.cc | 2 +- src/os/FlatIndex.h | 6 +- src/os/HashIndex.cc | 2 +- src/os/HashIndex.h | 2 +- src/os/IndexManager.cc | 2 +- src/os/IndexManager.h | 6 +- src/os/KeyValueDB.h | 12 +-- src/os/LFNIndex.cc | 2 +- src/os/LFNIndex.h | 10 +-- src/os/LevelDBStore.cc | 2 +- src/os/LevelDBStore.h | 8 +- src/os/MemStore.cc | 20 +++-- src/os/MemStore.h | 15 ++-- src/os/ObjectMap.h | 4 +- src/os/ObjectStore.cc | 2 +- src/os/WBThrottle.h | 2 +- src/osd/ErasureCodeInterface.h | 4 +- src/osd/HitSet.h | 9 +- src/osd/OSD.cc | 24 +++--- src/osd/OSD.h | 15 ++-- src/osd/OSDMap.cc | 6 +- src/osd/OSDMap.h | 27 +++--- src/osd/OpRequest.h | 4 +- src/osd/PG.cc | 2 +- src/osd/PG.h | 11 ++- src/osd/PGLog.h | 6 +- src/osd/Watch.h | 18 ++-- src/osd/osd_types.h | 19 +++-- src/osdc/ObjectCacher.cc | 12 +-- src/osdc/ObjectCacher.h | 2 +- src/osdc/Objecter.h | 1 - src/rbd.cc | 4 +- src/rgw/rgw_bucket.h | 2 +- src/test/ObjectMap/KeyValueDBMemory.cc | 6 +- src/test/ObjectMap/KeyValueDBMemory.h | 2 +- .../ObjectMap/test_keyvaluedb_atomicity.cc | 2 +- .../ObjectMap/test_keyvaluedb_iterators.cc | 2 +- src/test/ObjectMap/test_object_map.cc | 2 +- src/test/bench/bencher.cc | 18 ++-- src/test/bench/bencher.h | 4 +- src/test/bench/rbd_backend.cc | 4 +- src/test/bench/rbd_backend.h | 4 +- src/test/bench/small_io_bench_fs.cc | 10 +-- src/test/bench/small_io_bench_rbd.cc | 4 +- src/test/bufferlist.cc | 6 +- src/test/confutils.cc | 4 +- src/test/filestore/store_test.cc | 3 +- src/test/os/TestFlatIndex.cc | 4 +- src/test/os/TestLFNIndex.cc | 2 +- src/test/osd/RadosModel.h | 15 ++-- src/test/osdc/object_cacher_stress.cc | 4 +- src/test/test_osd_types.cc | 16 ++-- src/test/test_snap_mapper.cc | 6 +- src/test/xattr_bench.cc | 2 +- src/tools/dupstore.cc | 5 +- src/tools/osdmaptool.cc | 2 +- 99 files changed, 446 insertions(+), 451 deletions(-) diff --git a/fusetrace/fusetrace_ll.cc b/fusetrace/fusetrace_ll.cc index 7f2b8438f1f7..a60a14ca6c18 100644 --- a/fusetrace/fusetrace_ll.cc +++ b/fusetrace/fusetrace_ll.cc @@ -33,18 +33,18 @@ #include -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" +#include "include/hash_namespace.h" #ifndef __LP64__ -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(uint64_t __x) const { static hash H; return H((__x >> 32) ^ (__x & 0xffffffff)); } }; -} +CEPH_HASH_NAMESPACE_END #endif @@ -89,7 +89,7 @@ struct Inode { }; Inode *root = 0; -hash_map inode_map; +ceph::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 db050b94d895..eadb4a0368bb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -226,7 +226,7 @@ Client::~Client() void Client::tear_down_cache() { // fd's - for (hash_map::iterator it = fd_map.begin(); + for (ceph::unordered_map::iterator it = fd_map.begin(); it != fd_map.end(); ++it) { Fh *fh = it->second; @@ -286,7 +286,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 (hash_map::iterator it = in->dir->dentries.begin(); + for (ceph::unordered_map::iterator 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; @@ -314,7 +314,7 @@ void Client::dump_cache(Formatter *f) dump_inode(f, root, did, true); // make a second pass to catch anything disconnected - for (hash_map::iterator it = inode_map.begin(); + for (ceph::unordered_map::iterator it = inode_map.begin(); it != inode_map.end(); ++it) { if (did.count(it->second)) @@ -1184,7 +1184,7 @@ int Client::verify_reply_trace(int r, bufferlist extra_bl; inodeno_t created_ino; bool got_created_ino = false; - hash_map::iterator p; + ceph::unordered_map::iterator p; extra_bl.claim(reply->get_extra_bl()); if (extra_bl.length() >= 8) { @@ -1958,8 +1958,8 @@ void Client::send_reconnect(MetaSession *session) MClientReconnect *m = new MClientReconnect; // i have an open session. - hash_set did_snaprealm; - for (hash_map::iterator p = inode_map.begin(); + ceph::unordered_set did_snaprealm; + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); ++p) { Inode *in = p->second; @@ -3859,8 +3859,8 @@ void Client::unmount() if (cct->_conf->client_oc) { // flush/release all buffered data - hash_map::iterator next; - for (hash_map::iterator p = inode_map.begin(); + ceph::unordered_map::iterator next; + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); p = next) { next = p; @@ -6655,8 +6655,8 @@ int Client::_ll_put(Inode *in, int num) void Client::_ll_drop_pins() { ldout(cct, 10) << "_ll_drop_pins" << dendl; - hash_map::iterator next; - for (hash_map::iterator it = inode_map.begin(); + ceph::unordered_map::iterator next; + for (ceph::unordered_map::iterator it = inode_map.begin(); it != inode_map.end(); it = next) { Inode *in = it->second; diff --git a/src/client/Client.h b/src/client/Client.h index 649bacc5ba69..e48c19f8cd11 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -27,8 +27,7 @@ using std::set; using std::map; using std::fstream; -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" #include "include/filepath.h" #include "include/interval_set.h" @@ -302,14 +301,14 @@ protected: WritebackHandler *writeback_handler; // cache - hash_map inode_map; + ceph::unordered_map inode_map; Inode* root; LRU lru; // lru list of Dentry's in our local metadata cache. // all inodes with caps sit on either cap_list or delayed_caps. xlist delayed_caps, cap_list; int num_flushing_caps; - hash_map snap_realms; + ceph::unordered_map snap_realms; SnapRealm *get_snap_realm(inodeno_t r); SnapRealm *get_snap_realm_maybe(inodeno_t r); @@ -324,7 +323,7 @@ protected: // file handles, etc. interval_set free_fd_set; // unused fds - hash_map fd_map; + ceph::unordered_map fd_map; int get_fd() { int fd = free_fd_set.range_start(); @@ -339,7 +338,7 @@ protected: * Resolve file descriptor, or return NULL. */ Fh *get_filehandle(int fd) { - hash_map::iterator p = fd_map.find(fd); + ceph::unordered_map::iterator p = fd_map.find(fd); if (p == fd_map.end()) return NULL; return p->second; diff --git a/src/client/Dir.h b/src/client/Dir.h index 7e05d375f2f5..f0029b1900cd 100644 --- a/src/client/Dir.h +++ b/src/client/Dir.h @@ -6,7 +6,7 @@ class Inode; class Dir { public: Inode *parent_inode; // my inode - hash_map dentries; + ceph::unordered_map dentries; map dentry_map; uint64_t release_count; uint64_t max_offset; diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 6b42f8eff1af..aac509cc9f6a 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -1014,12 +1014,12 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) utime_t start = ceph_clock_now(client->cct); - hash_map open_files; - hash_map open_dirs; + ceph::unordered_map open_files; + ceph::unordered_map open_dirs; - hash_map ll_files; - hash_map ll_dirs; - hash_map ll_inos; + ceph::unordered_map ll_files; + ceph::unordered_map ll_dirs; + ceph::unordered_map ll_inos; ll_inos[1] = 1; // root inode is known. @@ -1479,25 +1479,25 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) lock.Unlock(); // close open files - for (hash_map::iterator fi = open_files.begin(); + for (ceph::unordered_map::iterator 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 (hash_map::iterator fi = open_dirs.begin(); + for (ceph::unordered_map::iterator 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 (hash_map::iterator fi = ll_files.begin(); + for (ceph::unordered_map::iterator 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 (hash_map::iterator fi = ll_dirs.begin(); + for (ceph::unordered_map::iterator fi = ll_dirs.begin(); fi != ll_dirs.end(); ++fi) { dout(1) << "leftover ll_releasedir " << fi->second << dendl; @@ -1559,8 +1559,8 @@ int SyntheticClient::full_walk(string& basedir) memset(&empty, 0, sizeof(empty)); statq.push_back(empty); - hash_map nlink; - hash_map nlink_seen; + ceph::unordered_map nlink; + ceph::unordered_map nlink_seen; while (!dirq.empty()) { string dir = dirq.front(); @@ -1638,7 +1638,7 @@ int SyntheticClient::full_walk(string& basedir) } } - for (hash_map::iterator p = nlink.begin(); p != nlink.end(); ++p) { + for (ceph::unordered_map::iterator 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/Trace.cc b/src/client/Trace.cc index 61d34aa877f6..dbd9fce2c1ef 100644 --- a/src/client/Trace.cc +++ b/src/client/Trace.cc @@ -19,7 +19,6 @@ #include #include -using namespace __gnu_cxx; #include "common/Mutex.h" diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 88f727e454ee..7d1a37b20efc 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -81,8 +81,8 @@ public: Mutex stag_lock; int last_stag; - hash_map snap_stag_map; - hash_map stag_snap_map; + ceph::unordered_map snap_stag_map; + ceph::unordered_map stag_snap_map; }; diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index ef8a990bd3e9..99184821e2a3 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -20,10 +20,10 @@ #include "include/histogram.h" #include "include/xlist.h" #include "msg/Message.h" -#include +#include "include/memory.h" class TrackedOp; -typedef std::tr1::shared_ptr TrackedOpRef; +typedef ceph::shared_ptr TrackedOpRef; class OpTracker; class OpHistory { diff --git a/src/common/hobject.h b/src/common/hobject.h index 4081ceb8f852..776d2dbcb1ad 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -116,7 +116,7 @@ public: /* Do not use when a particular hash function is needed */ explicit hobject_t(const sobject_t &o) : oid(o.oid), snap(o.snap), max(false), pool(-1) { - hash = __gnu_cxx::hash()(o); + hash = CEPH_HASH_NAMESPACE::hash()(o); } // maximum sorted value. @@ -198,7 +198,7 @@ public: }; WRITE_CLASS_ENCODER(hobject_t) -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const hobject_t &r) const { static hash H; @@ -206,7 +206,7 @@ namespace __gnu_cxx { return H(r.oid) ^ I(r.snap); } }; -} +CEPH_HASH_NAMESPACE_END ostream& operator<<(ostream& out, const hobject_t& o); @@ -297,7 +297,7 @@ public: }; WRITE_CLASS_ENCODER(ghobject_t) -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const ghobject_t &r) const { static hash H; @@ -305,7 +305,7 @@ namespace __gnu_cxx { return H(r.hobj.oid) ^ I(r.hobj.snap); } }; -} +CEPH_HASH_NAMESPACE_END ostream& operator<<(ostream& out, const ghobject_t& o); diff --git a/src/common/lockdep.cc b/src/common/lockdep.cc index 7f34f801d1d5..5c2ee55abaad 100644 --- a/src/common/lockdep.cc +++ b/src/common/lockdep.cc @@ -18,10 +18,11 @@ #include "include/types.h" #include "lockdep.h" -#include +#include "include/unordered_map.h" +#include "include/hash_namespace.h" #if defined(__FreeBSD__) && defined(__LP64__) // On FreeBSD pthread_t is a pointer. -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { @@ -29,7 +30,7 @@ namespace __gnu_cxx { operator()(pthread_t __x) const { return (uintptr_t)__x; } }; -} +CEPH_HASH_NAMESPACE_END #endif /******* Constants **********/ @@ -50,10 +51,10 @@ 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 hash_map lock_ids; +static ceph::unordered_map lock_ids; static map lock_names; static int last_id = 0; -static hash_map > held; +static ceph::unordered_map > held; static BackTrace *follows[MAX_LOCKS][MAX_LOCKS]; // follows[a][b] means b taken after a /******* Functions **********/ @@ -79,7 +80,7 @@ int lockdep_dump_locks() { pthread_mutex_lock(&lockdep_mutex); - for (hash_map >::iterator p = held.begin(); + for (ceph::unordered_map >::iterator p = held.begin(); p != held.end(); ++p) { lockdep_dout(0) << "--- thread " << p->first << " ---" << dendl; @@ -109,7 +110,7 @@ int lockdep_register(const char *name) for (int j=0; j::iterator p = lock_ids.find(name); + ceph::unordered_map::iterator p = lock_ids.find(name); if (p == lock_ids.end()) { assert(last_id < MAX_LOCKS); id = last_id++; diff --git a/src/common/map_cacher.hpp b/src/common/map_cacher.hpp index 04c84cdb65af..da79e8237b6c 100644 --- a/src/common/map_cacher.hpp +++ b/src/common/map_cacher.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include "include/memory.h" #include #include #include diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index 178d1001be35..a435ec4558f6 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -24,8 +24,8 @@ template class SharedLRU { - typedef std::tr1::shared_ptr VPtr; - typedef std::tr1::weak_ptr WeakVPtr; + typedef ceph::shared_ptr VPtr; + typedef ceph::weak_ptr WeakVPtr; Mutex lock; size_t max_size; Cond cond; diff --git a/src/common/sharedptr_registry.hpp b/src/common/sharedptr_registry.hpp index 83396b8cc5f6..b8c26ce17739 100644 --- a/src/common/sharedptr_registry.hpp +++ b/src/common/sharedptr_registry.hpp @@ -27,8 +27,8 @@ template class SharedPtrRegistry { public: - typedef std::tr1::shared_ptr VPtr; - typedef std::tr1::weak_ptr WeakVPtr; + typedef ceph::shared_ptr VPtr; + typedef ceph::weak_ptr WeakVPtr; int waiting; private: Mutex lock; diff --git a/src/include/Context.h b/src/include/Context.h index 663313ceec17..38af84325aed 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -23,7 +23,7 @@ #include #include -#include +#include "include/memory.h" #define mydout(cct, v) lgeneric_subdout(cct, context, v) @@ -95,7 +95,7 @@ struct RunOnDelete { to_run->complete(0); } }; -typedef std::tr1::shared_ptr RunOnDeleteRef; +typedef ceph::shared_ptr RunOnDeleteRef; /* * finish and destroy a list of Contexts diff --git a/src/include/encoding.h b/src/include/encoding.h index 51af378c5661..76ef60c6e58d 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -16,7 +16,7 @@ #include "include/int_types.h" -#include +#include "include/memory.h" #include "byteorder.h" #include "buffer.h" @@ -290,8 +290,8 @@ inline void decode(T &o, bufferlist& bl) #ifndef _BACKWARD_BACKWARD_WARNING_H #define _BACKWARD_BACKWARD_WARNING_H // make gcc 4.3 shut up about hash_* #endif -#include -#include +#include "include/unordered_map.h" +#include "include/unordered_set.h" #include "triple.h" @@ -363,14 +363,14 @@ inline void decode(std::list& ls, bufferlist::iterator& p) } template -inline void encode(const std::list >& ls, bufferlist& bl) +inline void encode(const std::list >& ls, bufferlist& bl) { // should i pre- or post- count? if (!ls.empty()) { unsigned pos = bl.length(); unsigned n = 0; encode(n, bl); - for (typename std::list >::const_iterator p = ls.begin(); p != ls.end(); ++p) { + for (typename std::list >::const_iterator p = ls.begin(); p != ls.end(); ++p) { n++; encode(**p, bl); } @@ -380,18 +380,18 @@ inline void encode(const std::list >& ls, bufferlist& bl } else { __u32 n = ls.size(); // FIXME: this is slow on a list. encode(n, bl); - for (typename std::list >::const_iterator p = ls.begin(); p != ls.end(); ++p) + for (typename std::list >::const_iterator p = ls.begin(); p != ls.end(); ++p) encode(**p, bl); } } template -inline void decode(std::list >& ls, bufferlist::iterator& p) +inline void decode(std::list >& ls, bufferlist::iterator& p) { __u32 n; decode(n, p); ls.clear(); while (n--) { - std::tr1::shared_ptr v(new T); + ceph::shared_ptr v(new T); decode(*v, p); ls.push_back(v); } @@ -481,18 +481,18 @@ inline void decode_nohead(int len, std::vector& v, bufferlist::iterator& p) // vector (shared_ptr) template -inline void encode(const std::vector >& v, bufferlist& bl) +inline void encode(const std::vector >& v, bufferlist& bl) { __u32 n = v.size(); encode(n, bl); - for (typename std::vector >::const_iterator p = v.begin(); p != v.end(); ++p) + for (typename std::vector >::const_iterator p = v.begin(); p != v.end(); ++p) if (*p) encode(**p, bl); else encode(T(), bl); } template -inline void decode(std::vector >& v, bufferlist::iterator& p) +inline void decode(std::vector >& v, bufferlist::iterator& p) { __u32 n; decode(n, p); @@ -624,19 +624,19 @@ inline void decode(std::multimap& m, bufferlist::iterator& p) } } -// hash_map +// ceph::unordered_map template -inline void encode(const __gnu_cxx::hash_map& m, bufferlist& bl) +inline void encode(const unordered_map& m, bufferlist& bl) { __u32 n = m.size(); encode(n, bl); - for (typename __gnu_cxx::hash_map::const_iterator p = m.begin(); p != m.end(); ++p) { + for (typename unordered_map::const_iterator p = m.begin(); p != m.end(); ++p) { encode(p->first, bl); encode(p->second, bl); } } template -inline void decode(__gnu_cxx::hash_map& m, bufferlist::iterator& p) +inline void decode(unordered_map& m, bufferlist::iterator& p) { __u32 n; decode(n, p); @@ -648,17 +648,17 @@ inline void decode(__gnu_cxx::hash_map& m, bufferlist::iterator& p) } } -// hash_set +// ceph::unordered_set template -inline void encode(const __gnu_cxx::hash_set& m, bufferlist& bl) +inline void encode(const ceph::unordered_set& m, bufferlist& bl) { __u32 n = m.size(); encode(n, bl); - for (typename __gnu_cxx::hash_set::const_iterator p = m.begin(); p != m.end(); ++p) + for (typename ceph::unordered_set::const_iterator p = m.begin(); p != m.end(); ++p) encode(*p, bl); } template -inline void decode(__gnu_cxx::hash_set& m, bufferlist::iterator& p) +inline void decode(ceph::unordered_set& m, bufferlist::iterator& p) { __u32 n; decode(n, p); diff --git a/src/include/object.h b/src/include/object.h index f81683f70afe..d9fc27594dee 100644 --- a/src/include/object.h +++ b/src/include/object.h @@ -22,8 +22,8 @@ #include using namespace std; -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" +#include "include/hash_namespace.h" #include "hash.h" #include "encoding.h" @@ -78,7 +78,7 @@ inline ostream& operator<<(ostream& out, const object_t& o) { return out << o.name; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const object_t& r) const { //static hash H; @@ -86,7 +86,7 @@ namespace __gnu_cxx { return ceph_str_hash_linux(r.name.c_str(), r.name.length()); } }; -} +CEPH_HASH_NAMESPACE_END struct file_object_t { @@ -179,7 +179,7 @@ inline bool operator<=(const sobject_t &l, const sobject_t &r) { inline ostream& operator<<(ostream& out, const sobject_t &o) { return out << o.oid << "/" << o.snap; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const sobject_t &r) const { static hash H; @@ -187,6 +187,6 @@ namespace __gnu_cxx { return H(r.oid) ^ I(r.snap); } }; -} +CEPH_HASH_NAMESPACE_END #endif diff --git a/src/include/types.h b/src/include/types.h index 33304521f909..8467c80f3751 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -61,9 +61,8 @@ extern "C" { using namespace std; -#include -using namespace __gnu_cxx; - +#include "include/unordered_map.h" +#include "include/hash_namespace.h" #include "object.h" #include "intarith.h" @@ -87,7 +86,8 @@ typedef off_t off64_t; // -- stl crap -- -namespace __gnu_cxx { + +CEPH_HASH_NAMESPACE_START template<> struct hash< std::string > { size_t operator()( const std::string& x ) const @@ -111,8 +111,7 @@ namespace __gnu_cxx { } }; #endif - -} +CEPH_HASH_NAMESPACE_END @@ -211,8 +210,8 @@ inline ostream& operator<<(ostream& out, const multimap& m) /* * comparators for stl containers */ -// for hash_map: -// hash_map, eqstr> vals; +// for ceph::unordered_map: +// ceph::unordered_map, eqstr> vals; struct eqstr { bool operator()(const char* s1, const char* s2) const @@ -329,7 +328,7 @@ inline ostream& operator<<(ostream& out, inodeno_t ino) { return out << hex << ino.val << dec; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash< inodeno_t > { size_t operator()( const inodeno_t& x ) const @@ -338,7 +337,7 @@ namespace __gnu_cxx { return H(x.val); } }; -} +CEPH_HASH_NAMESPACE_END // file modes diff --git a/src/librbd/LibrbdWriteback.h b/src/librbd/LibrbdWriteback.h index 4f35aa4b0673..0967421e9e3c 100644 --- a/src/librbd/LibrbdWriteback.h +++ b/src/librbd/LibrbdWriteback.h @@ -55,7 +55,7 @@ namespace librbd { tid_t m_tid; Mutex& m_lock; librbd::ImageCtx *m_ictx; - hash_map > m_writes; + ceph::unordered_map > m_writes; friend class C_OrderedWrite; }; } diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h index 624c3bc2395e..c9fdfd7f4096 100644 --- a/src/mds/LogSegment.h +++ b/src/mds/LogSegment.h @@ -24,8 +24,8 @@ #include "CDentry.h" #include "CDir.h" -#include -using __gnu_cxx::hash_set; +#include "include/unordered_set.h" +using ceph::unordered_set; class CDir; class CInode; @@ -54,7 +54,7 @@ class LogSegment { set truncating_inodes; - map > pending_commit_tids; // mdstable + map > pending_commit_tids; // mdstable set uncommitted_masters; set uncommitted_fragments; diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index b12684364ba7..eb20c06085a0 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2503,7 +2503,7 @@ void MDCache::send_slave_resolves() } else { set resolve_set; mds->mdsmap->get_mds_set(resolve_set, MDSMap::STATE_RESOLVE); - for (hash_map::iterator p = active_requests.begin(); + for (ceph::unordered_map::iterator p = active_requests.begin(); p != active_requests.end(); ++p) { if (!p->second->is_slave() || !p->second->slave_did_prepare()) @@ -2657,7 +2657,7 @@ void MDCache::handle_mds_failure(int who) // clean up any requests slave to/from this node list finish; - for (hash_map::iterator p = active_requests.begin(); + for (ceph::unordered_map::iterator p = active_requests.begin(); p != active_requests.end(); ++p) { // slave to the failed node? @@ -3389,7 +3389,7 @@ void MDCache::trim_unlinked_inodes() { dout(7) << "trim_unlinked_inodes" << dendl; list q; - for (hash_map::iterator p = inode_map.begin(); + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); ++p) { CInode *in = p->second; @@ -3676,7 +3676,7 @@ void MDCache::rejoin_send_rejoins() if (!mds->is_rejoin()) { // i am survivor. send strong rejoin. // note request remote_auth_pins, xlocks - for (hash_map::iterator p = active_requests.begin(); + for (ceph::unordered_map::iterator p = active_requests.begin(); p != active_requests.end(); ++p) { if ( p->second->is_slave()) @@ -4263,7 +4263,7 @@ void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack, { dout(10) << "rejoin_scour_survivor_replicas from mds." << from << dendl; - for (hash_map::iterator p = inode_map.begin(); + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); ++p) { CInode *in = p->second; @@ -5172,7 +5172,7 @@ void MDCache::choose_lock_states_and_reconnect_caps() map splits; - for (hash_map::iterator i = inode_map.begin(); + for (ceph::unordered_map::iterator i = inode_map.begin(); i != inode_map.end(); ++i) { CInode *in = i->second; @@ -5727,7 +5727,7 @@ void MDCache::reissue_all_caps() { dout(10) << "reissue_all_caps" << dendl; - for (hash_map::iterator p = inode_map.begin(); + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); ++p) { CInode *in = p->second; @@ -5829,7 +5829,7 @@ void MDCache::unqueue_file_recover(CInode *in) void MDCache::identify_files_to_recover(vector& recover_q, vector& check_q) { dout(10) << "identify_files_to_recover" << dendl; - for (hash_map::iterator p = inode_map.begin(); + for (ceph::unordered_map::iterator p = inode_map.begin(); p != inode_map.end(); ++p) { CInode *in = p->second; @@ -6506,9 +6506,9 @@ void MDCache::trim_non_auth() if (lru.lru_get_size() == 0) { // root, stray, etc.? - hash_map::iterator p = inode_map.begin(); + ceph::unordered_map::iterator p = inode_map.begin(); while (p != inode_map.end()) { - hash_map::iterator next = p; + ceph::unordered_map::iterator next = p; ++next; CInode *in = p->second; if (!in->is_auth()) { @@ -8647,7 +8647,7 @@ void MDCache::kick_find_ino_peers(int who) int MDCache::get_num_client_requests() { int count = 0; - for (hash_map::iterator p = active_requests.begin(); + for (ceph::unordered_map::iterator p = active_requests.begin(); p != active_requests.end(); ++p) { if (p->second->reqid.name.is_client() && !p->second->is_slave()) @@ -11803,7 +11803,7 @@ void MDCache::show_cache() { dout(7) << "show_cache" << dendl; - for (hash_map::iterator it = inode_map.begin(); + for (ceph::unordered_map::iterator it = inode_map.begin(); it != inode_map.end(); ++it) { // unlinked? @@ -11848,7 +11848,7 @@ void MDCache::dump_cache(const char *fn) return; } - for (hash_map::iterator it = inode_map.begin(); + for (ceph::unordered_map::iterator it = inode_map.begin(); it != inode_map.end(); ++it) { CInode *in = it->second; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 5e431c0456cc..ad0f5ff734bb 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -84,7 +84,7 @@ class MDCache { // -- my cache -- LRU lru; // dentry lru for expiring items from cache protected: - hash_map inode_map; // map of inodes by ino + ceph::unordered_map inode_map; // map of inodes by ino CInode *root; // root inode CInode *myin; // .ceph/mds%d dir @@ -240,7 +240,7 @@ protected: // -- requests -- protected: - hash_map active_requests; + ceph::unordered_map active_requests; public: int get_num_client_requests(); @@ -1025,7 +1025,7 @@ public: CInode *hack_pick_random_inode() { assert(!inode_map.empty()); int n = rand() % inode_map.size(); - hash_map::iterator p = inode_map.begin(); + ceph::unordered_map::iterator p = inode_map.begin(); while (n--) ++p; return p->second; } diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index 4c17f5309b71..1b270290eaf2 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -29,7 +29,7 @@ void SessionMap::dump() { dout(10) << "dump" << dendl; - for (hash_map::iterator p = session_map.begin(); + for (ceph::unordered_map::iterator p = session_map.begin(); p != session_map.end(); ++p) dout(10) << p->first << " " << p->second @@ -154,7 +154,7 @@ void SessionMap::encode(bufferlist& bl) const ENCODE_START(3, 3, bl); ::encode(version, bl); - for (hash_map::const_iterator p = session_map.begin(); + for (ceph::unordered_map::const_iterator p = session_map.begin(); p != session_map.end(); ++p) { if (p->second->is_open() || @@ -221,7 +221,7 @@ void SessionMap::decode(bufferlist::iterator& p) void SessionMap::dump(Formatter *f) const { f->open_array_section("Sessions"); - for (hash_map::const_iterator p = session_map.begin(); + for (ceph::unordered_map::const_iterator p = session_map.begin(); p != session_map.end(); ++p) { f->open_object_section("Session"); @@ -258,7 +258,7 @@ void SessionMap::wipe() void SessionMap::wipe_ino_prealloc() { - for (hash_map::iterator p = session_map.begin(); + for (ceph::unordered_map::iterator p = session_map.begin(); p != session_map.end(); ++p) { p->second->pending_prealloc_inos.clear(); diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index 0eb7e7c909e2..8ddbacc66603 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -18,8 +18,7 @@ #include using std::set; -#include -using __gnu_cxx::hash_map; +#include "include/unordered_map.h" #include "include/Context.h" #include "include/xlist.h" @@ -235,7 +234,7 @@ class MDS; class SessionMap { private: MDS *mds; - hash_map session_map; + ceph::unordered_map session_map; public: map* > by_state; @@ -332,14 +331,14 @@ public: void dump(); void get_client_set(set& s) { - for (hash_map::iterator p = session_map.begin(); + for (ceph::unordered_map::iterator p = session_map.begin(); p != session_map.end(); ++p) if (p->second->info.inst.name.is_client()) s.insert(p->second->info.inst.name.num()); } void get_client_session_set(set& s) { - for (hash_map::iterator p = session_map.begin(); + for (ceph::unordered_map::iterator p = session_map.begin(); p != session_map.end(); ++p) if (p->second->info.inst.name.is_client()) diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index 143cfa9de6fd..685f5ff472d7 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -234,7 +234,7 @@ public: private: mutable bufferlist dnbl; bool dn_decoded; - list > dfull; + list > dfull; list dremote; list dnull; @@ -250,7 +250,7 @@ public: bool is_importing() { return state & STATE_IMPORTING; } void mark_importing() { state |= STATE_IMPORTING; } - list > &get_dfull() { return dfull; } + list > &get_dfull() { return dfull; } list &get_dremote() { return dremote; } list &get_dnull() { return dnull; } @@ -260,7 +260,7 @@ public: << " num " << nfull << "/" << nremote << "/" << nnull << std::endl; _decode_bits(); - for (list >::iterator p = dfull.begin(); p != dfull.end(); ++p) + for (list >::iterator p = dfull.begin(); p != dfull.end(); ++p) (*p)->print(out); for (list::iterator p = dremote.begin(); p != dremote.end(); ++p) p->print(out); @@ -312,7 +312,7 @@ private: // my lumps. preserve the order we added them in a list. list lump_order; map lump_map; - list > roots; + list > roots; list > table_tids; // tableclient transactions @@ -454,7 +454,7 @@ private: sr->encode(snapbl); lump.nfull++; - lump.get_dfull().push_back(std::tr1::shared_ptr(new fullbit(dn->get_name(), + lump.get_dfull().push_back(ceph::shared_ptr(new fullbit(dn->get_name(), dn->first, dn->last, dn->get_projected_version(), *pi, in->dirfragtree, @@ -507,7 +507,7 @@ private: else in->encode_snap_blob(snapbl); - for (list >::iterator p = roots.begin(); p != roots.end(); ++p) { + for (list >::iterator p = roots.begin(); p != roots.end(); ++p) { if ((*p)->inode.ino == in->ino()) { roots.erase(p); break; @@ -515,7 +515,7 @@ private: } string empty; - roots.push_back(std::tr1::shared_ptr(new fullbit(empty, in->first, in->last, 0, *pi, + roots.push_back(ceph::shared_ptr(new fullbit(empty, in->first, in->last, 0, *pi, *pdft, *px, in->symlink, snapbl, dirty ? fullbit::STATE_DIRTY : 0, &in->old_inodes))); diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 41a79f9fb38b..e6d530fc1010 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -237,11 +237,11 @@ void LogSegment::try_to_expire(MDS *mds, C_GatherBuilder &gather_bld) } // pending commit atids - for (map >::iterator p = pending_commit_tids.begin(); + for (map >::iterator p = pending_commit_tids.begin(); p != pending_commit_tids.end(); ++p) { MDSTableClient *client = mds->get_table_client(p->first); - for (hash_set::iterator q = p->second.begin(); + for (ceph::unordered_set::iterator q = p->second.begin(); q != p->second.end(); ++q) { dout(10) << "try_to_expire " << get_mdstable_name(p->first) << " transaction " << *q @@ -715,7 +715,7 @@ void EMetaBlob::dirlump::dump(Formatter *f) const f->dump_int("nnull", nnull); f->open_array_section("full bits"); - for (list >::const_iterator + for (list >::const_iterator iter = dfull.begin(); iter != dfull.end(); ++iter) { f->open_object_section("fullbit"); (*iter)->dump(f); @@ -789,7 +789,7 @@ void EMetaBlob::decode(bufferlist::iterator &bl) ::decode(rootbl, bl); if (rootbl.length()) { bufferlist::iterator p = rootbl.begin(); - roots.push_back(std::tr1::shared_ptr(new fullbit(p))); + roots.push_back(ceph::shared_ptr(new fullbit(p))); } } ::decode(table_tids, bl); @@ -844,7 +844,7 @@ void EMetaBlob::dump(Formatter *f) const f->close_section(); // lumps f->open_array_section("roots"); - for (list >::const_iterator i = roots.begin(); + for (list >::const_iterator i = roots.begin(); i != roots.end(); ++i) { f->open_object_section("root"); (*i)->dump(f); @@ -929,7 +929,7 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg, MDSlaveUpdate *slaveup) assert(g_conf->mds_kill_journal_replay_at != 1); - for (list >::iterator p = roots.begin(); p != roots.end(); ++p) { + for (list >::iterator p = roots.begin(); p != roots.end(); ++p) { CInode *in = mds->mdcache->get_inode((*p)->inode.ino); bool isnew = in ? false:true; if (!in) @@ -1032,10 +1032,10 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg, MDSlaveUpdate *slaveup) lump._decode_bits(); // full dentry+inode pairs - for (list >::iterator pp = lump.get_dfull().begin(); + for (list >::iterator pp = lump.get_dfull().begin(); pp != lump.get_dfull().end(); ++pp) { - std::tr1::shared_ptr p = *pp; + ceph::shared_ptr p = *pp; CDentry *dn = dir->lookup_exact_snap(p->dn, p->dnlast); if (!dn) { dn = dir->add_null_dentry(p->dn, p->dnfirst, p->dnlast); diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index b180abfb60a2..1c81dabe9189 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -24,6 +24,7 @@ using namespace std; #include #include "include/assert.h" +#include "include/hash_namespace.h" #define CEPH_FS_ONDISK_MAGIC "ceph fs volume v011" @@ -248,7 +249,7 @@ inline bool operator<(const vinodeno_t &l, const vinodeno_t &r) { (l.ino == r.ino && l.snapid < r.snapid); } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const vinodeno_t &vino) const { hash H; @@ -256,7 +257,7 @@ namespace __gnu_cxx { return H(vino.ino) ^ I(vino.snapid); } }; -} +CEPH_HASH_NAMESPACE_END @@ -680,14 +681,14 @@ inline bool operator<=(const metareqid_t& l, const metareqid_t& r) { inline bool operator>(const metareqid_t& l, const metareqid_t& r) { return !(l <= r); } inline bool operator>=(const metareqid_t& l, const metareqid_t& r) { return !(l < r); } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const metareqid_t &r) const { hash H; return H(r.name.num()) ^ H(r.name.type()) ^ H(r.tid); } }; -} +CEPH_HASH_NAMESPACE_END // cap info for client reconnect @@ -803,7 +804,7 @@ inline bool operator==(dirfrag_t l, dirfrag_t r) { return l.ino == r.ino && l.frag == r.frag; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const dirfrag_t &df) const { static rjhash H; @@ -811,7 +812,7 @@ namespace __gnu_cxx { return H(df.ino) ^ I(df.frag); } }; -} +CEPH_HASH_NAMESPACE_END diff --git a/src/mon/DataHealthService.cc b/src/mon/DataHealthService.cc index 3e421bc7c09b..9b707cd9ff9b 100644 --- a/src/mon/DataHealthService.cc +++ b/src/mon/DataHealthService.cc @@ -12,7 +12,7 @@ * */ #include -#include +#include "include/memory.h" #include #include #include diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 65139d0bb5a1..8ed5ed95fa62 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -45,7 +45,7 @@ ostream& operator<<(ostream& out, LogMonitor& pm) { /* std::stringstream ss; - for (hash_map::iterator p = pm.pg_map.num_pg_by_state.begin(); + for (ceph::unordered_map::iterator p = pm.pg_map.num_pg_by_state.begin(); p != pm.pg_map.num_pg_by_state.end(); ++p) { if (p != pm.pg_map.num_pg_by_state.begin()) diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 0655110fb990..be16da83af39 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -51,7 +51,7 @@ #include "mon/MonitorDBStore.h" #include -#include +#include "include/memory.h" #include diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index eda5aaf1802c..213e8b94d6aa 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -322,7 +322,7 @@ class MonitorDBStore virtual void get_chunk_tx(Transaction &tx, uint64_t max) = 0; virtual pair get_next_key() = 0; }; - typedef std::tr1::shared_ptr Synchronizer; + typedef ceph::shared_ptr Synchronizer; class WholeStoreIteratorImpl : public StoreIteratorImpl { KeyValueDB::WholeSpaceIterator iter; @@ -389,7 +389,7 @@ class MonitorDBStore else iter->seek_to_first(); - return std::tr1::shared_ptr( + return ceph::shared_ptr( new WholeStoreIteratorImpl(iter, prefixes) ); } diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 50f999d59f99..50db36be51a1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -336,10 +336,10 @@ bool OSDMonitor::thrash() } // generate some pg_temp entries. - // let's assume the hash_map iterates in a random-ish order. + // let's assume the ceph::unordered_map iterates in a random-ish order. int n = rand() % mon->pgmon()->pg_map.pg_stat.size(); - hash_map::iterator p = mon->pgmon()->pg_map.pg_stat.begin(); - hash_map::iterator e = mon->pgmon()->pg_map.pg_stat.end(); + ceph::unordered_map::iterator p = mon->pgmon()->pg_map.pg_stat.begin(); + ceph::unordered_map::iterator e = mon->pgmon()->pg_map.pg_stat.end(); while (n--) ++p; for (int i=0; i<50; i++) { @@ -465,7 +465,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str) std::string sep; oss << "overloaded osds: "; bool changed = false; - for (hash_map::const_iterator p = pgm.osd_stat.begin(); + for (ceph::unordered_map::const_iterator p = pgm.osd_stat.begin(); p != pgm.osd_stat.end(); ++p) { float util = p->second.kb_used; @@ -1816,7 +1816,7 @@ void OSDMonitor::tick() } // expire blacklisted items? - for (hash_map::iterator p = osdmap.blacklist.begin(); + for (ceph::unordered_map::iterator p = osdmap.blacklist.begin(); p != osdmap.blacklist.end(); ++p) { if (p->second < now) { @@ -2299,7 +2299,7 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) if (f) f->open_array_section("blacklist"); - for (hash_map::iterator p = osdmap.blacklist.begin(); + for (ceph::unordered_map::iterator p = osdmap.blacklist.begin(); p != osdmap.blacklist.end(); ++p) { if (f) { diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index db0c24e74339..56376d8b6ce3 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -180,7 +180,7 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) stamp = inc.stamp; pool_stat_t pg_sum_old = pg_sum; - hash_map pg_pool_sum_old; + ceph::unordered_map pg_pool_sum_old; bool ratios_changed = false; if (inc.full_ratio != full_ratio && inc.full_ratio != -1) { @@ -203,9 +203,9 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) if (pg_pool_sum_old.count(update_pg.pool()) == 0) pg_pool_sum_old[update_pg.pool()] = pg_pool_sum[update_pg.pool()]; - hash_map::iterator t = pg_stat.find(update_pg); + ceph::unordered_map::iterator t = pg_stat.find(update_pg); if (t == pg_stat.end()) { - hash_map::value_type v(update_pg, update_stat); + ceph::unordered_map::value_type v(update_pg, update_stat); pg_stat.insert(v); } else { stat_pg_sub(update_pg, t->second); @@ -221,9 +221,9 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) int osd = p->first; const osd_stat_t &new_stats(p->second); - hash_map::iterator t = osd_stat.find(osd); + ceph::unordered_map::iterator t = osd_stat.find(osd); if (t == osd_stat.end()) { - hash_map::value_type v(osd, new_stats); + ceph::unordered_map::value_type v(osd, new_stats); osd_stat.insert(v); } else { stat_osd_sub(t->second); @@ -241,7 +241,7 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) p != inc.pg_remove.end(); ++p) { const pg_t &removed_pg(*p); - hash_map::iterator s = pg_stat.find(removed_pg); + ceph::unordered_map::iterator s = pg_stat.find(removed_pg); if (s != pg_stat.end()) { stat_pg_sub(removed_pg, s->second); pg_stat.erase(s); @@ -251,7 +251,7 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) for (set::iterator p = inc.get_osd_stat_rm().begin(); p != inc.get_osd_stat_rm().end(); ++p) { - hash_map::iterator t = osd_stat.find(*p); + ceph::unordered_map::iterator t = osd_stat.find(*p); if (t != osd_stat.end()) { stat_osd_sub(t->second); osd_stat.erase(t); @@ -287,7 +287,7 @@ void PGMap::redo_full_sets() { full_osds.clear(); nearfull_osds.clear(); - for (hash_map::iterator i = osd_stat.begin(); + for (ceph::unordered_map::iterator i = osd_stat.begin(); i != osd_stat.end(); ++i) { register_nearfull_status(i->first, i->second); @@ -322,12 +322,12 @@ void PGMap::calc_stats() pg_sum = pool_stat_t(); osd_sum = osd_stat_t(); - for (hash_map::iterator p = pg_stat.begin(); + for (ceph::unordered_map::iterator p = pg_stat.begin(); p != pg_stat.end(); ++p) { stat_pg_add(p->first, p->second); } - for (hash_map::iterator p = osd_stat.begin(); + for (ceph::unordered_map::iterator p = osd_stat.begin(); p != osd_stat.end(); ++p) stat_osd_add(p->second); @@ -338,7 +338,7 @@ void PGMap::calc_stats() void PGMap::update_pg(pg_t pgid, bufferlist& bl) { bufferlist::iterator p = bl.begin(); - hash_map::iterator s = pg_stat.find(pgid); + ceph::unordered_map::iterator s = pg_stat.find(pgid); if (s != pg_stat.end()) stat_pg_sub(pgid, s->second); pg_stat_t& r = pg_stat[pgid]; @@ -348,7 +348,7 @@ void PGMap::update_pg(pg_t pgid, bufferlist& bl) void PGMap::remove_pg(pg_t pgid) { - hash_map::iterator s = pg_stat.find(pgid); + ceph::unordered_map::iterator s = pg_stat.find(pgid); if (s != pg_stat.end()) { stat_pg_sub(pgid, s->second); pg_stat.erase(s); @@ -358,7 +358,7 @@ void PGMap::remove_pg(pg_t pgid) void PGMap::update_osd(int osd, bufferlist& bl) { bufferlist::iterator p = bl.begin(); - hash_map::iterator o = osd_stat.find(osd); + ceph::unordered_map::iterator o = osd_stat.find(osd); if (o != osd_stat.end()) stat_osd_sub(o->second); osd_stat_t& r = osd_stat[osd]; @@ -371,7 +371,7 @@ void PGMap::update_osd(int osd, bufferlist& bl) void PGMap::remove_osd(int osd) { - hash_map::iterator o = osd_stat.find(osd); + ceph::unordered_map::iterator o = osd_stat.find(osd); if (o != osd_stat.end()) { stat_osd_sub(o->second); osd_stat.erase(o); @@ -433,7 +433,7 @@ epoch_t PGMap::calc_min_last_epoch_clean() const { if (pg_stat.empty()) return 0; - hash_map::const_iterator p = pg_stat.begin(); + ceph::unordered_map::const_iterator p = pg_stat.begin(); epoch_t min = p->second.get_effective_last_epoch_clean(); for (++p; p != pg_stat.end(); ++p) { epoch_t lec = p->second.get_effective_last_epoch_clean(); @@ -442,7 +442,7 @@ epoch_t PGMap::calc_min_last_epoch_clean() const } // also scan osd epochs // don't trim past the oldest reported osd epoch - for (hash_map::const_iterator i = osd_epochs.begin(); + for (ceph::unordered_map::const_iterator i = osd_epochs.begin(); i != osd_epochs.end(); ++i) { if (i->second < min) @@ -508,7 +508,7 @@ void PGMap::decode(bufferlist::iterator &bl) if (struct_v >= 6) { ::decode(osd_epochs, bl); } else { - for (hash_map::iterator i = osd_stat.begin(); + for (ceph::unordered_map::iterator i = osd_stat.begin(); i != osd_stat.end(); ++i) { // This isn't accurate, but will cause trimming to behave like @@ -528,10 +528,10 @@ void PGMap::dirty_all(Incremental& inc) inc.full_ratio = full_ratio; inc.nearfull_ratio = nearfull_ratio; - for (hash_map::const_iterator p = pg_stat.begin(); p != pg_stat.end(); ++p) { + for (ceph::unordered_map::const_iterator p = pg_stat.begin(); p != pg_stat.end(); ++p) { inc.pg_stat_updates[p->first] = p->second; } - for (hash_map::const_iterator p = osd_stat.begin(); p != osd_stat.end(); ++p) { + for (ceph::unordered_map::const_iterator p = osd_stat.begin(); p != osd_stat.end(); ++p) { assert(osd_epochs.count(p->first)); inc.update_stat(p->first, inc.get_osd_epochs().find(p->first)->second, @@ -577,7 +577,7 @@ void PGMap::dump_delta(Formatter *f) const void PGMap::dump_pg_stats(Formatter *f, bool brief) const { f->open_array_section("pg_stats"); - for (hash_map::const_iterator i = pg_stat.begin(); + for (ceph::unordered_map::const_iterator i = pg_stat.begin(); i != pg_stat.end(); ++i) { f->open_object_section("pg_stat"); @@ -594,7 +594,7 @@ void PGMap::dump_pg_stats(Formatter *f, bool brief) const void PGMap::dump_pool_stats(Formatter *f) const { f->open_array_section("pool_stats"); - for (hash_map::const_iterator p = pg_pool_sum.begin(); + for (ceph::unordered_map::const_iterator p = pg_pool_sum.begin(); p != pg_pool_sum.end(); ++p) { f->open_object_section("pool_stat"); @@ -608,7 +608,7 @@ void PGMap::dump_pool_stats(Formatter *f) const void PGMap::dump_osd_stats(Formatter *f) const { f->open_array_section("osd_stats"); - for (hash_map::const_iterator q = osd_stat.begin(); + for (ceph::unordered_map::const_iterator q = osd_stat.begin(); q != osd_stat.end(); ++q) { f->open_object_section("osd_stat"); @@ -620,10 +620,10 @@ void PGMap::dump_osd_stats(Formatter *f) const } void PGMap::dump_pg_stats_plain(ostream& ss, - const hash_map& pg_stats) const + const ceph::unordered_map& pg_stats) const { ss << "pg_stat\tobjects\tmip\tdegr\tunf\tbytes\tlog\tdisklog\tstate\tstate_stamp\tv\treported\tup\tacting\tlast_scrub\tscrub_stamp\tlast_deep_scrub\tdeep_scrub_stamp" << std::endl; - for (hash_map::const_iterator i = pg_stats.begin(); + for (ceph::unordered_map::const_iterator i = pg_stats.begin(); i != pg_stats.end(); ++i) { const pg_stat_t &st(i->second); ss << i->first @@ -656,7 +656,7 @@ void PGMap::dump(ostream& ss) const ss << "full_ratio " << full_ratio << std::endl; ss << "nearfull_ratio " << nearfull_ratio << std::endl; dump_pg_stats_plain(ss, pg_stat); - for (hash_map::const_iterator p = pg_pool_sum.begin(); + for (ceph::unordered_map::const_iterator p = pg_pool_sum.begin(); p != pg_pool_sum.end(); ++p) ss << "pool " << p->first @@ -679,7 +679,7 @@ void PGMap::dump(ostream& ss) const << "\t" << pg_sum.ondisk_log_size << std::endl; ss << "osdstat\tkbused\tkbavail\tkb\thb in\thb out" << std::endl; - for (hash_map::const_iterator p = osd_stat.begin(); + for (ceph::unordered_map::const_iterator p = osd_stat.begin(); p != osd_stat.end(); ++p) ss << p->first @@ -696,9 +696,9 @@ void PGMap::dump(ostream& ss) const } void PGMap::get_stuck_stats(PGMap::StuckPG type, utime_t cutoff, - hash_map& stuck_pgs) const + ceph::unordered_map& stuck_pgs) const { - for (hash_map::const_iterator i = pg_stat.begin(); + for (ceph::unordered_map::const_iterator i = pg_stat.begin(); i != pg_stat.end(); ++i) { utime_t val; @@ -730,10 +730,10 @@ void PGMap::get_stuck_stats(PGMap::StuckPG type, utime_t cutoff, void PGMap::dump_stuck(Formatter *f, PGMap::StuckPG type, utime_t cutoff) const { - hash_map stuck_pg_stats; + ceph::unordered_map stuck_pg_stats; get_stuck_stats(type, cutoff, stuck_pg_stats); f->open_array_section("stuck_pg_stats"); - for (hash_map::const_iterator i = stuck_pg_stats.begin(); + for (ceph::unordered_map::const_iterator i = stuck_pg_stats.begin(); i != stuck_pg_stats.end(); ++i) { f->open_object_section("pg_stat"); @@ -746,7 +746,7 @@ void PGMap::dump_stuck(Formatter *f, PGMap::StuckPG type, utime_t cutoff) const void PGMap::dump_stuck_plain(ostream& ss, PGMap::StuckPG type, utime_t cutoff) const { - hash_map stuck_pg_stats; + ceph::unordered_map stuck_pg_stats; get_stuck_stats(type, cutoff, stuck_pg_stats); if (!stuck_pg_stats.empty()) dump_pg_stats_plain(ss, stuck_pg_stats); @@ -755,7 +755,7 @@ void PGMap::dump_stuck_plain(ostream& ss, PGMap::StuckPG type, utime_t cutoff) c void PGMap::dump_osd_perf_stats(Formatter *f) const { f->open_array_section("osd_perf_infos"); - for (hash_map::const_iterator i = osd_stat.begin(); + for (ceph::unordered_map::const_iterator i = osd_stat.begin(); i != osd_stat.end(); ++i) { f->open_object_section("osd"); @@ -775,7 +775,7 @@ void PGMap::print_osd_perf_stats(std::ostream *ss) const tab.define_column("osdid", TextTable::LEFT, TextTable::RIGHT); tab.define_column("fs_commit_latency(ms)", TextTable::LEFT, TextTable::RIGHT); tab.define_column("fs_apply_latency(ms)", TextTable::LEFT, TextTable::RIGHT); - for (hash_map::const_iterator i = osd_stat.begin(); + for (ceph::unordered_map::const_iterator i = osd_stat.begin(); i != osd_stat.end(); ++i) { tab << i->first; @@ -865,11 +865,11 @@ void PGMap::overall_recovery_summary(Formatter *f, ostream *out) const void PGMap::pool_recovery_rate_summary(Formatter *f, ostream *out, uint64_t poolid) const { - hash_map >::const_iterator p = + ceph::unordered_map >::const_iterator p = per_pool_sum_delta.find(poolid); if (p == per_pool_sum_delta.end()) return; - hash_map::const_iterator ts = + ceph::unordered_map::const_iterator ts = per_pool_sum_deltas_stamps.find(p->first); assert(ts != per_pool_sum_deltas_stamps.end()); recovery_rate_summary(f, out, p->second.first, ts->second); @@ -878,7 +878,7 @@ void PGMap::pool_recovery_rate_summary(Formatter *f, ostream *out, void PGMap::pool_recovery_summary(Formatter *f, ostream *out, uint64_t poolid) const { - hash_map >::const_iterator p = + ceph::unordered_map >::const_iterator p = per_pool_sum_delta.find(poolid); if (p == per_pool_sum_delta.end()) return; @@ -926,11 +926,11 @@ void PGMap::overall_client_io_rate_summary(Formatter *f, ostream *out) const void PGMap::pool_client_io_rate_summary(Formatter *f, ostream *out, uint64_t poolid) const { - hash_map >::const_iterator p = + ceph::unordered_map >::const_iterator p = per_pool_sum_delta.find(poolid); if (p == per_pool_sum_delta.end()) return; - hash_map::const_iterator ts = + ceph::unordered_map::const_iterator ts = per_pool_sum_deltas_stamps.find(p->first); assert(ts != per_pool_sum_deltas_stamps.end()); client_io_rate_summary(f, out, p->second.first, ts->second); @@ -1035,9 +1035,9 @@ void PGMap::update_one_pool_delta(CephContext *cct, * @param pg_pool_sum_old Map of pool stats for delta calcs. */ void PGMap::update_pool_deltas(CephContext *cct, const utime_t ts, - const hash_map& pg_pool_sum_old) + const ceph::unordered_map& pg_pool_sum_old) { - for (hash_map::const_iterator it = pg_pool_sum_old.begin(); + for (ceph::unordered_map::const_iterator it = pg_pool_sum_old.begin(); it != pg_pool_sum_old.end(); ++it) { update_one_pool_delta(cct, ts, it->first, it->second); } @@ -1056,7 +1056,7 @@ void PGMap::print_summary(Formatter *f, ostream *out) const if (f) f->open_array_section("pgs_by_state"); - for (hash_map::const_iterator p = num_pg_by_state.begin(); + for (ceph::unordered_map::const_iterator p = num_pg_by_state.begin(); p != num_pg_by_state.end(); ++p) { if (f) { @@ -1119,7 +1119,7 @@ void PGMap::print_oneline_summary(ostream *out) const { std::stringstream ss; - for (hash_map::const_iterator p = num_pg_by_state.begin(); + for (ceph::unordered_map::const_iterator p = num_pg_by_state.begin(); p != num_pg_by_state.end(); ++p) { if (p != num_pg_by_state.begin()) diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 8a931ecbcca6..9c346403abec 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -36,15 +36,15 @@ public: version_t version; epoch_t last_osdmap_epoch; // last osdmap epoch i applied to the pgmap epoch_t last_pg_scan; // osdmap epoch - hash_map pg_stat; - hash_map osd_stat; + ceph::unordered_map pg_stat; + ceph::unordered_map osd_stat; set full_osds; set nearfull_osds; float full_ratio; float nearfull_ratio; // mapping of osd to most recently reported osdmap epoch - hash_map osd_epochs; + ceph::unordered_map osd_epochs; class Incremental { public: @@ -100,9 +100,9 @@ public: // aggregate stats (soft state), generated by calc_stats() - hash_map num_pg_by_state; + ceph::unordered_map num_pg_by_state; int64_t num_pg, num_osd; - hash_map pg_pool_sum; + ceph::unordered_map pg_pool_sum; pool_stat_t pg_sum; osd_stat_t osd_sum; @@ -113,19 +113,19 @@ public: * keep track of last deltas for each pool, calculated using * @p pg_pool_sum as baseline. */ - hash_map > > per_pool_sum_deltas; + ceph::unordered_map > > per_pool_sum_deltas; /** * keep track of per-pool timestamp deltas, according to last update on * each pool. */ - hash_map per_pool_sum_deltas_stamps; + ceph::unordered_map per_pool_sum_deltas_stamps; /** * keep track of sum deltas, per-pool, taking into account any previous * deltas existing in @p per_pool_sum_deltas. The utime_t as second member * of the pair is the timestamp refering to the last update (i.e., the first * member of the pair) for a given pool. */ - hash_map > per_pool_sum_delta; + ceph::unordered_map > per_pool_sum_delta; list< pair > pg_sum_deltas; pool_stat_t pg_sum_delta; @@ -135,7 +135,7 @@ public: const utime_t ts, const pool_stat_t& pg_sum_old); void update_pool_deltas(CephContext *cct, const utime_t ts, - const hash_map& pg_pool_sum_old); + const ceph::unordered_map& pg_pool_sum_old); void clear_delta(); private: @@ -232,9 +232,9 @@ public: void dump_delta(Formatter *f) const; void dump_pg_stats_plain(ostream& ss, - const hash_map& pg_stats) const; + const ceph::unordered_map& pg_stats) const; void get_stuck_stats(StuckPG type, utime_t cutoff, - hash_map& stuck_pgs) const; + ceph::unordered_map& stuck_pgs) const; void dump_stuck(Formatter *f, StuckPG type, utime_t cutoff) const; void dump_stuck_plain(ostream& ss, StuckPG type, utime_t cutoff) const; diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 8b077c18554f..cdfc83aa9bcb 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -95,7 +95,7 @@ void PGMonitor::update_logger() mon->cluster_logger->set(l_cluster_num_pg, pg_map.pg_stat.size()); unsigned active = 0, active_clean = 0, peering = 0; - for (hash_map::iterator p = pg_map.num_pg_by_state.begin(); + for (ceph::unordered_map::iterator p = pg_map.num_pg_by_state.begin(); p != pg_map.num_pg_by_state.end(); ++p) { if (p->first & PG_STATE_ACTIVE) { @@ -149,7 +149,7 @@ void PGMonitor::tick() * obtained -- the timestamp IS NOT a delta itself. */ if (!pg_map.per_pool_sum_deltas.empty()) { - hash_map >::iterator it; + ceph::unordered_map >::iterator it; for (it = pg_map.per_pool_sum_delta.begin(); it != pg_map.per_pool_sum_delta.end(); ) { utime_t age = ceph_clock_now(g_ceph_context) - it->second.second; @@ -427,7 +427,7 @@ void PGMonitor::apply_pgmap_delta(bufferlist& bl) } pool_stat_t pg_sum_old = pg_map.pg_sum; - hash_map pg_pool_sum_old; + ceph::unordered_map pg_pool_sum_old; // pgs bufferlist::iterator p = dirty_pgs.begin(); @@ -706,7 +706,7 @@ bool PGMonitor::preprocess_pg_stats(MPGStats *stats) bool PGMonitor::pg_stats_have_changed(int from, const MPGStats *stats) const { // any new osd info? - hash_map::const_iterator s = pg_map.osd_stat.find(from); + ceph::unordered_map::const_iterator s = pg_map.osd_stat.find(from); if (s == pg_map.osd_stat.end()) return true; if (s->second != stats->osd_stat) @@ -715,7 +715,7 @@ bool PGMonitor::pg_stats_have_changed(int from, const MPGStats *stats) const // any new pg info? for (map::const_iterator p = stats->pg_stat.begin(); p != stats->pg_stat.end(); ++p) { - hash_map::const_iterator t = pg_map.pg_stat.find(p->first); + ceph::unordered_map::const_iterator t = pg_map.pg_stat.find(p->first); if (t == pg_map.pg_stat.end()) return true; if (t->second.reported_epoch != p->second.reported_epoch || @@ -1028,7 +1028,7 @@ bool PGMonitor::register_new_pgs() } // deleted pools? - for (hash_map::const_iterator p = pg_map.pg_stat.begin(); + for (ceph::unordered_map::const_iterator p = pg_map.pg_stat.begin(); p != pg_map.pg_stat.end(); ++p) { if (!osdmap->have_pg_pool(p->first.pool())) { dout(20) << " removing pg_stat " << p->first << " because " @@ -1155,7 +1155,7 @@ bool PGMonitor::check_down_pgs() OSDMap *osdmap = &mon->osdmon()->osdmap; bool ret = false; - for (hash_map::iterator p = pg_map.pg_stat.begin(); + for (ceph::unordered_map::iterator p = pg_map.pg_stat.begin(); p != pg_map.pg_stat.end(); ++p) { if ((p->second.state & PG_STATE_STALE) == 0 && @@ -1550,8 +1550,8 @@ bool PGMonitor::preprocess_command(MMonCommand *m) cmd_getval(g_ceph_context, cmdmap, "debugop", debugop, string("unfound_objects_exist")); if (debugop == "unfound_objects_exist") { bool unfound_objects_exist = false; - hash_map::const_iterator end = pg_map.pg_stat.end(); - for (hash_map::const_iterator s = pg_map.pg_stat.begin(); + ceph::unordered_map::const_iterator end = pg_map.pg_stat.end(); + for (ceph::unordered_map::const_iterator s = pg_map.pg_stat.begin(); s != end; ++s) { if (s->second.stats.sum.num_objects_unfound > 0) { unfound_objects_exist = true; @@ -1565,8 +1565,8 @@ bool PGMonitor::preprocess_command(MMonCommand *m) r = 0; } else if (debugop == "degraded_pgs_exist") { bool degraded_pgs_exist = false; - hash_map::const_iterator end = pg_map.pg_stat.end(); - for (hash_map::const_iterator s = pg_map.pg_stat.begin(); + ceph::unordered_map::const_iterator end = pg_map.pg_stat.end(); + for (ceph::unordered_map::const_iterator s = pg_map.pg_stat.begin(); s != end; ++s) { if (s->second.stats.sum.num_objects_degraded > 0) { degraded_pgs_exist = true; @@ -1673,10 +1673,10 @@ bool PGMonitor::prepare_command(MMonCommand *m) } static void note_stuck_detail(enum PGMap::StuckPG what, - hash_map& stuck_pgs, + ceph::unordered_map& stuck_pgs, list > *detail) { - for (hash_map::iterator p = stuck_pgs.begin(); + for (ceph::unordered_map::iterator p = stuck_pgs.begin(); p != stuck_pgs.end(); ++p) { ostringstream ss; @@ -1735,8 +1735,8 @@ void PGMonitor::get_health(list >& summary, list > *detail) const { map note; - hash_map::const_iterator p = pg_map.num_pg_by_state.begin(); - hash_map::const_iterator p_end = pg_map.num_pg_by_state.end(); + ceph::unordered_map::const_iterator p = pg_map.num_pg_by_state.begin(); + ceph::unordered_map::const_iterator p_end = pg_map.num_pg_by_state.end(); for (; p != p_end; ++p) { if (p->first & PG_STATE_STALE) note["stale"] += p->second; @@ -1766,7 +1766,7 @@ void PGMonitor::get_health(list >& summary, note["backfill_toofull"] += p->second; } - hash_map stuck_pgs; + ceph::unordered_map stuck_pgs; utime_t now(ceph_clock_now(g_ceph_context)); utime_t cutoff = now - utime_t(g_conf->mon_pg_stuck_threshold, 0); @@ -1800,7 +1800,7 @@ void PGMonitor::get_health(list >& summary, summary.push_back(make_pair(HEALTH_WARN, ss.str())); } if (detail) { - for (hash_map::const_iterator p = pg_map.pg_stat.begin(); + for (ceph::unordered_map::const_iterator p = pg_map.pg_stat.begin(); p != pg_map.pg_stat.end(); ++p) { if ((p->second.state & (PG_STATE_STALE | @@ -1847,7 +1847,7 @@ void PGMonitor::get_health(list >& summary, if (detail) { unsigned num_slow_osds = 0; // do per-osd warnings - for (hash_map::const_iterator p = pg_map.osd_stat.begin(); + for (ceph::unordered_map::const_iterator p = pg_map.osd_stat.begin(); p != pg_map.osd_stat.end(); ++p) { if (_warn_slow_request_histogram(p->second.op_queue_age_hist, @@ -1899,7 +1899,7 @@ void PGMonitor::get_health(list >& summary, } } if (!pg_map.pg_stat.empty()) { - for (hash_map::const_iterator p = pg_map.pg_pool_sum.begin(); + for (ceph::unordered_map::const_iterator p = pg_map.pg_pool_sum.begin(); p != pg_map.pg_pool_sum.end(); ++p) { const pg_pool_t *pi = mon->osdmon()->osdmap.get_pg_pool(p->first); diff --git a/src/msg/Pipe.cc b/src/msg/Pipe.cc index 4b9dcae8d17d..6389e207ba7e 100644 --- a/src/msg/Pipe.cc +++ b/src/msg/Pipe.cc @@ -1154,7 +1154,7 @@ void Pipe::register_pipe() void Pipe::unregister_pipe() { assert(msgr->lock.is_locked()); - hash_map::iterator p = msgr->rank_pipe.find(peer_addr); + ceph::unordered_map::iterator p = msgr->rank_pipe.find(peer_addr); if (p != msgr->rank_pipe.end() && p->second == this) { ldout(msgr->cct,10) << "unregister_pipe" << dendl; msgr->rank_pipe.erase(p); diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 8536f850dcac..ef97b015adbc 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -575,7 +575,7 @@ void SimpleMessenger::mark_down_all() accepting_pipes.clear(); while (!rank_pipe.empty()) { - hash_map::iterator it = rank_pipe.begin(); + ceph::unordered_map::iterator it = rank_pipe.begin(); Pipe *p = it->second; ldout(cct,5) << "mark_down_all " << it->first << " " << p << dendl; rank_pipe.erase(it); diff --git a/src/msg/SimpleMessenger.h b/src/msg/SimpleMessenger.h index 6c2999934495..e6e1fb1d0cb8 100644 --- a/src/msg/SimpleMessenger.h +++ b/src/msg/SimpleMessenger.h @@ -21,9 +21,8 @@ #include #include using namespace std; -#include -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" +#include "include/unordered_set.h" #include "common/Mutex.h" #include "include/atomic.h" @@ -317,7 +316,7 @@ private: * NOTE: a Pipe* with state CLOSED may still be in the map but is considered * invalid and can be replaced by anyone holding the msgr lock */ - hash_map rank_pipe; + ceph::unordered_map rank_pipe; /** * list of pipes are in teh process of accepting * @@ -351,7 +350,7 @@ private: friend class Pipe; Pipe *_lookup_pipe(const entity_addr_t& k) { - hash_map::iterator p = rank_pipe.find(k); + ceph::unordered_map::iterator p = rank_pipe.find(k); if (p == rank_pipe.end()) return NULL; // see lock cribbing in Pipe::fault() diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 40b3f0bfedcc..5d86b3a229e2 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -20,6 +20,7 @@ #include "include/types.h" #include "include/blobhash.h" #include "include/encoding.h" +#include "include/hash_namespace.h" namespace ceph { class Formatter; @@ -139,7 +140,7 @@ inline std::ostream& operator<<(std::ostream& out, const ceph_entity_name& addr) return out << *(const entity_name_t*)&addr; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash< entity_name_t > { size_t operator()( const entity_name_t &m ) const @@ -147,7 +148,7 @@ namespace __gnu_cxx { return rjhash32(m.type() ^ m.num()); } }; -} +CEPH_HASH_NAMESPACE_END @@ -359,7 +360,7 @@ inline bool operator<=(const entity_addr_t& a, const entity_addr_t& b) { return inline bool operator>(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) > 0; } inline bool operator>=(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) >= 0; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash< entity_addr_t > { size_t operator()( const entity_addr_t& x ) const @@ -368,7 +369,7 @@ namespace __gnu_cxx { return H((const char*)&x, sizeof(x)); } }; -} +CEPH_HASH_NAMESPACE_END /* @@ -413,7 +414,7 @@ inline bool operator<=(const entity_inst_t& a, const entity_inst_t& b) { inline bool operator>(const entity_inst_t& a, const entity_inst_t& b) { return b < a; } inline bool operator>=(const entity_inst_t& a, const entity_inst_t& b) { return b <= a; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash< entity_inst_t > { size_t operator()( const entity_inst_t& x ) const @@ -423,7 +424,7 @@ namespace __gnu_cxx { return H(x.name) ^ I(x.addr); } }; -} +CEPH_HASH_NAMESPACE_END inline ostream& operator<<(ostream& out, const entity_inst_t &i) diff --git a/src/os/CollectionIndex.h b/src/os/CollectionIndex.h index 89b7b8626322..529db015bf03 100644 --- a/src/os/CollectionIndex.h +++ b/src/os/CollectionIndex.h @@ -17,7 +17,7 @@ #include #include -#include +#include "include/memory.h" #include "osd/osd_types.h" #include "include/object.h" @@ -43,14 +43,14 @@ protected: /// Returned path string full_path; /// Ref to parent Index - std::tr1::shared_ptr parent_ref; + ceph::shared_ptr parent_ref; /// coll_t for parent Index coll_t parent_coll; /// Normal Constructor Path( string path, ///< [in] Path to return. - std::tr1::weak_ptr ref) ///< [in] weak_ptr to parent. + ceph::weak_ptr ref) ///< [in] weak_ptr to parent. : full_path(path), parent_ref(ref), parent_coll(parent_ref->coll()) {} /// Debugging Constructor @@ -66,13 +66,13 @@ protected: coll_t coll() const { return parent_coll; } /// Getter for parent - std::tr1::shared_ptr get_index() const { + ceph::shared_ptr get_index() const { return parent_ref; } }; public: /// Type of returned paths - typedef std::tr1::shared_ptr IndexedPath; + typedef ceph::shared_ptr IndexedPath; static IndexedPath get_testing_path(string path, coll_t collection) { return IndexedPath(new Path(path, collection)); @@ -99,7 +99,7 @@ protected: * * @see IndexManager */ - virtual void set_ref(std::tr1::shared_ptr ref) = 0; + virtual void set_ref(ceph::shared_ptr ref) = 0; /** * Initializes the index. @@ -161,7 +161,7 @@ protected: virtual int split( uint32_t match, //< [in] value to match uint32_t bits, //< [in] bits to check - std::tr1::shared_ptr dest //< [in] destination index + ceph::shared_ptr dest //< [in] destination index ) { assert(0); return 0; } diff --git a/src/os/DBObjectMap.cc b/src/os/DBObjectMap.cc index 9057748341f7..886658f9aa76 100644 --- a/src/os/DBObjectMap.cc +++ b/src/os/DBObjectMap.cc @@ -7,7 +7,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include "ObjectMap.h" diff --git a/src/os/DBObjectMap.h b/src/os/DBObjectMap.h index eb3950cfa3be..a71c369fc028 100644 --- a/src/os/DBObjectMap.h +++ b/src/os/DBObjectMap.h @@ -8,7 +8,7 @@ #include #include -#include +#include "include/memory.h" #include #include "ObjectMap.h" @@ -280,7 +280,7 @@ public: coll_t *c, ghobject_t *oid); private: /// Implicit lock on Header->seq - typedef std::tr1::shared_ptr<_Header> Header; + typedef ceph::shared_ptr<_Header> Header; string map_header_key(const ghobject_t &oid); string header_key(uint64_t seq); @@ -316,12 +316,12 @@ private: Header header; /// parent_iter == NULL iff no parent - std::tr1::shared_ptr parent_iter; + ceph::shared_ptr parent_iter; KeyValueDB::Iterator key_iter; KeyValueDB::Iterator complete_iter; /// cur_iter points to currently valid iterator - std::tr1::shared_ptr cur_iter; + ceph::shared_ptr cur_iter; int r; /// init() called, key_iter, complete_iter, parent_iter filled in @@ -360,7 +360,7 @@ private: int adjust(); }; - typedef std::tr1::shared_ptr DBObjectMapIterator; + typedef ceph::shared_ptr DBObjectMapIterator; DBObjectMapIterator _get_iterator(Header header) { return DBObjectMapIterator(new DBObjectMapIteratorImpl(this, header)); } diff --git a/src/os/FDCache.h b/src/os/FDCache.h index 93557d43c473..13d7445e85bf 100644 --- a/src/os/FDCache.h +++ b/src/os/FDCache.h @@ -61,7 +61,7 @@ public: ~FDCache() { cct->_conf->remove_observer(this); } - typedef std::tr1::shared_ptr FDRef; + typedef ceph::shared_ptr FDRef; FDRef lookup(const ghobject_t &hoid) { return registry.lookup(hoid); diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 88e6c66e9c3b..d30eeba74e0e 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -24,8 +24,7 @@ #include using namespace std; -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" #include "include/assert.h" diff --git a/src/os/FlatIndex.cc b/src/os/FlatIndex.cc index d4644abc627d..2f1a1d16c6fc 100644 --- a/src/os/FlatIndex.cc +++ b/src/os/FlatIndex.cc @@ -49,7 +49,7 @@ using ceph::crypto::SHA1; #define FILENAME_PREFIX_LEN (FILENAME_SHORT_LEN - FILENAME_HASH_LEN - (sizeof(FILENAME_COOKIE) - 1) - FILENAME_EXTRA) -void FlatIndex::set_ref(std::tr1::shared_ptr ref) { +void FlatIndex::set_ref(ceph::shared_ptr ref) { self_ref = ref; } diff --git a/src/os/FlatIndex.h b/src/os/FlatIndex.h index 657c273468b4..e55bd142c065 100644 --- a/src/os/FlatIndex.h +++ b/src/os/FlatIndex.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include "include/memory.h" #include "CollectionIndex.h" @@ -29,7 +29,7 @@ * This class should only be used for converting old filestores. */ class FlatIndex : public CollectionIndex { - std::tr1::weak_ptr self_ref; + ceph::weak_ptr self_ref; string base_path; coll_t collection; public: @@ -42,7 +42,7 @@ public: coll_t coll() const { return collection; } /// @see CollectionIndex - void set_ref(std::tr1::shared_ptr ref); + void set_ref(ceph::shared_ptr ref); /// @see CollectionIndex int cleanup(); diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc index ea50cd038ca5..134deb9d5a70 100644 --- a/src/os/HashIndex.cc +++ b/src/os/HashIndex.cc @@ -224,7 +224,7 @@ int HashIndex::col_split_level( int HashIndex::_split( uint32_t match, uint32_t bits, - std::tr1::shared_ptr dest) { + ceph::shared_ptr dest) { assert(collection_version() == dest->collection_version()); unsigned mkdirred = 0; return col_split_level( diff --git a/src/os/HashIndex.h b/src/os/HashIndex.h index 6f5bca077d4e..bdfee2ed4536 100644 --- a/src/os/HashIndex.h +++ b/src/os/HashIndex.h @@ -155,7 +155,7 @@ public: int _split( uint32_t match, uint32_t bits, - std::tr1::shared_ptr dest + ceph::shared_ptr dest ); protected: diff --git a/src/os/IndexManager.cc b/src/os/IndexManager.cc index 83bbfc9703e6..e8a3785865f4 100644 --- a/src/os/IndexManager.cc +++ b/src/os/IndexManager.cc @@ -12,7 +12,7 @@ * */ -#include +#include "include/memory.h" #include #if defined(__FreeBSD__) diff --git a/src/os/IndexManager.h b/src/os/IndexManager.h index 43de7ee49c8f..2aa7c66a754f 100644 --- a/src/os/IndexManager.h +++ b/src/os/IndexManager.h @@ -14,7 +14,7 @@ #ifndef OS_INDEXMANAGER_H #define OS_INDEXMANAGER_H -#include +#include "include/memory.h" #include #include "common/Mutex.h" @@ -28,7 +28,7 @@ /// Public type for Index -typedef std::tr1::shared_ptr Index; +typedef ceph::shared_ptr Index; /** * Encapsulates mutual exclusion for CollectionIndexes. * @@ -50,7 +50,7 @@ class IndexManager { bool upgrade; /// Currently in use CollectionIndices - map > col_indices; + map > col_indices; /// Cleans up state for c @see RemoveOnDelete void put_index( diff --git a/src/os/KeyValueDB.h b/src/os/KeyValueDB.h index e98463aa763a..8b2cefb3aba6 100644 --- a/src/os/KeyValueDB.h +++ b/src/os/KeyValueDB.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include "ObjectMap.h" @@ -62,7 +62,7 @@ public: virtual ~TransactionImpl() {}; }; - typedef std::tr1::shared_ptr< TransactionImpl > Transaction; + typedef ceph::shared_ptr< TransactionImpl > Transaction; virtual Transaction get_transaction() = 0; virtual int submit_transaction(Transaction) = 0; @@ -94,7 +94,7 @@ public: virtual int status() = 0; virtual ~WholeSpaceIteratorImpl() { } }; - typedef std::tr1::shared_ptr< WholeSpaceIteratorImpl > WholeSpaceIterator; + typedef ceph::shared_ptr< WholeSpaceIteratorImpl > WholeSpaceIterator; class IteratorImpl : public ObjectMap::ObjectMapIteratorImpl { const string prefix; @@ -143,14 +143,14 @@ public: } }; - typedef std::tr1::shared_ptr< IteratorImpl > Iterator; + typedef ceph::shared_ptr< IteratorImpl > Iterator; WholeSpaceIterator get_iterator() { return _get_iterator(); } Iterator get_iterator(const string &prefix) { - return std::tr1::shared_ptr( + return ceph::shared_ptr( new IteratorImpl(prefix, get_iterator()) ); } @@ -160,7 +160,7 @@ public: } Iterator get_snapshot_iterator(const string &prefix) { - return std::tr1::shared_ptr( + return ceph::shared_ptr( new IteratorImpl(prefix, get_snapshot_iterator()) ); } diff --git a/src/os/LFNIndex.cc b/src/os/LFNIndex.cc index 83e1c1447543..a250016e8e9d 100644 --- a/src/os/LFNIndex.cc +++ b/src/os/LFNIndex.cc @@ -63,7 +63,7 @@ void LFNIndex::maybe_inject_failure() /* Public methods */ -void LFNIndex::set_ref(std::tr1::shared_ptr ref) +void LFNIndex::set_ref(ceph::shared_ptr ref) { self_ref = ref; } diff --git a/src/os/LFNIndex.h b/src/os/LFNIndex.h index f436446bf0f6..c9c7f5ed141d 100644 --- a/src/os/LFNIndex.h +++ b/src/os/LFNIndex.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include "osd/osd_types.h" @@ -99,7 +99,7 @@ class LFNIndex : public CollectionIndex { /// Path to Index base. const string base_path; /// For reference counting the collection @see Path - std::tr1::weak_ptr self_ref; + ceph::weak_ptr self_ref; protected: const uint32_t index_version; @@ -155,7 +155,7 @@ public: virtual ~LFNIndex() {} /// @see CollectionIndex - void set_ref(std::tr1::shared_ptr ref); + void set_ref(ceph::shared_ptr ref); /// @see CollectionIndex int init(); @@ -199,14 +199,14 @@ public: virtual int _split( uint32_t match, //< [in] value to match uint32_t bits, //< [in] bits to check - std::tr1::shared_ptr dest //< [in] destination index + ceph::shared_ptr dest //< [in] destination index ) = 0; /// @see CollectionIndex int split( uint32_t match, uint32_t bits, - std::tr1::shared_ptr dest + ceph::shared_ptr dest ) { WRAP_RETRY( r = _split(match, bits, dest); diff --git a/src/os/LevelDBStore.cc b/src/os/LevelDBStore.cc index bf98b67ad67d..668f196675fa 100644 --- a/src/os/LevelDBStore.cc +++ b/src/os/LevelDBStore.cc @@ -5,7 +5,7 @@ #include #include #include -#include +#include "include/memory.h" #include using std::string; #include "common/perf_counters.h" diff --git a/src/os/LevelDBStore.h b/src/os/LevelDBStore.h index d0a41f27960b..8b5947af7e28 100644 --- a/src/os/LevelDBStore.h +++ b/src/os/LevelDBStore.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include "leveldb/db.h" #include "leveldb/env.h" @@ -186,7 +186,7 @@ public: }; KeyValueDB::Transaction get_transaction() { - return std::tr1::shared_ptr< LevelDBTransactionImpl >( + return ceph::shared_ptr< LevelDBTransactionImpl >( new LevelDBTransactionImpl(this)); } @@ -372,7 +372,7 @@ err: protected: WholeSpaceIterator _get_iterator() { - return std::tr1::shared_ptr( + return ceph::shared_ptr( new LevelDBWholeSpaceIteratorImpl( db->NewIterator(leveldb::ReadOptions()) ) @@ -386,7 +386,7 @@ protected: snapshot = db->GetSnapshot(); options.snapshot = snapshot; - return std::tr1::shared_ptr( + return ceph::shared_ptr( new LevelDBSnapshotIteratorImpl(db.get(), snapshot, db->NewIterator(options)) ); diff --git a/src/os/MemStore.cc b/src/os/MemStore.cc index 89b148712fd3..4bcd93f406a9 100644 --- a/src/os/MemStore.cc +++ b/src/os/MemStore.cc @@ -23,6 +23,8 @@ #include "include/types.h" #include "include/stringify.h" +#include "include/unordered_map.h" +#include "include/memory.h" #include "common/errno.h" #include "MemStore.h" @@ -65,7 +67,7 @@ int MemStore::_save() Mutex::Locker l(apply_lock); // block any writer dump_all(); set collections; - for (hash_map::iterator p = coll_map.begin(); + for (ceph::unordered_map::iterator p = coll_map.begin(); p != coll_map.end(); ++p) { dout(20) << __func__ << " coll " << p->first << " " << p->second << dendl; @@ -104,7 +106,7 @@ void MemStore::dump_all() void MemStore::dump(Formatter *f) { f->open_array_section("collections"); - for (hash_map::iterator p = coll_map.begin(); + for (ceph::unordered_map::iterator p = coll_map.begin(); p != coll_map.end(); ++p) { f->open_object_section("collection"); @@ -236,7 +238,7 @@ objectstore_perf_stat_t MemStore::get_cur_stats() MemStore::CollectionRef MemStore::get_collection(coll_t cid) { RWLock::RLocker l(coll_lock); - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp == coll_map.end()) return CollectionRef(); return cp->second; @@ -383,7 +385,7 @@ int MemStore::list_collections(vector& ls) { dout(10) << __func__ << dendl; RWLock::RLocker l(coll_lock); - for (hash_map::iterator p = coll_map.begin(); + for (ceph::unordered_map::iterator p = coll_map.begin(); p != coll_map.end(); ++p) { ls.push_back(p->first); @@ -1315,7 +1317,7 @@ int MemStore::_create_collection(coll_t cid) { dout(10) << __func__ << " " << cid << dendl; RWLock::WLocker l(coll_lock); - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp != coll_map.end()) return -EEXIST; coll_map[cid].reset(new Collection); @@ -1326,7 +1328,7 @@ int MemStore::_destroy_collection(coll_t cid) { dout(10) << __func__ << " " << cid << dendl; RWLock::WLocker l(coll_lock); - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp == coll_map.end()) return -ENOENT; { @@ -1390,7 +1392,7 @@ int MemStore::_collection_setattr(coll_t cid, const char *name, const void *value, size_t size) { dout(10) << __func__ << " " << cid << " " << name << dendl; - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp == coll_map.end()) return -ENOENT; RWLock::WLocker l(cp->second->lock); @@ -1402,7 +1404,7 @@ int MemStore::_collection_setattr(coll_t cid, const char *name, int MemStore::_collection_setattrs(coll_t cid, map &aset) { dout(10) << __func__ << " " << cid << dendl; - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp == coll_map.end()) return -ENOENT; RWLock::WLocker l(cp->second->lock); @@ -1418,7 +1420,7 @@ int MemStore::_collection_setattrs(coll_t cid, map &aset) int MemStore::_collection_rmattr(coll_t cid, const char *name) { dout(10) << __func__ << " " << cid << " " << name << dendl; - hash_map::iterator cp = coll_map.find(cid); + ceph::unordered_map::iterator cp = coll_map.find(cid); if (cp == coll_map.end()) return -ENOENT; RWLock::WLocker l(cp->second->lock); diff --git a/src/os/MemStore.h b/src/os/MemStore.h index 6b212ee28f13..c33dd04ca935 100644 --- a/src/os/MemStore.h +++ b/src/os/MemStore.h @@ -16,10 +16,9 @@ #ifndef CEPH_MEMSTORE_H #define CEPH_MEMSTORE_H -#include -using namespace __gnu_cxx; - #include "include/assert.h" +#include "include/unordered_map.h" +#include "include/memory.h" #include "common/Finisher.h" #include "common/RWLock.h" #include "ObjectStore.h" @@ -75,10 +74,10 @@ public: f->close_section(); } }; - typedef std::tr1::shared_ptr ObjectRef; + typedef ceph::shared_ptr ObjectRef; struct Collection { - hash_map object_hash; ///< for lookup + ceph::unordered_map object_hash; ///< for lookup map object_map; ///< for iteration map xattr; RWLock lock; ///< for object_{map,hash} @@ -89,7 +88,7 @@ public: // level. ObjectRef get_object(ghobject_t oid) { - hash_map::iterator o = object_hash.find(oid); + ceph::unordered_map::iterator o = object_hash.find(oid); if (o == object_hash.end()) return ObjectRef(); return o->second; @@ -126,7 +125,7 @@ public: Collection() : lock("MemStore::Collection::lock") {} }; - typedef std::tr1::shared_ptr CollectionRef; + typedef ceph::shared_ptr CollectionRef; private: class OmapIteratorImpl : public ObjectMap::ObjectMapIteratorImpl { @@ -175,7 +174,7 @@ private: }; - hash_map coll_map; + ceph::unordered_map coll_map; RWLock coll_lock; ///< rwlock to protect coll_map Mutex apply_lock; ///< serialize all updates diff --git a/src/os/ObjectMap.h b/src/os/ObjectMap.h index b460a9566368..86f9e3e51fac 100644 --- a/src/os/ObjectMap.h +++ b/src/os/ObjectMap.h @@ -19,7 +19,7 @@ #include "SequencerPosition.h" #include #include -#include +#include "include/memory.h" /** * Encapsulates the FileStore key value store @@ -149,7 +149,7 @@ public: virtual int status() = 0; virtual ~ObjectMapIteratorImpl() {} }; - typedef std::tr1::shared_ptr ObjectMapIterator; + typedef ceph::shared_ptr ObjectMapIterator; virtual ObjectMapIterator get_iterator(const ghobject_t &oid) { return ObjectMapIterator(); } diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index db22d978497d..8a8375f56997 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -13,7 +13,7 @@ */ #include #include -#include +#include "include/memory.h" #include "ObjectStore.h" #include "common/Formatter.h" #include "FileStore.h" diff --git a/src/os/WBThrottle.h b/src/os/WBThrottle.h index d1feb9bf848e..f643e39fad88 100644 --- a/src/os/WBThrottle.h +++ b/src/os/WBThrottle.h @@ -17,7 +17,7 @@ #include #include -#include +#include "include/memory.h" #include "include/buffer.h" #include "common/Formatter.h" #include "common/hobject.h" diff --git a/src/osd/ErasureCodeInterface.h b/src/osd/ErasureCodeInterface.h index f123adefded3..9a44be71bb88 100644 --- a/src/osd/ErasureCodeInterface.h +++ b/src/osd/ErasureCodeInterface.h @@ -142,7 +142,7 @@ #include #include -#include +#include "include/memory.h" #include "include/buffer.h" using namespace std; @@ -343,7 +343,7 @@ namespace ceph { } }; - typedef std::tr1::shared_ptr ErasureCodeInterfaceRef; + typedef ceph::shared_ptr ErasureCodeInterfaceRef; } diff --git a/src/osd/HitSet.h b/src/osd/HitSet.h index d30c9b712936..b6acce948505 100644 --- a/src/osd/HitSet.h +++ b/src/osd/HitSet.h @@ -18,6 +18,7 @@ #include #include "include/encoding.h" +#include "include/unordered_set.h" #include "common/bloom_filter.hpp" #include "common/hobject.h" #include "common/Formatter.h" @@ -176,7 +177,7 @@ ostream& operator<<(ostream& out, const HitSet::Params& p); */ class ExplicitHashHitSet : public HitSet::Impl { uint64_t count; - hash_set hits; + ceph::unordered_set hits; public: class Params : public HitSet::Params::Impl { public: @@ -234,7 +235,7 @@ public: void dump(Formatter *f) const { f->dump_unsigned("insert_count", count); f->open_array_section("hash_set"); - for (hash_set::const_iterator p = hits.begin(); p != hits.end(); ++p) + for (ceph::unordered_set::const_iterator p = hits.begin(); p != hits.end(); ++p) f->dump_unsigned("hash", *p); f->close_section(); } @@ -253,7 +254,7 @@ WRITE_CLASS_ENCODER(ExplicitHashHitSet) */ class ExplicitObjectHitSet : public HitSet::Impl { uint64_t count; - hash_set hits; + ceph::unordered_set hits; public: class Params : public HitSet::Params::Impl { public: @@ -311,7 +312,7 @@ public: void dump(Formatter *f) const { f->dump_unsigned("insert_count", count); f->open_array_section("set"); - for (hash_set::const_iterator p = hits.begin(); p != hits.end(); ++p) { + for (ceph::unordered_set::const_iterator p = hits.begin(); p != hits.end(); ++p) { f->open_object_section("object"); p->dump(f); f->close_section(); diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index f192f479c2ec..dee18bdb1d65 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -937,7 +937,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, list watchers; osd_lock.Lock(); // scan pg's - for (hash_map::iterator it = pg_map.begin(); + for (ceph::unordered_map::iterator it = pg_map.begin(); it != pg_map.end(); ++it) { @@ -1447,7 +1447,7 @@ int OSD::shutdown() cct->_conf->apply_changes(NULL); // Shutdown PGs - for (hash_map::iterator p = pg_map.begin(); + for (ceph::unordered_map::iterator p = pg_map.begin(); p != pg_map.end(); ++p) { dout(20) << " kicking pg " << p->first << dendl; @@ -1543,7 +1543,7 @@ int OSD::shutdown() #ifdef PG_DEBUG_REFS service.dump_live_pgids(); #endif - for (hash_map::iterator p = pg_map.begin(); + for (ceph::unordered_map::iterator p = pg_map.begin(); p != pg_map.end(); ++p) { dout(20) << " kicking pg " << p->first << dendl; @@ -2004,7 +2004,7 @@ void OSD::build_past_intervals_parallel() // calculate untion of map range epoch_t end_epoch = superblock.oldest_map; epoch_t cur_epoch = superblock.newest_map; - for (hash_map::iterator i = pg_map.begin(); + for (ceph::unordered_map::iterator i = pg_map.begin(); i != pg_map.end(); ++i) { PG *pg = i->second; @@ -2582,7 +2582,7 @@ void OSD::maybe_update_heartbeat_peers() // build heartbeat from set if (is_active()) { - for (hash_map::iterator i = pg_map.begin(); + for (ceph::unordered_map::iterator i = pg_map.begin(); i != pg_map.end(); ++i) { PG *pg = i->second; @@ -4169,7 +4169,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector& cmd, bufferlist } std::set keys; - for (hash_map::const_iterator pg_map_e = pg_map.begin(); + for (ceph::unordered_map::const_iterator pg_map_e = pg_map.begin(); pg_map_e != pg_map.end(); ++pg_map_e) { keys.insert(pg_map_e->first); } @@ -4177,7 +4177,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector& cmd, bufferlist fout << "*** osd " << whoami << ": dump_missing ***" << std::endl; for (std::set ::iterator p = keys.begin(); p != keys.end(); ++p) { - hash_map::iterator q = pg_map.find(*p); + ceph::unordered_map::iterator q = pg_map.find(*p); assert(q != pg_map.end()); PG *pg = q->second; pg->lock(); @@ -4749,7 +4749,7 @@ void OSD::handle_scrub(MOSDScrub *m) } if (m->scrub_pgs.empty()) { - for (hash_map::iterator p = pg_map.begin(); + for (ceph::unordered_map::iterator p = pg_map.begin(); p != pg_map.end(); ++p) { PG *pg = p->second; @@ -5459,9 +5459,9 @@ void OSD::advance_map(ObjectStore::Transaction& t, C_Contexts *tfin) } // scan pg creations - hash_map::iterator n = creating_pgs.begin(); + ceph::unordered_map::iterator n = creating_pgs.begin(); while (n != creating_pgs.end()) { - hash_map::iterator p = n++; + ceph::unordered_map::iterator p = n++; pg_t pgid = p->first; // am i still primary? @@ -5509,7 +5509,7 @@ void OSD::consume_map() list to_remove; // scan pg's - for (hash_map::iterator it = pg_map.begin(); + for (ceph::unordered_map::iterator it = pg_map.begin(); it != pg_map.end(); ++it) { PG *pg = it->second; @@ -5546,7 +5546,7 @@ void OSD::consume_map() service.publish_map(osdmap); // scan pg's - for (hash_map::iterator it = pg_map.begin(); + for (ceph::unordered_map::iterator it = pg_map.begin(); it != pg_map.end(); ++it) { PG *pg = it->second; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 889822b39949..1dbd70bf1977 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -42,12 +42,11 @@ #include #include -#include +#include "include/memory.h" using namespace std; -#include -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" +#include "include/unordered_set.h" #include "Watch.h" #include "common/shared_cache.hpp" @@ -179,7 +178,7 @@ class HistoricOpsSocketHook; class TestOpsSocketHook; struct C_CompleteSplits; -typedef std::tr1::shared_ptr SequencerRef; +typedef ceph::shared_ptr SequencerRef; class DeletingState { Mutex lock; @@ -279,7 +278,7 @@ public: return status != DELETED_DIR; } ///< @return true if we don't need to recreate the collection }; -typedef std::tr1::shared_ptr DeletingStateRef; +typedef ceph::shared_ptr DeletingStateRef; class OSD; class OSDService { @@ -1142,7 +1141,7 @@ private: protected: // -- placement groups -- - hash_map pg_map; + ceph::unordered_map pg_map; map > waiting_for_pg; map > peering_wait_for_split; PGRecoveryStats pg_recovery_stats; @@ -1220,7 +1219,7 @@ protected: set prior; pg_t parent; }; - hash_map creating_pgs; + ceph::unordered_map creating_pgs; double debug_drop_pg_create_probability; int debug_drop_pg_create_duration; int debug_drop_pg_create_left; // 0 if we just dropped the last one, -1 if we can drop more diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 3f7e12945bd8..728d748ac240 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -795,7 +795,7 @@ bool OSDMap::is_blacklisted(const entity_addr_t& a) const void OSDMap::get_blacklist(list > *bl) const { - for (hash_map::const_iterator it = blacklist.begin() ; + for (ceph::unordered_map::const_iterator it = blacklist.begin() ; it != blacklist.end(); ++it) { bl->push_back(*it); } @@ -1898,7 +1898,7 @@ void OSDMap::dump(Formatter *f) const f->close_section(); // primary_temp f->open_array_section("blacklist"); - for (hash_map::const_iterator p = blacklist.begin(); + for (ceph::unordered_map::const_iterator p = blacklist.begin(); p != blacklist.end(); ++p) { stringstream ss; @@ -2027,7 +2027,7 @@ void OSDMap::print(ostream& out) const ++p) out << "primary_temp " << p->first << " " << p->second << "\n"; - for (hash_map::const_iterator p = blacklist.begin(); + for (ceph::unordered_map::const_iterator p = blacklist.begin(); p != blacklist.end(); ++p) out << "blacklist " << p->first << " expires " << p->second << "\n"; diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index b9690e8186bb..927ab182bfd2 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -38,11 +38,10 @@ #include #include #include -#include +#include "include/memory.h" using namespace std; -#include -using __gnu_cxx::hash_set; +#include "include/unordered_set.h" /* * we track up to two intervals during which the osd was alive and @@ -193,34 +192,34 @@ private: vector osd_state; struct addrs_s { - vector > client_addr; - vector > cluster_addr; - vector > hb_back_addr; - vector > hb_front_addr; + vector > client_addr; + vector > cluster_addr; + vector > hb_back_addr; + vector > hb_front_addr; entity_addr_t blank; }; - std::tr1::shared_ptr osd_addrs; + ceph::shared_ptr osd_addrs; vector<__u32> osd_weight; // 16.16 fixed point, 0x10000 = "in", 0 = "out" vector osd_info; - std::tr1::shared_ptr< map > > pg_temp; // temp pg mapping (e.g. while we rebuild) - std::tr1::shared_ptr< map > primary_temp; // temp primary mapping (e.g. while we rebuild) + ceph::shared_ptr< map > > pg_temp; // temp pg mapping (e.g. while we rebuild) + ceph::shared_ptr< map > primary_temp; // temp primary mapping (e.g. while we rebuild) map pools; map pool_name; map name_pool; - std::tr1::shared_ptr< vector > osd_uuid; + ceph::shared_ptr< vector > osd_uuid; vector osd_xinfo; - hash_map blacklist; + ceph::unordered_map blacklist; epoch_t cluster_snapshot_epoch; string cluster_snapshot; bool new_blacklist_entries; public: - std::tr1::shared_ptr crush; // hierarchical map + ceph::shared_ptr crush; // hierarchical map friend class OSDMonitor; friend class PGMonitor; @@ -706,7 +705,7 @@ public: WRITE_CLASS_ENCODER_FEATURES(OSDMap) WRITE_CLASS_ENCODER_FEATURES(OSDMap::Incremental) -typedef std::tr1::shared_ptr OSDMapRef; +typedef ceph::shared_ptr OSDMapRef; inline ostream& operator<<(ostream& out, const OSDMap& m) { m.print_oneline_summary(out); diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h index 96bb5a4864f6..96ae305a6234 100644 --- a/src/osd/OpRequest.h +++ b/src/osd/OpRequest.h @@ -21,7 +21,7 @@ #include "common/Mutex.h" #include "include/xlist.h" #include "msg/Message.h" -#include +#include "include/memory.h" #include "common/TrackedOp.h" /** @@ -157,7 +157,7 @@ public: void init_from_message(); - typedef std::tr1::shared_ptr Ref; + typedef ceph::shared_ptr Ref; }; typedef OpRequest::Ref OpRequestRef; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5e9dd7bbbf8f..3e66ad351574 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4501,7 +4501,7 @@ struct FlushState { pg->unlock(); } }; -typedef std::tr1::shared_ptr FlushStateRef; +typedef ceph::shared_ptr FlushStateRef; void PG::start_flush(ObjectStore::Transaction *t, list *on_applied, diff --git a/src/osd/PG.h b/src/osd/PG.h index 40417cf60f9f..1c338e853a4e 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include "include/memory.h" // re-include our assert to clobber boost's #include "include/assert.h" @@ -55,9 +55,8 @@ #include using namespace std; -#include -#include -using namespace __gnu_cxx; +#include "include/unordered_map.h" +#include "include/unordered_set.h" //#define DEBUG_RECOVERY_OIDS // track set of recovering oids explicitly, to find counting bugs @@ -554,7 +553,7 @@ protected: pg_stat_t pg_stats_publish; // for ordering writes - std::tr1::shared_ptr osr; + ceph::shared_ptr osr; void _update_calc_stats(); void publish_stats_to_osd(); @@ -967,7 +966,7 @@ public: const boost::statechart::event_base &get_event() { return *evt; } string get_desc() { return desc; } }; - typedef std::tr1::shared_ptr CephPeeringEvtRef; + typedef ceph::shared_ptr CephPeeringEvtRef; list peering_queue; // op queue list peering_waiters; diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 792191bea2a3..815d0c235e29 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -46,8 +46,8 @@ struct PGLog { * plus some methods to manipulate it all. */ struct IndexedLog : public pg_log_t { - hash_map objects; // ptrs into log. be careful! - hash_map caller_ops; + ceph::unordered_map objects; // ptrs into log. be careful! + ceph::unordered_map caller_ops; // recovery pointers list::iterator complete_to; // not inclusive of referenced item @@ -85,7 +85,7 @@ struct PGLog { return caller_ops.count(r); } const pg_log_entry_t *get_request(const osd_reqid_t &r) const { - hash_map::const_iterator p = caller_ops.find(r); + ceph::unordered_map::const_iterator p = caller_ops.find(r); if (p == caller_ops.end()) return NULL; return p->second; diff --git a/src/osd/Watch.h b/src/osd/Watch.h index ecb61ad8b729..8e98c9de37bd 100644 --- a/src/osd/Watch.h +++ b/src/osd/Watch.h @@ -15,7 +15,7 @@ #define CEPH_WATCH_H #include -#include +#include "include/memory.h" #include #include "msg/Messenger.h" @@ -35,12 +35,12 @@ struct ObjectContext; class MWatchNotify; class Watch; -typedef std::tr1::shared_ptr WatchRef; -typedef std::tr1::weak_ptr WWatchRef; +typedef ceph::shared_ptr WatchRef; +typedef ceph::weak_ptr WWatchRef; class Notify; -typedef std::tr1::shared_ptr NotifyRef; -typedef std::tr1::weak_ptr WNotifyRef; +typedef ceph::shared_ptr NotifyRef; +typedef ceph::weak_ptr WNotifyRef; struct CancelableContext; @@ -151,7 +151,7 @@ class Watch { OSDService *osd; boost::intrusive_ptr pg; - std::tr1::shared_ptr obc; + ceph::shared_ptr obc; std::map in_progress_notifies; @@ -165,7 +165,7 @@ class Watch { Watch( ReplicatedPG *pg, OSDService *osd, - std::tr1::shared_ptr obc, uint32_t timeout, + ceph::shared_ptr obc, uint32_t timeout, uint64_t cookie, entity_name_t entity, entity_addr_t addr); @@ -187,7 +187,7 @@ public: string gen_dbg_prefix(); static WatchRef makeWatchRef( ReplicatedPG *pg, OSDService *osd, - std::tr1::shared_ptr obc, uint32_t timeout, uint64_t cookie, entity_name_t entity, entity_addr_t addr); + ceph::shared_ptr obc, uint32_t timeout, uint64_t cookie, entity_name_t entity, entity_addr_t addr); void set_self(WatchRef _self) { self = _self; } @@ -195,7 +195,7 @@ public: /// Does not grant a ref count! boost::intrusive_ptr get_pg() { return pg; } - std::tr1::shared_ptr get_obc() { return obc; } + ceph::shared_ptr get_obc() { return obc; } uint64_t get_cookie() const { return cookie; } entity_name_t get_entity() const { return entity; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index cf11aa1437e7..bb58fa557016 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -35,6 +35,7 @@ #include "HitSet.h" #include "Watch.h" #include "OpRequest.h" +#include "include/hash_namespace.h" #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026" @@ -82,14 +83,14 @@ inline bool operator<=(const osd_reqid_t& l, const osd_reqid_t& r) { inline bool operator>(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l <= r); } inline bool operator>=(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l < r); } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const osd_reqid_t &r) const { static hash H; return H(r.name.num() ^ r.tid ^ r.inc); } }; -} +CEPH_HASH_NAMESPACE_END // ----- @@ -355,7 +356,7 @@ inline bool operator>=(const pg_t& l, const pg_t& r) { ostream& operator<<(ostream& out, const pg_t &pg); -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash< pg_t > { size_t operator()( const pg_t& x ) const @@ -364,7 +365,7 @@ namespace __gnu_cxx { return H((x.pool() & 0xffffffff) ^ (x.pool() >> 32) ^ x.ps() ^ x.preferred()); } }; -} +CEPH_HASH_NAMESPACE_END // ---------------------- @@ -448,7 +449,7 @@ inline ostream& operator<<(ostream& out, const coll_t& c) { return out; } -namespace __gnu_cxx { +CEPH_HASH_NAMESPACE_START template<> struct hash { size_t operator()(const coll_t &c) const { size_t h = 0; @@ -465,7 +466,7 @@ namespace __gnu_cxx { return h; } }; -} +CEPH_HASH_NAMESPACE_END inline ostream& operator<<(ostream& out, const ceph_object_layout &ol) { @@ -1502,8 +1503,8 @@ struct pg_interval_t { const vector &new_up, ///< [in] up as of osdmap epoch_t same_interval_since, ///< [in] as of osdmap epoch_t last_epoch_clean, ///< [in] current - std::tr1::shared_ptr osdmap, ///< [in] current map - std::tr1::shared_ptr lastmap, ///< [in] last map + ceph::shared_ptr osdmap, ///< [in] current map + ceph::shared_ptr lastmap, ///< [in] last map int64_t poolid, ///< [in] pool for pg pg_t pgid, ///< [in] pgid for pg map *past_intervals,///< [out] intervals @@ -2296,7 +2297,7 @@ struct SnapSetContext { struct ObjectContext; -typedef std::tr1::shared_ptr ObjectContextRef; +typedef ceph::shared_ptr ObjectContextRef; struct ObjectContext { ObjectState obs; diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index d518c6efaaed..6160d7005f13 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -522,7 +522,7 @@ ObjectCacher::~ObjectCacher() finisher.stop(); perf_stop(); // we should be empty. - for (vector >::iterator i = objects.begin(); + for (vector >::iterator i = objects.begin(); i != objects.end(); ++i) assert(i->empty()); @@ -1764,11 +1764,11 @@ uint64_t ObjectCacher::release_all() ldout(cct, 10) << "release_all" << dendl; uint64_t unclean = 0; - vector >::iterator i = objects.begin(); + vector >::iterator i = objects.begin(); while (i != objects.end()) { - hash_map::iterator p = i->begin(); + ceph::unordered_map::iterator p = i->begin(); while (p != i->end()) { - hash_map::iterator n = p; + ceph::unordered_map::iterator n = p; ++n; Object *ob = p->second; @@ -1853,10 +1853,10 @@ void ObjectCacher::verify_stats() const ldout(cct, 10) << "verify_stats" << dendl; loff_t clean = 0, zero = 0, dirty = 0, rx = 0, tx = 0, missing = 0, error = 0; - for (vector >::const_iterator i = objects.begin(); + for (vector >::const_iterator i = objects.begin(); i != objects.end(); ++i) { - for (hash_map::const_iterator p = i->begin(); + for (ceph::unordered_map::const_iterator p = i->begin(); p != i->end(); ++p) { Object *ob = p->second; diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index a62a41fd8ced..d7ba9d8a50b3 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -339,7 +339,7 @@ class ObjectCacher { flush_set_callback_t flush_set_callback; void *flush_set_callback_arg; - vector > objects; // indexed by pool_id + vector > objects; // indexed by pool_id tid_t last_read_tid; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 508cc379cb8e..a76580d1fd64 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -32,7 +32,6 @@ #include #include using namespace std; -using namespace __gnu_cxx; class Context; class Messenger; diff --git a/src/rbd.cc b/src/rbd.cc index a7243f438884..c6a3dcfef44c 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -40,7 +40,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include "include/rbd_types.h" @@ -1827,7 +1827,7 @@ static int do_kernel_showmapped(Formatter *f) TextTable tbl; const char *devices_path = "/sys/bus/rbd/devices"; - std::tr1::shared_ptr device_dir(opendir(devices_path), do_closedir); + ceph::shared_ptr device_dir(opendir(devices_path), do_closedir); if (!device_dir.get()) { r = -errno; cerr << "rbd: could not open " << devices_path << ": " diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index f3fb4f22480f..7cd62365b997 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -299,7 +299,7 @@ class RGWDataChangesLog { } }; - typedef std::tr1::shared_ptr ChangeStatusPtr; + typedef ceph::shared_ptr ChangeStatusPtr; lru_map changes; diff --git a/src/test/ObjectMap/KeyValueDBMemory.cc b/src/test/ObjectMap/KeyValueDBMemory.cc index 43fa60c47a1d..c03e16968a5c 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.cc +++ b/src/test/ObjectMap/KeyValueDBMemory.cc @@ -4,7 +4,7 @@ #include "KeyValueDBMemory.h" #include #include -#include +#include "include/memory.h" #include using namespace std; @@ -214,7 +214,7 @@ int KeyValueDBMemory::rmkeys_by_prefix(const string &prefix) { } KeyValueDB::WholeSpaceIterator KeyValueDBMemory::_get_iterator() { - return std::tr1::shared_ptr( + return ceph::shared_ptr( new WholeSpaceMemIterator(this) ); } @@ -243,7 +243,7 @@ public: KeyValueDB::WholeSpaceIterator KeyValueDBMemory::_get_snapshot_iterator() { KeyValueDBMemory *snap_db = new KeyValueDBMemory(this); - return std::tr1::shared_ptr( + return ceph::shared_ptr( new WholeSpaceSnapshotMemIterator(snap_db) ); } diff --git a/src/test/ObjectMap/KeyValueDBMemory.h b/src/test/ObjectMap/KeyValueDBMemory.h index 5cffce3ef04a..c67f9b5cc059 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.h +++ b/src/test/ObjectMap/KeyValueDBMemory.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include "include/memory.h" #include "os/KeyValueDB.h" #include "include/buffer.h" diff --git a/src/test/ObjectMap/test_keyvaluedb_atomicity.cc b/src/test/ObjectMap/test_keyvaluedb_atomicity.cc index e06a9ff9ecf1..04cef95d90ca 100644 --- a/src/test/ObjectMap/test_keyvaluedb_atomicity.cc +++ b/src/test/ObjectMap/test_keyvaluedb_atomicity.cc @@ -6,7 +6,7 @@ #include #include #include -#include +#include "include/memory.h" #include #include #include "stdlib.h" diff --git a/src/test/ObjectMap/test_keyvaluedb_iterators.cc b/src/test/ObjectMap/test_keyvaluedb_iterators.cc index c4a5e384fcca..cbe2ab1fb47a 100644 --- a/src/test/ObjectMap/test_keyvaluedb_iterators.cc +++ b/src/test/ObjectMap/test_keyvaluedb_iterators.cc @@ -10,7 +10,7 @@ * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ -#include +#include "include/memory.h" #include #include #include diff --git a/src/test/ObjectMap/test_object_map.cc b/src/test/ObjectMap/test_object_map.cc index b31455ea4102..eecd9ea4cf1e 100644 --- a/src/test/ObjectMap/test_object_map.cc +++ b/src/test/ObjectMap/test_object_map.cc @@ -1,5 +1,5 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -#include +#include "include/memory.h" #include #include #include diff --git a/src/test/bench/bencher.cc b/src/test/bench/bencher.cc index 32c3538fd026..c1781466a327 100644 --- a/src/test/bench/bencher.cc +++ b/src/test/bench/bencher.cc @@ -3,7 +3,7 @@ #include "bencher.h" #include "include/utime.h" #include -#include +#include "include/memory.h" #include "common/Mutex.h" #include "common/Cond.h" @@ -35,10 +35,10 @@ struct Cleanup : public Context { struct OnWriteApplied : public Context { Bencher *bench; uint64_t seq; - std::tr1::shared_ptr on_delete; + ceph::shared_ptr on_delete; OnWriteApplied( Bencher *bench, uint64_t seq, - std::tr1::shared_ptr on_delete + ceph::shared_ptr on_delete ) : bench(bench), seq(seq), on_delete(on_delete) {} void finish(int r) { bench->stat_collector->write_applied(seq); @@ -48,10 +48,10 @@ struct OnWriteApplied : public Context { struct OnWriteCommit : public Context { Bencher *bench; uint64_t seq; - std::tr1::shared_ptr on_delete; + ceph::shared_ptr on_delete; OnWriteCommit( Bencher *bench, uint64_t seq, - std::tr1::shared_ptr on_delete + ceph::shared_ptr on_delete ) : bench(bench), seq(seq), on_delete(on_delete) {} void finish(int r) { bench->stat_collector->write_committed(seq); @@ -120,7 +120,7 @@ void Bencher::init( Cond cond; bool done = 0; { - std::tr1::shared_ptr on_finish( + ceph::shared_ptr on_finish( new OnFinish(&done, &lock, &cond)); uint64_t num = 0; for (set::const_iterator i = objects.begin(); @@ -132,8 +132,8 @@ void Bencher::init( *i, 0, bl, - new C_Holder >(on_finish), - new C_Holder >(on_finish) + new C_Holder >(on_finish), + new C_Holder >(on_finish) ); } } @@ -162,7 +162,7 @@ void Bencher::run_bench() OpType op_type = next.get<3>(); switch (op_type) { case WRITE: { - std::tr1::shared_ptr on_delete( + ceph::shared_ptr on_delete( new OnDelete(new Cleanup(this))); stat_collector->start_write(seq, length); while (bl.length() < length) { diff --git a/src/test/bench/bencher.h b/src/test/bench/bencher.h index 3e18fc64d0a6..a4f6321b7b8f 100644 --- a/src/test/bench/bencher.h +++ b/src/test/bench/bencher.h @@ -27,7 +27,7 @@ public: private: boost::scoped_ptr< Distribution > > op_dist; - std::tr1::shared_ptr stat_collector; + ceph::shared_ptr stat_collector; boost::scoped_ptr backend; const uint64_t max_in_flight; const uint64_t max_duration; @@ -42,7 +42,7 @@ private: public: Bencher( Distribution > *op_gen, - std::tr1::shared_ptr stat_collector, + ceph::shared_ptr stat_collector, Backend *backend, uint64_t max_in_flight, uint64_t max_duration, diff --git a/src/test/bench/rbd_backend.cc b/src/test/bench/rbd_backend.cc index 51df9b9eba59..792889688155 100644 --- a/src/test/bench/rbd_backend.cc +++ b/src/test/bench/rbd_backend.cc @@ -26,7 +26,7 @@ void RBDBackend::write( Context *on_commit) { bufferlist &bl_non_const = const_cast(bl); - std::tr1::shared_ptr image = (*m_images)[oid]; + ceph::shared_ptr image = (*m_images)[oid]; void *arg = static_cast(new arg_type(on_commit, on_write_applied)); librbd::RBD::AioCompletion *completion = new librbd::RBD::AioCompletion(arg, on_complete); @@ -42,7 +42,7 @@ void RBDBackend::read( bufferlist *bl, Context *on_read_complete) { - std::tr1::shared_ptr image = (*m_images)[oid]; + ceph::shared_ptr image = (*m_images)[oid]; void *arg = static_cast(new arg_type(on_read_complete, NULL)); librbd::RBD::AioCompletion *completion = new librbd::RBD::AioCompletion(arg, on_complete); diff --git a/src/test/bench/rbd_backend.h b/src/test/bench/rbd_backend.h index 981c8d715fd5..9c3bc8bbc1c9 100644 --- a/src/test/bench/rbd_backend.h +++ b/src/test/bench/rbd_backend.h @@ -8,9 +8,9 @@ #include "include/rbd/librbd.hpp" class RBDBackend : public Backend { - map > *m_images; + map > *m_images; public: - RBDBackend(map > *images) + RBDBackend(map > *images) : m_images(images) {} void write( const string &oid, diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index 6f4ac07d3620..7f03f5ad2a3c 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -150,7 +150,7 @@ int main(int argc, char **argv) detailed_ops = &cerr; } - std::tr1::shared_ptr col( + ceph::shared_ptr col( new DetailedStatCollector( 1, new JSONFormatter, detailed_ops, &cout, new MorePrinting(g_ceph_context))); @@ -175,9 +175,9 @@ int main(int argc, char **argv) fs.apply_transaction(t); } - vector > benchers( + vector > benchers( vm["num-writers"].as()); - for (vector >::iterator i = benchers.begin(); + for (vector >::iterator i = benchers.begin(); i != benchers.end(); ++i) { set objects; @@ -227,12 +227,12 @@ int main(int argc, char **argv) (*i).reset(bencher); } - for (vector >::iterator i = benchers.begin(); + for (vector >::iterator i = benchers.begin(); i != benchers.end(); ++i) { (*i)->create(); } - for (vector >::iterator i = benchers.begin(); + for (vector >::iterator i = benchers.begin(); i != benchers.end(); ++i) { (*i)->join(); diff --git a/src/test/bench/small_io_bench_rbd.cc b/src/test/bench/small_io_bench_rbd.cc index 4c56ffd4e220..ba7071ed3833 100644 --- a/src/test/bench/small_io_bench_rbd.cc +++ b/src/test/bench/small_io_bench_rbd.cc @@ -132,7 +132,7 @@ int main(int argc, char **argv) librbd::RBD rbd; { - map > images; + map > images; int order = vm["order"].as(); uint64_t image_size = ((uint64_t)vm["image-size"].as()) << 20; for (set::const_iterator i = image_names.begin(); @@ -142,7 +142,7 @@ int main(int argc, char **argv) cerr << "error creating image " << *i << " r=" << r << std::endl; return -r; } - std::tr1::shared_ptr image(new librbd::Image()); + ceph::shared_ptr image(new librbd::Image()); r = rbd.open(ioctx, *image, i->c_str()); if (r < 0) { cerr << "error opening image " << *i << " r=" << r << std::endl; diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index 506a0c6ab59c..cf63f2fccfc4 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -19,7 +19,7 @@ * */ -#include +#include "include/memory.h" #include #include #include @@ -2144,7 +2144,7 @@ TEST(BufferList, TestDirectAppend) { TEST(BufferList, TestCopyAll) { const static size_t BIG_SZ = 10737414; - std::tr1::shared_ptr big( + ceph::shared_ptr big( (unsigned char*)malloc(BIG_SZ), free); unsigned char c = 0; for (size_t i = 0; i < BIG_SZ; ++i) { @@ -2156,7 +2156,7 @@ TEST(BufferList, TestCopyAll) { bufferlist bl2; i.copy_all(bl2); ASSERT_EQ(bl2.length(), BIG_SZ); - std::tr1::shared_ptr big2( + ceph::shared_ptr big2( (unsigned char*)malloc(BIG_SZ), free); bl2.copy(0, BIG_SZ, (char*)big2.get()); ASSERT_EQ(memcmp(big.get(), big2.get(), BIG_SZ), 0); diff --git a/src/test/confutils.cc b/src/test/confutils.cc index af33ca560d99..61b92d44a766 100644 --- a/src/test/confutils.cc +++ b/src/test/confutils.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include "include/memory.h" using ceph::bufferlist; using std::cerr; @@ -78,7 +78,7 @@ static int create_tempfile(const std::string &fname, const char *text) << get_temp_dir() << "'. " << cpp_strerror(err) << std::endl; return err; } - std::tr1::shared_ptr fpp(fp, fclose); + ceph::shared_ptr fpp(fp, fclose); if (unlink_idx >= MAX_FILES_TO_DELETE) return -ENOBUFS; if (unlink_idx == 0) { diff --git a/src/test/filestore/store_test.cc b/src/test/filestore/store_test.cc index 386259de529c..c44711c08add 100644 --- a/src/test/filestore/store_test.cc +++ b/src/test/filestore/store_test.cc @@ -30,8 +30,7 @@ #include #include -#include -using __gnu_cxx::hash_map; +#include "include/unordered_map.h" typedef boost::mt11213b gen_type; class StoreTest : public ::testing::Test { diff --git a/src/test/os/TestFlatIndex.cc b/src/test/os/TestFlatIndex.cc index 1326bc663772..7bb2d42f225a 100644 --- a/src/test/os/TestFlatIndex.cc +++ b/src/test/os/TestFlatIndex.cc @@ -61,7 +61,7 @@ TEST(FlatIndex, created_unlink) { const std::string base_path("PATH"); EXPECT_EQ(0, ::system("rm -fr PATH")); EXPECT_EQ(0, ::mkdir("PATH", 0700)); - std::tr1::shared_ptr index(new FlatIndex(collection, base_path)); + ceph::shared_ptr index(new FlatIndex(collection, base_path)); const std::string key("KEY"); uint64_t hash = 111; uint64_t pool = 222; @@ -111,7 +111,7 @@ TEST(FlatIndex, collection_list) { const std::string object_name("ABC"); const std::string filename("PATH/" + object_name + "_head"); EXPECT_EQ(0, ::close(::creat(filename.c_str(), 0600))); - std::tr1::shared_ptr index(new FlatIndex(collection, base_path)); + ceph::shared_ptr index(new FlatIndex(collection, base_path)); vector ls; index->collection_list(&ls); EXPECT_EQ((unsigned)1, ls.size()); diff --git a/src/test/os/TestLFNIndex.cc b/src/test/os/TestLFNIndex.cc index 02578eb4a714..74fdf66d87f4 100644 --- a/src/test/os/TestLFNIndex.cc +++ b/src/test/os/TestLFNIndex.cc @@ -42,7 +42,7 @@ public: virtual int _split( uint32_t match, uint32_t bits, - std::tr1::shared_ptr dest + ceph::shared_ptr dest ) { return 0; } void test_generate_and_parse(const ghobject_t &hoid, const std::string &mangled_expected) { diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index 97cfd786dbc7..4deb2f720395 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -18,6 +18,7 @@ #include "Object.h" #include "TestOpStat.h" #include "test/librados/test.h" +#include "include/memory.h" #include "common/sharedptr_registry.hpp" #include "common/errno.h" #include "osd/HitSet.h" @@ -985,7 +986,7 @@ public: ObjectDesc old_value; int snap; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; bufferlist result; int retval; @@ -1345,7 +1346,7 @@ public: bool done; librados::ObjectWriteOperation op; librados::AioCompletion *comp; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; RollbackOp(int n, RadosTestContext *context, @@ -1410,7 +1411,7 @@ public: context->update_object_version(oid, comp->get_version64()); context->oid_in_use.erase(oid); context->oid_not_in_use.insert(oid); - in_use = std::tr1::shared_ptr(); + in_use = ceph::shared_ptr(); context->kick(); } @@ -1433,7 +1434,7 @@ public: librados::ObjectReadOperation rd_op; librados::AioCompletion *comp; librados::AioCompletion *comp_racing_read; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; int snap; int done; uint64_t version; @@ -1698,7 +1699,7 @@ public: bool dirty; ObjectDesc old_value; int snap; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; IsDirtyOp(int n, RadosTestContext *context, @@ -1794,7 +1795,7 @@ public: bool blocking; int snap; bool can_fail; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; CacheFlushOp(int n, RadosTestContext *context, @@ -1903,7 +1904,7 @@ public: librados::AioCompletion *completion; librados::ObjectReadOperation op; string oid; - std::tr1::shared_ptr in_use; + ceph::shared_ptr in_use; CacheEvictOp(int n, RadosTestContext *context, diff --git a/src/test/osdc/object_cacher_stress.cc b/src/test/osdc/object_cacher_stress.cc index ee71b0e898cf..4f6fffe05c99 100644 --- a/src/test/osdc/object_cacher_stress.cc +++ b/src/test/osdc/object_cacher_stress.cc @@ -67,7 +67,7 @@ int stress_test(uint64_t num_ops, uint64_t num_objs, obc.start(); atomic_t outstanding_reads; - vector > ops; + vector > ops; ObjectCacher::ObjectSet object_set(NULL, 0, 0); SnapContext snapc; ceph::buffer::ptr bp(max_op_len); @@ -91,7 +91,7 @@ int stress_test(uint64_t num_ops, uint64_t num_objs, uint64_t length = random() % (MAX(max_len - 1, 1)) + 1; std::string oid = "test" + stringify(random() % num_objs); bool is_read = random() < percent_reads * RAND_MAX; - std::tr1::shared_ptr op(new op_data(oid, offset, length, is_read)); + ceph::shared_ptr op(new op_data(oid, offset, length, is_read)); ops.push_back(op); std::cout << "op " << i << " " << (is_read ? "read" : "write") << " " << op->extent << "\n"; diff --git a/src/test/test_osd_types.cc b/src/test/test_osd_types.cc index 65726ea46a39..bcc71c37bd13 100644 --- a/src/test/test_osd_types.cc +++ b/src/test/test_osd_types.cc @@ -126,11 +126,11 @@ TEST(pg_interval_t, check_new_interval) // int osd_id = 1; epoch_t epoch = 40; - std::tr1::shared_ptr osdmap(new OSDMap()); + ceph::shared_ptr osdmap(new OSDMap()); osdmap->set_max_osd(10); osdmap->set_state(osd_id, CEPH_OSD_EXISTS); osdmap->set_epoch(epoch); - std::tr1::shared_ptr lastmap(new OSDMap()); + ceph::shared_ptr lastmap(new OSDMap()); lastmap->set_max_osd(10); lastmap->set_state(osd_id, CEPH_OSD_EXISTS); lastmap->set_epoch(epoch); @@ -184,7 +184,7 @@ TEST(pg_interval_t, check_new_interval) // pool did not exist in the old osdmap // { - std::tr1::shared_ptr lastmap(new OSDMap()); + ceph::shared_ptr lastmap(new OSDMap()); lastmap->set_max_osd(10); lastmap->set_state(osd_id, CEPH_OSD_EXISTS); lastmap->set_epoch(epoch); @@ -272,7 +272,7 @@ TEST(pg_interval_t, check_new_interval) // PG is splitting // { - std::tr1::shared_ptr osdmap(new OSDMap()); + ceph::shared_ptr osdmap(new OSDMap()); osdmap->set_max_osd(10); osdmap->set_state(osd_id, CEPH_OSD_EXISTS); osdmap->set_epoch(epoch); @@ -307,7 +307,7 @@ TEST(pg_interval_t, check_new_interval) // PG size has changed // { - std::tr1::shared_ptr osdmap(new OSDMap()); + ceph::shared_ptr osdmap(new OSDMap()); osdmap->set_max_osd(10); osdmap->set_state(osd_id, CEPH_OSD_EXISTS); osdmap->set_epoch(epoch); @@ -383,7 +383,7 @@ TEST(pg_interval_t, check_new_interval) // The new osdmap is created so that it triggers the // bug. // - std::tr1::shared_ptr osdmap(new OSDMap()); + ceph::shared_ptr osdmap(new OSDMap()); osdmap->set_max_osd(10); osdmap->set_state(osd_id, CEPH_OSD_EXISTS); osdmap->set_epoch(epoch); @@ -455,7 +455,7 @@ TEST(pg_interval_t, check_new_interval) new_acting.push_back(osd_id + 4); new_acting.push_back(osd_id + 5); - std::tr1::shared_ptr lastmap(new OSDMap()); + ceph::shared_ptr lastmap(new OSDMap()); lastmap->set_max_osd(10); lastmap->set_state(osd_id, CEPH_OSD_EXISTS); lastmap->set_epoch(epoch); @@ -500,7 +500,7 @@ TEST(pg_interval_t, check_new_interval) epoch_t last_epoch_clean = epoch - 10; - std::tr1::shared_ptr lastmap(new OSDMap()); + ceph::shared_ptr lastmap(new OSDMap()); lastmap->set_max_osd(10); lastmap->set_state(osd_id, CEPH_OSD_EXISTS); lastmap->set_epoch(epoch); diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index 41ba0446961e..eaf308cbb5f9 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -1,5 +1,5 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -#include +#include "include/memory.h" #include #include #include @@ -42,7 +42,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { virtual void operate(map *store) = 0; virtual ~_Op() {} }; - typedef std::tr1::shared_ptr<_Op> Op; + typedef ceph::shared_ptr<_Op> Op; struct Remove : public _Op { set to_remove; Remove(const set &to_remove) : to_remove(to_remove) {} @@ -582,7 +582,7 @@ public: class SnapMapperTest : public ::testing::Test { protected: boost::scoped_ptr< PausyAsyncMap > driver; - map > mappers; + map > mappers; uint32_t pgnum; virtual void SetUp() { diff --git a/src/test/xattr_bench.cc b/src/test/xattr_bench.cc index 2baaee82ccb7..2b8d09ff29dc 100644 --- a/src/test/xattr_bench.cc +++ b/src/test/xattr_bench.cc @@ -29,7 +29,7 @@ #include #include -#include +#include "include/unordered_map.h" void usage(const string &name) { std::cerr << "Usage: " << name << " [xattr|omap] store_path store_journal" diff --git a/src/tools/dupstore.cc b/src/tools/dupstore.cc index c8b8ece31c8c..592b4b716d31 100644 --- a/src/tools/dupstore.cc +++ b/src/tools/dupstore.cc @@ -17,8 +17,7 @@ #include "common/ceph_argparse.h" #include "global/global_init.h" -#include -using __gnu_cxx::hash_map; +#include "include/unordered_map.h" int dupstore(ObjectStore* src, ObjectStore* dst) { @@ -27,7 +26,7 @@ int dupstore(ObjectStore* src, ObjectStore* dst) if (dst->mount() < 0) return 1; // objects - hash_map did_object; + ceph::unordered_map did_object; // collections vector collections; diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index c2f4ba1564be..71485729eb70 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -280,7 +280,7 @@ int main(int argc, const char **argv) while (1) { cout << "pass " << ++pass << std::endl; - hash_map > m; + ceph::unordered_map > m; for (map::const_iterator p = osdmap.get_pools().begin(); p != osdmap.get_pools().end(); ++p) { -- 2.47.3