]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/hobject.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / common / hobject.cc
index d3f554f7a5790d7e69969a6cb9575f56433134d0..e5da4a35d86b0855eba5e4f7da20ddfb36976075 100644 (file)
@@ -104,32 +104,32 @@ string hobject_t::to_str() const
 void hobject_t::encode(bufferlist& bl) const
 {
   ENCODE_START(4, 3, bl);
-  ::encode(key, bl);
-  ::encode(oid, bl);
-  ::encode(snap, bl);
-  ::encode(hash, bl);
-  ::encode(max, bl);
-  ::encode(nspace, bl);
-  ::encode(pool, bl);
-  assert(!max || (*this == hobject_t(hobject_t::get_max())));
+  encode(key, bl);
+  encode(oid, bl);
+  encode(snap, bl);
+  encode(hash, bl);
+  encode(max, bl);
+  encode(nspace, bl);
+  encode(pool, bl);
+  ceph_assert(!max || (*this == hobject_t(hobject_t::get_max())));
   ENCODE_FINISH(bl);
 }
 
-void hobject_t::decode(bufferlist::iterator& bl)
+void hobject_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl);
   if (struct_v >= 1)
-    ::decode(key, bl);
-  ::decode(oid, bl);
-  ::decode(snap, bl);
-  ::decode(hash, bl);
+    decode(key, bl);
+  decode(oid, bl);
+  decode(snap, bl);
+  decode(hash, bl);
   if (struct_v >= 2)
-    ::decode(max, bl);
+    decode(max, bl);
   else
     max = false;
   if (struct_v >= 4) {
-    ::decode(nspace, bl);
-    ::decode(pool, bl);
+    decode(nspace, bl);
+    decode(pool, bl);
     // for compat with hammer, which did not handle the transition
     // from pool -1 -> pool INT64_MIN for MIN properly.  this object
     // name looks a bit like a pgmeta object for the meta collection,
@@ -140,7 +140,7 @@ void hobject_t::decode(bufferlist::iterator& bl)
        !max &&
        oid.name.empty()) {
       pool = INT64_MIN;
-      assert(is_min());
+      ceph_assert(is_min());
     }
 
     // for compatibility with some earlier verisons which might encoded
@@ -336,10 +336,14 @@ int cmp(const hobject_t& l, const hobject_t& r)
     return -1;
   if (l.nspace > r.nspace)
     return 1;
-  if (l.get_effective_key() < r.get_effective_key())
-    return -1;
-  if (l.get_effective_key() > r.get_effective_key())
-    return 1;
+  if (!(l.get_key().empty() && r.get_key().empty())) {
+    if (l.get_effective_key() < r.get_effective_key()) {
+      return -1;
+    }
+    if (l.get_effective_key() > r.get_effective_key()) {
+      return 1;
+    }
+  }
   if (l.oid < r.oid)
     return -1;
   if (l.oid > r.oid)
@@ -359,16 +363,16 @@ void ghobject_t::encode(bufferlist& bl) const
 {
   // when changing this, remember to update encoded_size() too.
   ENCODE_START(6, 3, bl);
-  ::encode(hobj.key, bl);
-  ::encode(hobj.oid, bl);
-  ::encode(hobj.snap, bl);
-  ::encode(hobj.hash, bl);
-  ::encode(hobj.max, bl);
-  ::encode(hobj.nspace, bl);
-  ::encode(hobj.pool, bl);
-  ::encode(generation, bl);
-  ::encode(shard_id, bl);
-  ::encode(max, bl);
+  encode(hobj.key, bl);
+  encode(hobj.oid, bl);
+  encode(hobj.snap, bl);
+  encode(hobj.hash, bl);
+  encode(hobj.max, bl);
+  encode(hobj.nspace, bl);
+  encode(hobj.pool, bl);
+  encode(generation, bl);
+  encode(shard_id, bl);
+  encode(max, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -413,21 +417,21 @@ size_t ghobject_t::encoded_size() const
   return r;
 }
 
-void ghobject_t::decode(bufferlist::iterator& bl)
+void ghobject_t::decode(bufferlist::const_iterator& bl)
 {
   DECODE_START_LEGACY_COMPAT_LEN(6, 3, 3, bl);
   if (struct_v >= 1)
-    ::decode(hobj.key, bl);
-  ::decode(hobj.oid, bl);
-  ::decode(hobj.snap, bl);
-  ::decode(hobj.hash, bl);
+    decode(hobj.key, bl);
+  decode(hobj.oid, bl);
+  decode(hobj.snap, bl);
+  decode(hobj.hash, bl);
   if (struct_v >= 2)
-    ::decode(hobj.max, bl);
+    decode(hobj.max, bl);
   else
     hobj.max = false;
   if (struct_v >= 4) {
-    ::decode(hobj.nspace, bl);
-    ::decode(hobj.pool, bl);
+    decode(hobj.nspace, bl);
+    decode(hobj.pool, bl);
     // for compat with hammer, which did not handle the transition from
     // pool -1 -> pool INT64_MIN for MIN properly (see hobject_t::decode()).
     if (hobj.pool == -1 &&
@@ -436,18 +440,18 @@ void ghobject_t::decode(bufferlist::iterator& bl)
        !hobj.max &&
        hobj.oid.name.empty()) {
       hobj.pool = INT64_MIN;
-      assert(hobj.is_min());
+      ceph_assert(hobj.is_min());
     }
   }
   if (struct_v >= 5) {
-    ::decode(generation, bl);
-    ::decode(shard_id, bl);
+    decode(generation, bl);
+    decode(shard_id, bl);
   } else {
     generation = ghobject_t::NO_GEN;
     shard_id = shard_id_t::NO_SHARD;
   }
   if (struct_v >= 6) {
-    ::decode(max, bl);
+    decode(max, bl);
   } else {
     max = false;
   }