]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: attach csum for compressed blobs 37861/head
authorIgor Fedotov <ifedotov@suse.com>
Tue, 15 Sep 2020 20:06:20 +0000 (23:06 +0300)
committerNathan Cutler <ncutler@suse.com>
Tue, 1 Dec 2020 19:47:31 +0000 (20:47 +0100)
Fixes: https://tracker.ceph.com/issues/47475
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 53346d06beb4de971703e63627444bca40a1fa44)

src/os/bluestore/BlueStore.cc

index 8f80eabaf79613665272b7abab79dc6fba2e0639..c322e56f63d6c1f1ab47a2eac6b5e2ef11c91ebc 100644 (file)
@@ -13823,12 +13823,23 @@ int BlueStore::_do_alloc_write(
     if (wi.compressed) {
       final_length = wi.compressed_bl.length();
       csum_length = final_length;
+      unsigned csum_order = ctz(csum_length);
       l = &wi.compressed_bl;
       dblob.set_compressed(wi.blob_length, wi.compressed_len);
+      if (csum != Checksummer::CSUM_NONE) {
+        dout(20) << __func__ << " initialize csum setting for compressed blob " << *b
+                 << " csum_type " << Checksummer::get_csum_type_string(csum)
+                 << " csum_order " << csum_order
+                 << " csum_length 0x" << std::hex << csum_length
+                 << " blob_length 0x" << wi.blob_length
+                 << " compressed_length 0x" << wi.compressed_len << std::dec
+                 << dendl;
+        dblob.init_csum(csum, csum_order, csum_length);
+      }
     } else if (wi.new_blob) {
+      unsigned csum_order;
       // initialize newly created blob only
       ceph_assert(dblob.is_mutable());
-      unsigned csum_order;
       if (l->length() != wi.blob_length) {
         // hrm, maybe we could do better here, but let's not bother.
         dout(20) << __func__ << " forcing csum_order to block_size_order "