uint64_t poolid(pool);
t += snprintf(t, end - t, "%.*llX", 16, (long long unsigned)poolid);
- uint32_t revhash(get_filestore_key_u32());
+ uint32_t revhash(get_nibblewise_key_u32());
t += snprintf(t, end - t, ".%.*X", 8, revhash);
if (snap == CEPH_NOSNAP)
return -1;
if (l.pool > r.pool)
return 1;
- if (l.get_filestore_key() < r.get_filestore_key())
+ if (l.get_nibblewise_key() < r.get_nibblewise_key())
return -1;
- if (l.get_filestore_key() > r.get_filestore_key())
+ if (l.get_nibblewise_key() > r.get_nibblewise_key())
return 1;
if (l.nspace < r.nspace)
return -1;
max = false;
}
DECODE_FINISH(bl);
- hobj.set_hash(hobj.get_hash()); //to call build_filestore_key_cache();
+ hobj.build_hash_cache();
}
void ghobject_t::decode(json_spirit::Value& v)
#include "json_spirit/json_spirit_value.h"
#include "include/assert.h" // spirit clobbers it!
-typedef uint64_t filestore_hobject_key_t;
-
namespace ceph {
class Formatter;
}
private:
uint32_t hash;
bool max;
- filestore_hobject_key_t filestore_key_cache;
+ uint32_t nibblewise_key_cache;
uint32_t hash_reverse_bits;
static const int64_t POOL_META = -1;
static const int64_t POOL_TEMP_START = -2; // and then negative
int64_t pool);
// filestore nibble-based key
- filestore_hobject_key_t get_filestore_key_u32() const {
+ uint32_t get_nibblewise_key_u32() const {
assert(!max);
- return filestore_key_cache;
+ return nibblewise_key_cache;
}
- filestore_hobject_key_t get_filestore_key() const {
- return max ? 0x100000000ull : filestore_key_cache;
+ uint64_t get_nibblewise_key() const {
+ return max ? 0x100000000ull : nibblewise_key_cache;
}
// newer bit-reversed key
}
void build_hash_cache() {
- filestore_key_cache = _reverse_nibbles(hash);
+ nibblewise_key_cache = _reverse_nibbles(hash);
hash_reverse_bits = _reverse_bits(hash);
}
- void set_filestore_key_u32(uint32_t value) {
+ void set_nibblewise_key_u32(uint32_t value) {
hash = _reverse_nibbles(value);
build_hash_cache();
}
ret.hobj.pool = hobj.pool;
return ret;
}
- filestore_hobject_key_t get_filestore_key_u32() const {
- return hobj.get_filestore_key_u32();
+ uint32_t get_nibblewise_key_u32() const {
+ return hobj.get_nibblewise_key_u32();
}
- filestore_hobject_key_t get_filestore_key() const {
- return hobj.get_filestore_key();
+ uint32_t get_nibblewise_key() const {
+ return hobj.get_nibblewise_key();
}
bool is_degenerate() const {
t = buf;
snprintf(t, end - t, "%.*X", (int)(sizeof(oid.hobj.get_hash())*2),
- (uint32_t)oid.get_filestore_key_u32());
+ (uint32_t)oid.get_nibblewise_key_u32());
full_name += string(buf);
full_name.append(GHOBJECT_KEY_SEP_S);
(*out) = ghobject_t(hobject_t(name, key, snap, hash, (int64_t)pool, ns),
generation, shard_id);
// restore reversed hash. see calculate_key
- out->hobj.set_hash(out->get_filestore_key());
+ out->hobj.set_hash(out->get_nibblewise_key());
}
if (out_coll) {
void HashIndex::get_path_components(const ghobject_t &oid,
vector<string> *path) {
char buf[MAX_HASH_LEVEL + 1];
- snprintf(buf, sizeof(buf), "%.*X", MAX_HASH_LEVEL, (uint32_t)oid.hobj.get_filestore_key());
+ snprintf(buf, sizeof(buf), "%.*X", MAX_HASH_LEVEL, (uint32_t)oid.hobj.get_nibblewise_key());
// Path components are the hex characters of oid.hobj.hash, least
// significant first