forked from vitalif/vitastor
Use std::hash<object_id> instead of oid_hash
parent
a7e74670a5
commit
71635f2327
22
blockstore.h
22
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;
|
return a.oid < b.oid || a.oid == b.oid && a.version < b.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
class oid_hash
|
namespace std
|
||||||
{
|
{
|
||||||
public:
|
template<> struct hash<object_id>
|
||||||
size_t operator()(const object_id &s) const
|
|
||||||
{
|
{
|
||||||
size_t seed = 0;
|
inline size_t operator()(const object_id &s) const
|
||||||
// Copy-pasted from spp::hash_combine()
|
{
|
||||||
seed ^= (s.inode + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2));
|
size_t seed = 0;
|
||||||
seed ^= (s.stripe + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2));
|
// Copy-pasted from spp::hash_combine()
|
||||||
return seed;
|
seed ^= (s.inode + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2));
|
||||||
}
|
seed ^= (s.stripe + 0xc6a4a7935bd1e995 + (seed << 6) + (seed >> 2));
|
||||||
};
|
return seed;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#define OP_READ 1
|
#define OP_READ 1
|
||||||
#define OP_WRITE 2
|
#define OP_WRITE 2
|
||||||
|
|
|
@ -170,7 +170,7 @@ class blockstore_impl_t
|
||||||
struct ring_consumer_t ring_consumer;
|
struct ring_consumer_t ring_consumer;
|
||||||
|
|
||||||
// Another option is https://github.com/algorithm-ninja/cpp-btree
|
// 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::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::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;
|
std::vector<obj_ver_id> unsynced_big_writes, unsynced_small_writes;
|
||||||
|
|
Loading…
Reference in New Issue