]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls_cas: chunk_obj_refcount -> chunk_refs_t
authorSage Weil <sage@newdream.net>
Thu, 21 May 2020 20:11:57 +0000 (15:11 -0500)
committerSage Weil <sage@newdream.net>
Wed, 27 May 2020 21:28:41 +0000 (16:28 -0500)
Adjusted attr name too (chunk_refcount -> chunk_refs).

Signed-off-by: Sage Weil <sage@newdream.net>
src/cls/cas/cls_cas.cc
src/cls/cas/cls_cas_internal.cc
src/cls/cas/cls_cas_internal.h
src/test/cls_cas/test_cls_cas.cc
src/test/librados/tier_cxx.cc
src/tools/ceph-dencoder/common_types.h
src/tools/ceph_dedup_tool.cc

index 545382a59117463d41582c8ab26136056ba53ed4..0df07bcf5616f91367badb7eda313a5cc019723b 100644 (file)
@@ -23,7 +23,7 @@ CLS_NAME(cas)
 
 static int chunk_read_refcount(
   cls_method_context_t hctx,
-  chunk_obj_refcount *objr)
+  chunk_refs_t *objr)
 {
   bufferlist bl;
   objr->clear();
@@ -47,7 +47,7 @@ static int chunk_read_refcount(
 
 static int chunk_set_refcount(
   cls_method_context_t hctx,
-  const struct chunk_obj_refcount& objr)
+  const struct chunk_refs_t& objr)
 {
   bufferlist bl;
 
@@ -78,7 +78,7 @@ static int chunk_create_or_get_ref(cls_method_context_t hctx,
     return -EINVAL;
   }
 
-  chunk_obj_refcount objr;
+  chunk_refs_t objr;
   int ret = chunk_read_refcount(hctx, &objr);
   if (ret == -ENOENT) {
     // new chunk; init refs
@@ -138,7 +138,7 @@ static int chunk_get_ref(cls_method_context_t hctx,
     return -EINVAL;
   }
 
-  chunk_obj_refcount objr;
+  chunk_refs_t objr;
   int ret = chunk_read_refcount(hctx, &objr);
   if (ret < 0) {
     CLS_LOG(1, "ERROR: failed to read attr\n");
@@ -178,7 +178,7 @@ static int chunk_put_ref(cls_method_context_t hctx,
     return -EINVAL;
   }
 
-  chunk_obj_refcount objr;
+  chunk_refs_t objr;
   int ret = chunk_read_refcount(hctx, &objr);
   if (ret < 0)
     return ret;
index 7f17063f82b55f9885625a95220088ad8a442430..79ff206cfbd8b042db01ccaf1684376f6e2ff7a5 100644 (file)
@@ -3,11 +3,11 @@
 
 #include "cls_cas_internal.h"
 
-struct refs_by_object : public chunk_obj_refcount::refs_t {
+struct refs_by_object : public chunk_refs_t::refs_t {
   std::set<hobject_t> by_object;
 
   uint8_t get_type() const {
-    return chunk_obj_refcount::TYPE_BY_OBJECT;
+    return chunk_refs_t::TYPE_BY_OBJECT;
   }
   bool empty() const override {
     return by_object.empty();
@@ -52,7 +52,7 @@ struct refs_by_object : public chunk_obj_refcount::refs_t {
 };
 WRITE_CLASS_ENCODER(refs_by_object)
 
-struct refs_by_hash : public chunk_obj_refcount::refs_t {
+struct refs_by_hash : public chunk_refs_t::refs_t {
   uint64_t total = 0;
   uint32_t hash_bits = 32;          ///< how many bits of mask to encode
   std::map<std::pair<int64_t,uint32_t>,uint64_t> by_hash;
@@ -91,7 +91,7 @@ struct refs_by_hash : public chunk_obj_refcount::refs_t {
   }
 
   uint8_t get_type() const {
-    return chunk_obj_refcount::TYPE_BY_HASH;
+    return chunk_refs_t::TYPE_BY_HASH;
   }
   bool empty() const override {
     return by_hash.empty();
@@ -168,7 +168,7 @@ struct refs_by_hash : public chunk_obj_refcount::refs_t {
 };
 WRITE_CLASS_DENC(refs_by_hash)
 
-struct refs_by_pool : public chunk_obj_refcount::refs_t {
+struct refs_by_pool : public chunk_refs_t::refs_t {
   uint64_t total = 0;
   map<int64_t,uint64_t> by_pool;
 
@@ -181,7 +181,7 @@ struct refs_by_pool : public chunk_obj_refcount::refs_t {
   }
 
   uint8_t get_type() const {
-    return chunk_obj_refcount::TYPE_BY_POOL;
+    return chunk_refs_t::TYPE_BY_POOL;
   }
   bool empty() const override {
     return by_pool.empty();
@@ -249,7 +249,7 @@ struct refs_by_pool : public chunk_obj_refcount::refs_t {
 };
 WRITE_CLASS_DENC(refs_by_pool)
 
-struct refs_count : public chunk_obj_refcount::refs_t {
+struct refs_count : public chunk_refs_t::refs_t {
   uint64_t total = 0;
 
   refs_count() {}
@@ -258,7 +258,7 @@ struct refs_count : public chunk_obj_refcount::refs_t {
   }
 
   uint8_t get_type() const {
-    return chunk_obj_refcount::TYPE_COUNT;
+    return chunk_refs_t::TYPE_COUNT;
   }
   bool empty() const override {
     return total == 0;
@@ -298,21 +298,21 @@ WRITE_CLASS_ENCODER(refs_count)
 
 //
 
-void chunk_obj_refcount::clear()
+void chunk_refs_t::clear()
 {
   // default to most precise impl
   r.reset(new refs_by_object);
 }
 
 
-void chunk_obj_refcount::encode(ceph::buffer::list& bl) const
+void chunk_refs_t::encode(ceph::buffer::list& bl) const
 {
   bufferlist t;
   _encode_r(t);
   _encode_final(bl, t);
 }
 
-void chunk_obj_refcount::_encode_r(ceph::bufferlist& bl) const
+void chunk_refs_t::_encode_r(ceph::bufferlist& bl) const
 {
   using ceph::encode;
   switch (r->get_type()) {
@@ -333,7 +333,7 @@ void chunk_obj_refcount::_encode_r(ceph::bufferlist& bl) const
   }
 }
 
-void chunk_obj_refcount::dynamic_encode(ceph::buffer::list& bl, size_t max)
+void chunk_refs_t::dynamic_encode(ceph::buffer::list& bl, size_t max)
 {
   bufferlist t;
   while (true) {
@@ -361,7 +361,7 @@ void chunk_obj_refcount::dynamic_encode(ceph::buffer::list& bl, size_t max)
   _encode_final(bl, t);
 }
 
-void chunk_obj_refcount::_encode_final(bufferlist& bl, bufferlist& t) const
+void chunk_refs_t::_encode_final(bufferlist& bl, bufferlist& t) const
 {
   ENCODE_START(1, 1, bl);
   encode(r->get_type(), bl);
@@ -369,7 +369,7 @@ void chunk_obj_refcount::_encode_final(bufferlist& bl, bufferlist& t) const
   ENCODE_FINISH(bl);
 }
 
-void chunk_obj_refcount::decode(ceph::buffer::list::const_iterator& p)
+void chunk_refs_t::decode(ceph::buffer::list::const_iterator& p)
 {
   DECODE_START(1, p);
   uint8_t t;
index f98721cf8cdd1fdc9cf84709f2270f22faa28632..1949832e51df0acb84802a9a00e80c20ffdc25cc 100644 (file)
@@ -11,9 +11,9 @@
 #include "common/Formatter.h"
 #include "common/hobject.h"
 
-#define CHUNK_REFCOUNT_ATTR "chunk_refcount"
+#define CHUNK_REFCOUNT_ATTR "chunk_refs"
 
-struct chunk_obj_refcount {
+struct chunk_refs_t {
   enum {
     TYPE_BY_OBJECT = 1,
     TYPE_BY_HASH = 2,
@@ -46,7 +46,7 @@ struct chunk_obj_refcount {
 
   std::unique_ptr<refs_t> r;
 
-  chunk_obj_refcount() {
+  chunk_refs_t() {
     clear();
   }
 
@@ -87,8 +87,8 @@ struct chunk_obj_refcount {
   void dump(Formatter *f) const {
     r->dump(f);
   }
-  static void generate_test_instances(std::list<chunk_obj_refcount*>& ls) {
-    ls.push_back(new chunk_obj_refcount());
+  static void generate_test_instances(std::list<chunk_refs_t*>& ls) {
+    ls.push_back(new chunk_refs_t());
   }
 };
-WRITE_CLASS_ENCODER(chunk_obj_refcount)
+WRITE_CLASS_ENCODER(chunk_refs_t)
index 28d1b4178c581ba43aea69b032da10f4ee110c20..f57ad4b5307834a1e0e0dc93ed760574f8ea85ef 100644 (file)
@@ -296,9 +296,9 @@ static int count_bits(unsigned long n)
         return 1 + count_bits(n & (n - 1));
 }
 
-TEST(chunk_obj_refcount, size)
+TEST(chunk_refs_t, size)
 {
-  chunk_obj_refcount r;
+  chunk_refs_t r;
   size_t max = 1048576;
 
   // mix in pool changes as i gets bigger
@@ -322,7 +322,7 @@ TEST(chunk_obj_refcount, size)
       }
 
       // verify reencoding is correct
-      chunk_obj_refcount a;
+      chunk_refs_t a;
       auto t = bl.cbegin();
       decode(a, t);
       bufferlist bl2;
index e38c02f4ad34610fa83a8177fdaf14da6ba4d0be..e9bb5275e97fe758024724f607a698be9bb6cc73 100644 (file)
@@ -3216,7 +3216,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestRefRead) {
   {
     bufferlist t;
     cache_ioctx.getxattr("bar", CHUNK_REFCOUNT_ATTR, t);
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     try {
       auto iter = t.cbegin();
       decode(refs, iter);
@@ -3229,7 +3229,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestRefRead) {
   {
     bufferlist t;
     cache_ioctx.getxattr("bar-chunk", CHUNK_REFCOUNT_ATTR, t);
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     try {
       auto iter = t.cbegin();
       decode(refs, iter);
@@ -3306,7 +3306,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestUnset) {
   {
     bufferlist t;
     cache_ioctx.getxattr("bar", CHUNK_REFCOUNT_ATTR, t);
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     try {
       auto iter = t.cbegin();
       decode(refs, iter);
@@ -3319,7 +3319,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestUnset) {
   {
     bufferlist t;
     cache_ioctx.getxattr("bar-chunk", CHUNK_REFCOUNT_ATTR, t);
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     try {
       auto iter = t.cbegin();
       decode(refs, iter);
@@ -3499,7 +3499,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestDedupRefRead) {
     sha1_gen.Final(fingerprint);
     buf_to_hex(fingerprint, CEPH_CRYPTO_SHA1_DIGESTSIZE, p_str);
     cache_ioctx.getxattr(p_str, CHUNK_REFCOUNT_ATTR, t);
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     try {
       auto iter = t.cbegin();
       decode(refs, iter);
index 6583cd4b87047babbb4d90716e6f768bfe85d90d..36ff42e81a17c900a40bb5efbb6cf7f77fd07d5d 100644 (file)
@@ -67,7 +67,7 @@ TYPE(cls_cas_chunk_get_ref_op)
 TYPE(cls_cas_chunk_put_ref_op)
 
 #include "cls/cas/cls_cas_internal.h"
-TYPE(chunk_obj_refcount)
+TYPE(chunk_refs_t)
 
 #include "cls/lock/cls_lock_types.h"
 TYPE(rados::cls::lock::locker_id_t)
index 6129269fa8626e5bd80b774d6581a9b58e0b3f3e..09668b2441e277f19b38af885784da7bec725dec 100644 (file)
@@ -430,7 +430,7 @@ void ChunkScrub::chunk_scrub_common()
       }
       auto oid = i.oid;
       cout << oid << std::endl;
-      chunk_obj_refcount refs;
+      chunk_refs_t refs;
       {
        bufferlist t;
        ret = chunk_io_ctx.getxattr(oid, CHUNK_REFCOUNT_ATTR, t);
@@ -442,14 +442,14 @@ void ChunkScrub::chunk_scrub_common()
       }
 
       examined_objects++;
-      if (refs.get_type() != chunk_obj_refcount::TYPE_BY_OBJECT) {
+      if (refs.get_type() != chunk_refs_t::TYPE_BY_OBJECT) {
        // we can't do anything here
        continue;
       }
 
       // check all objects
-      chunk_obj_refcount::refs_by_object *byo =
-       static_cast<chunk_obj_refcount::refs_by_object*>(refs.r.get());
+      chunk_refs_t::refs_by_object *byo =
+       static_cast<chunk_refs_t::refs_by_object*>(refs.r.get());
       set<hobject_t> real_refs;
 
       uint64_t pool_missing = 0;
@@ -824,7 +824,7 @@ int chunk_scrub_common(const std::map < std::string, std::string > &opts,
     if (ret < 0) {
       return ret;
     }
-    chunk_obj_refcount refs;
+    chunk_refs_t refs;
     auto p = t.cbegin();
     decode(refs, p);
     auto f = Formatter::create("json-pretty");