]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/hobject_t: add pgmeta named ctor and is_pgmeta() check
authorSage Weil <sage@redhat.com>
Wed, 19 Nov 2014 23:05:24 +0000 (15:05 -0800)
committerSage Weil <sage@redhat.com>
Wed, 17 Dec 2014 01:07:55 +0000 (17:07 -0800)
There will be exactly one of these per PG.  It slots into the flat

  (pool, hash, name...)

namespace but is not a legal rados name (since it is the empty string).

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/hobject.h

index c5f785c2dd8af1913621b32ae708fb5c3de65f80..94aa6bf782863594c589dee969672493c9cf0c59 100644 (file)
@@ -67,8 +67,7 @@ public:
   }
 
   static hobject_t make_temp(const string &name) {
-    hobject_t ret(object_t(name), "", CEPH_NOSNAP, 0, POOL_IS_TEMP, "");
-    return ret;
+    return hobject_t(object_t(name), "", CEPH_NOSNAP, 0, POOL_IS_TEMP, "");
   }
   bool is_temp() const {
     return pool == POOL_IS_TEMP;
@@ -265,6 +264,15 @@ public:
 
   ghobject_t(const hobject_t &obj, gen_t gen, shard_id_t shard) : hobj(obj), generation(gen), shard_id(shard) {}
 
+  static ghobject_t make_pgmeta(int64_t pool, uint32_t hash, shard_id_t shard) {
+    hobject_t h(object_t(), string(), CEPH_NOSNAP, hash, pool, string());
+    return ghobject_t(h, NO_GEN, shard);
+  }
+  bool is_pgmeta() const {
+    // make sure we are distinct from hobject_t(), which has pool -1
+    return hobj.pool >= 0 && hobj.oid.name.empty();
+  }
+
   bool match(uint32_t bits, uint32_t match) const {
     return hobj.match_hash(hobj.hash, bits, match);
   }