Remove hardcode of the EC(2+1) scheme, now it supports EC(k+1), fix some bugs
This commit is contained in:
+2
-10
@@ -2,23 +2,15 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Max 64 replicas
|
||||
#define STRIPE_MASK 0x3F
|
||||
#define STRIPE_SHIFT 6
|
||||
|
||||
// 16 bytes per object/stripe id
|
||||
// stripe includes replica number in 6 (or maybe 4, see above) least significant bits
|
||||
// stripe = (start of the parity stripe + peer role)
|
||||
// i.e. for example (256KB + one of 0,1,2)
|
||||
struct __attribute__((__packed__)) object_id
|
||||
{
|
||||
uint64_t inode;
|
||||
uint64_t stripe;
|
||||
};
|
||||
|
||||
inline uint64_t operator % (const object_id & a, const uint64_t b)
|
||||
{
|
||||
return ((a.inode % b) * (0x100000000 % b) * (0x100000000 % b) + (a.stripe >> STRIPE_SHIFT) % b) % b;
|
||||
}
|
||||
|
||||
inline bool operator == (const object_id & a, const object_id & b)
|
||||
{
|
||||
return a.inode == b.inode && a.stripe == b.stripe;
|
||||
|
||||
Reference in New Issue
Block a user