]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluestore_types: fix blob initializers, test instances 9865/head
authorSage Weil <sage@redhat.com>
Wed, 22 Jun 2016 13:23:31 +0000 (09:23 -0400)
committerSage Weil <sage@redhat.com>
Wed, 22 Jun 2016 13:23:31 +0000 (09:23 -0400)
- initialize members in c++11 style
- drop pextent ctor
- fix up test instances
- make csum_order default to 0, so it matches the
  CSUM_NONE decoding logic.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/bluestore_types.cc
src/os/bluestore/bluestore_types.h

index 6fc67d86b2731bd4acc1549badb42e03f0c66e37..3400946f147bfa07a67250c452cacf6331c9ceb7 100644 (file)
@@ -493,10 +493,10 @@ void bluestore_blob_t::generate_test_instances(list<bluestore_blob_t*>& ls)
 {
   ls.push_back(new bluestore_blob_t);
   ls.push_back(new bluestore_blob_t(0));
-  ls.push_back(new bluestore_blob_t(bluestore_pextent_t(111, 222), 12));
-  ls.push_back(new bluestore_blob_t(bluestore_pextent_t(111, 222), 12));
-  ls.back()->csum_type = CSUM_XXHASH32;
-  ls.back()->csum_chunk_order = 16;
+  ls.push_back(new bluestore_blob_t);
+  ls.back()->extents.push_back(bluestore_pextent_t(111, 222));
+  ls.push_back(new bluestore_blob_t);
+  ls.back()->init_csum(CSUM_XXHASH32, 16, 65536);
   ls.back()->csum_data = buffer::claim_malloc(4, strdup("abcd"));
   ls.back()->ref_map.get(3, 5);
   ls.back()->add_unused(0, 3);
index b64debff1875405052c27a15ddded9970b9a84b0..874eabe9a5ba67e73bd4b6d05540c003abad01db 100644 (file)
@@ -193,30 +193,17 @@ struct bluestore_blob_t {
   }
 
   vector<bluestore_pextent_t> extents; ///< raw data position on device
-  uint32_t compressed_length;      ///< compressed length if any
-  uint32_t flags;                  ///< FLAG_*
+  uint32_t compressed_length = 0;      ///< compressed length if any
+  uint32_t flags = 0;                  ///< FLAG_*
 
-  uint8_t csum_type;               ///< CSUM_*
-  uint8_t csum_chunk_order;        ///< csum block size is 1<<block_order bytes
+  uint8_t csum_type = CSUM_NONE;     ///< CSUM_*
+  uint8_t csum_chunk_order = 0;      ///< csum block size is 1<<block_order bytes
 
   bluestore_extent_ref_map_t ref_map; ///< references (empty when in onode)
   interval_set<uint32_t> unused;   ///< portion that has never been written to
   bufferptr csum_data;          ///< opaque vector of csum data
 
-  bluestore_blob_t(uint32_t f = 0)
-    : compressed_length(0),
-      flags(f),
-      csum_type(CSUM_NONE),
-      csum_chunk_order(12) {
-  }
-
-  bluestore_blob_t(const bluestore_pextent_t& ext, uint32_t f = 0)
-    : compressed_length(0),
-      flags(f),
-      csum_type(CSUM_NONE),
-      csum_chunk_order(12) {
-    extents.push_back(ext);
-  }
+  bluestore_blob_t(uint32_t f = 0) : flags(f) {}
 
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& p);