]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use FLAG_CSUM to indicate if checksums are present
authorSage Weil <sage@redhat.com>
Sun, 19 Jun 2016 13:05:01 +0000 (09:05 -0400)
committerSage Weil <sage@redhat.com>
Tue, 21 Jun 2016 16:51:01 +0000 (12:51 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_types.cc
src/os/bluestore/bluestore_types.h

index 00b767d32b1dc6a55b5f60319731ee3f173f9aa1..a33fb0bc8a94a3a1320ac5e069b9b6f8b5833555 100644 (file)
@@ -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<uint64_t> v;
       unsigned n = b.blob.get_csum_count();
       for (unsigned i = 0; i < n; ++i)
index 63d91e04c3c25975d76ada27c8fc3fb02786f043..4e3fa67b2f17818f97673817649c96b292997449 100644 (file)
@@ -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();
   }
 
index 8dff7ab17e0ceae60bbbcbbaa563d227a883279a..b64debff1875405052c27a15ddded9970b9a84b0 100644 (file)
@@ -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());