]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make blob csum info encoding conditional
authorSage Weil <sage@redhat.com>
Sun, 19 Jun 2016 13:05:30 +0000 (09:05 -0400)
committerSage Weil <sage@redhat.com>
Tue, 21 Jun 2016 16:51:02 +0000 (12:51 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/bluestore_types.cc

index 4e3fa67b2f17818f97673817649c96b292997449..548b21c8f07ba855701e10f78a2c0dbe7bfc75d5 100644 (file)
@@ -415,9 +415,11 @@ void bluestore_blob_t::encode(bufferlist& bl) const
   if (is_compressed()) {
     small_encode_varint_lowz(compressed_length, bl);
   }
-  small_encode_varint(csum_type, bl);
-  small_encode_varint(csum_chunk_order, bl);
-  small_encode_buf_lowz(csum_data, bl);
+  if (has_csum()) {
+    small_encode_varint(csum_type, bl);
+    small_encode_varint(csum_chunk_order, bl);
+    small_encode_buf_lowz(csum_data, bl);
+  }
   ::encode(ref_map, bl);
   ::encode(unused, bl);
   ENCODE_FINISH(bl);
@@ -433,9 +435,14 @@ void bluestore_blob_t::decode(bufferlist::iterator& p)
   } else {
     compressed_length = 0;
   }
-  small_decode_varint(csum_type, p);
-  small_decode_varint(csum_chunk_order, p);
-  small_decode_buf_lowz(csum_data, p);
+  if (has_csum()) {
+    small_decode_varint(csum_type, p);
+    small_decode_varint(csum_chunk_order, p);
+    small_decode_buf_lowz(csum_data, p);
+  } else {
+    csum_type = CSUM_NONE;
+    csum_chunk_order = 0;
+  }
   ::decode(ref_map, p);
   ::decode(unused, p);
   DECODE_FINISH(p);