From: Sage Weil Date: Wed, 19 Nov 2014 23:05:24 +0000 (-0800) Subject: common/hobject_t: add pgmeta named ctor and is_pgmeta() check X-Git-Tag: v0.91~23^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=033a533a72d009a9cbf2eee0ba090e58b9574952;p=ceph.git common/hobject_t: add pgmeta named ctor and is_pgmeta() check 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 --- diff --git a/src/common/hobject.h b/src/common/hobject.h index c5f785c2dd8a..94aa6bf78286 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -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); }