diff --git a/blockstore.h b/blockstore.h index 44bfcb89b..f68d01a7d 100644 --- a/blockstore.h +++ b/blockstore.h @@ -53,18 +53,20 @@ inline bool operator < (const obj_ver_id & a, const obj_ver_id & b) return a.oid < b.oid || a.oid == b.oid && a.version < b.version; } -class oid_hash +namespace std { -public: - size_t operator()(const object_id &s) const + template<> struct hash { - size_t seed = 0; - // Copy-pasted from spp::hash_combine() - seed ^= (s.inode + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2)); - seed ^= (s.stripe + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2)); - return seed; - } -}; + inline size_t operator()(const object_id &s) const + { + size_t seed = 0; + // Copy-pasted from spp::hash_combine() + seed ^= (s.inode + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2)); + seed ^= (s.stripe + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2)); + return seed; + } + }; +} #define OP_READ 1 #define OP_WRITE 2 diff --git a/blockstore_impl.h b/blockstore_impl.h index 23010e38e..68a4f1cd6 100644 --- a/blockstore_impl.h +++ b/blockstore_impl.h @@ -170,7 +170,7 @@ class blockstore_impl_t struct ring_consumer_t ring_consumer; // Another option is https://github.com/algorithm-ninja/cpp-btree - spp::sparse_hash_map clean_db; + spp::sparse_hash_map clean_db; std::map dirty_db; std::list submit_queue; // FIXME: funny thing is that vector is better here std::vector unsynced_big_writes, unsynced_small_writes;