From be6d887cccd4537afe139603e679b8d3429f3cf3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 19 Jun 2016 09:05:01 -0400 Subject: [PATCH] os/bluestore: use FLAG_CSUM to indicate if checksums are present Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 2 +- src/os/bluestore/bluestore_types.cc | 7 ++++++- src/os/bluestore/bluestore_types.h | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 00b767d32b1..a33fb0bc8a9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5227,7 +5227,7 @@ void BlueStore::_dump_blob_map(BlobMap &bm, int log_level) { for (auto& b : bm.blob_map) { dout(log_level) << __func__ << " " << b << dendl; - if (b.blob.has_csum_data()) { + if (b.blob.has_csum()) { vector v; unsigned n = b.blob.get_csum_count(); for (unsigned i = 0; i < n; ++i) diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 63d91e04c3c..4e3fa67b2f1 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -399,6 +399,11 @@ string bluestore_blob_t::get_flags_string(unsigned flags) s += '+'; s += "compressed"; } + if (flags & FLAG_CSUM) { + if (s.length()) + s += '+'; + s += "csum"; + } return s; } @@ -533,7 +538,7 @@ void bluestore_blob_t::put_ref( } // we cannot release something smaller than our csum chunk size - if (has_csum_data() && get_csum_chunk_size() > min_release_size) { + if (has_csum() && get_csum_chunk_size() > min_release_size) { min_release_size = get_csum_chunk_size(); } diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 8dff7ab17e0..b64debff187 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -152,6 +152,7 @@ struct bluestore_blob_t { enum { FLAG_MUTABLE = 1, ///< blob can be overwritten or split FLAG_COMPRESSED = 2, ///< blob is compressed + FLAG_CSUM = 4, ///< blob as checksums }; static string get_flags_string(unsigned flags); @@ -361,8 +362,8 @@ struct bluestore_blob_t { return len; } - bool has_csum_data() const { - return csum_data.length() > 0; + bool has_csum() const { + return has_flag(FLAG_CSUM); } uint32_t get_csum_chunk_size() const { @@ -412,6 +413,7 @@ struct bluestore_blob_t { } void init_csum(unsigned type, unsigned order, unsigned len) { + flags |= FLAG_CSUM; csum_type = type; csum_chunk_order = order; csum_data = buffer::create(get_csum_value_size() * len / get_csum_chunk_size()); -- 2.47.3