Use std::hash<object_id> instead of oid_hash

blocking-uring-test
Vitaliy Filippov 2019-12-15 14:54:00 +03:00
parent a7e74670a5
commit 71635f2327
2 changed files with 13 additions and 11 deletions

View File

@ -53,10 +53,11 @@ 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<object_id>
{
inline size_t operator()(const object_id &s) const
{
size_t seed = 0;
// Copy-pasted from spp::hash_combine()
@ -64,7 +65,8 @@ public:
seed ^= (s.stripe + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2));
return seed;
}
};
};
}
#define OP_READ 1
#define OP_WRITE 2

View File

@ -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<object_id, clean_entry, oid_hash> clean_db;
spp::sparse_hash_map<object_id, clean_entry> clean_db;
std::map<obj_ver_id, dirty_entry> dirty_db;
std::list<blockstore_op_t*> submit_queue; // FIXME: funny thing is that vector is better here
std::vector<obj_ver_id> unsynced_big_writes, unsynced_small_writes;