From a7749eda96ef80a54f7a33a9a655b4f2d4b8738a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 22 Jun 2016 09:23:31 -0400 Subject: [PATCH] os/bluestore/bluestore_types: fix blob initializers, test instances - 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 --- src/os/bluestore/bluestore_types.cc | 8 ++++---- src/os/bluestore/bluestore_types.h | 23 +++++------------------ 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 6fc67d86b2731..3400946f147bf 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -493,10 +493,10 @@ void bluestore_blob_t::generate_test_instances(list& 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); diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index b64debff18754..874eabe9a5ba6 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -193,30 +193,17 @@ struct bluestore_blob_t { } vector 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< 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); -- 2.39.5