From 53346d06beb4de971703e63627444bca40a1fa44 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Tue, 15 Sep 2020 23:06:20 +0300 Subject: [PATCH] os/bluestore: attach csum for compressed blobs Fixes: https://tracker.ceph.com/issues/47475 Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9a7cc2e4aec..437da44dda1 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -13639,12 +13639,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 " -- 2.39.5