mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
hobject_t: make filestore_hobject_key_t 64 bits
So we can return 0x100000000 when max=true. Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
parent
997265a245
commit
0807e7d523
@ -259,7 +259,7 @@ namespace __gnu_cxx {
|
||||
};
|
||||
}
|
||||
|
||||
typedef uint32_t filestore_hobject_key_t;
|
||||
typedef uint64_t filestore_hobject_key_t;
|
||||
struct hobject_t {
|
||||
object_t oid;
|
||||
snapid_t snap;
|
||||
@ -293,8 +293,7 @@ public:
|
||||
return max;
|
||||
}
|
||||
|
||||
filestore_hobject_key_t get_filestore_key() const {
|
||||
uint32_t retval = hash;
|
||||
static uint32_t _reverse_nibbles(uint32_t retval) {
|
||||
// reverse nibbles
|
||||
retval = ((retval & 0x0f0f0f0f) << 4) | ((retval & 0xf0f0f0f0) >> 4);
|
||||
retval = ((retval & 0x00ff00ff) << 8) | ((retval & 0xff00ff00) >> 8);
|
||||
@ -302,6 +301,16 @@ public:
|
||||
return retval;
|
||||
}
|
||||
|
||||
filestore_hobject_key_t get_filestore_key() const {
|
||||
if (max)
|
||||
return 0x100000000ull;
|
||||
else
|
||||
return _reverse_nibbles(hash);
|
||||
}
|
||||
void set_filestore_key(uint32_t v) {
|
||||
hash = _reverse_nibbles(v);
|
||||
}
|
||||
|
||||
/* Do not use when a particular hash function is needed */
|
||||
explicit hobject_t(const sobject_t &o) :
|
||||
oid(o.oid), snap(o.snap) {
|
||||
|
@ -385,7 +385,7 @@ int HashIndex::complete_split(const vector<string> &path, subdir_info_s info) {
|
||||
void HashIndex::get_path_components(const hobject_t &hoid,
|
||||
vector<string> *path) {
|
||||
char buf[MAX_HASH_LEVEL + 1];
|
||||
snprintf(buf, sizeof(buf), "%.*X", MAX_HASH_LEVEL, hoid.get_filestore_key());
|
||||
snprintf(buf, sizeof(buf), "%.*X", MAX_HASH_LEVEL, (uint32_t)hoid.get_filestore_key());
|
||||
|
||||
// Path components are the hex characters of hoid.hash, least
|
||||
// significant first
|
||||
|
Loading…
Reference in New Issue
Block a user