From: Sage Weil Date: Tue, 18 Aug 2015 19:13:35 +0000 (-0400) Subject: common/hobject: rename get_filestore_key* -> get_nibblewise_key* X-Git-Tag: v9.1.0~324^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d94a52c9322077829c52fade2caffb39c23da45b;p=ceph.git common/hobject: rename get_filestore_key* -> get_nibblewise_key* Signed-off-by: Sage Weil --- diff --git a/src/common/hobject.cc b/src/common/hobject.cc index 8fbaf7a722f..1795cab0f35 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -80,7 +80,7 @@ string hobject_t::to_str() const 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) @@ -226,9 +226,9 @@ int cmp_nibblewise(const hobject_t& l, const hobject_t& r) 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; @@ -341,7 +341,7 @@ void ghobject_t::decode(bufferlist::iterator& bl) 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) diff --git a/src/common/hobject.h b/src/common/hobject.h index 0d74e21478e..2d1c3c7e422 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -23,8 +23,6 @@ #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; } @@ -42,7 +40,7 @@ struct hobject_t { 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 @@ -212,12 +210,12 @@ public: 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 @@ -230,10 +228,10 @@ public: } 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(); } @@ -388,11 +386,11 @@ public: 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 { diff --git a/src/os/GenericObjectMap.cc b/src/os/GenericObjectMap.cc index a397a05724c..c289ae21042 100644 --- a/src/os/GenericObjectMap.cc +++ b/src/os/GenericObjectMap.cc @@ -133,7 +133,7 @@ string GenericObjectMap::header_key(const coll_t &cid, const ghobject_t &oid) 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); @@ -265,7 +265,7 @@ bool GenericObjectMap::parse_header_key(const string &long_name, (*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) { diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc index 06894782004..2c69d816c81 100644 --- a/src/os/HashIndex.cc +++ b/src/os/HashIndex.cc @@ -789,7 +789,7 @@ int HashIndex::complete_split(const vector &path, subdir_info_s info) { void HashIndex::get_path_components(const ghobject_t &oid, vector *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