From: Sage Weil Date: Sun, 19 Jun 2016 13:05:01 +0000 (-0400) Subject: os/bluestore: use FLAG_CSUM to indicate if checksums are present X-Git-Tag: v11.0.0~91^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be6d887cccd4537afe139603e679b8d3429f3cf3;p=ceph.git os/bluestore: use FLAG_CSUM to indicate if checksums are present Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 00b767d32b1d..a33fb0bc8a94 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 63d91e04c3c2..4e3fa67b2f17 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 8dff7ab17e0c..b64debff1875 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());