]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/hobject: rename get_filestore_key* -> get_nibblewise_key*
authorSage Weil <sage@redhat.com>
Tue, 18 Aug 2015 19:13:35 +0000 (15:13 -0400)
committerSage Weil <sage@redhat.com>
Wed, 19 Aug 2015 21:03:58 +0000 (17:03 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/hobject.cc
src/common/hobject.h
src/os/GenericObjectMap.cc
src/os/HashIndex.cc

index 8fbaf7a722f62f5a8cb53abef04675cb1bca67e8..1795cab0f35fee98989beee784b4f9cd406d8cb9 100644 (file)
@@ -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)
index 0d74e21478ec3231261d054c8a0da674456ccb23..2d1c3c7e4228d1d21bc7a1f3d169e081230ac7c9 100644 (file)
@@ -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 {
index a397a05724cd4a85544ee542fc8ecdc6a9b99618..c289ae210421dfe4468b77bc240c0ad9d4afd1cf 100644 (file)
@@ -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) {
index 06894782004b88928a755edae7dd3e789fd13f06..2c69d816c81a6ead4d46ecea251700a46d0aa487 100644 (file)
@@ -789,7 +789,7 @@ int HashIndex::complete_split(const vector<string> &path, subdir_info_s info) {
 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