From e82632e54b7aef2404d184f07c07e8bce8bd509a Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 15 Jul 2016 18:28:44 +0300 Subject: [PATCH] os/bluestore: allow csum verification disable on read. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 6 +++--- src/os/bluestore/bluestore_types.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e8548b1f60c..220f4dc802e 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3613,7 +3613,7 @@ int BlueStore::_do_read( } else { for (auto reg : b2r_it->second) { // determine how much of the blob to read - uint64_t chunk_size = bptr->blob.get_chunk_size(block_size); + uint64_t chunk_size = bptr->blob.get_chunk_size(csum_type != bluestore_blob_t::CSUM_NONE, block_size); uint64_t r_off = reg.blob_xoffset; uint64_t r_len = reg.length; unsigned front = r_off % chunk_size; @@ -3692,7 +3692,7 @@ int BlueStore::_verify_csum(OnodeRef& o, const bufferlist& bl) const { int bad; - int r = blob->verify_csum(blob_xoffset, bl, &bad); + int r = csum_type != bluestore_blob_t::CSUM_NONE ? blob->verify_csum(blob_xoffset, bl, &bad) :0; if (r < 0) { if (r == -1) { vector pex; @@ -5768,7 +5768,7 @@ void BlueStore::_do_write_small( << " bstart 0x" << std::hex << bstart << std::dec << dendl; // can we pad our head/tail out with zeros? - uint64_t chunk_size = b->blob.get_chunk_size(block_size); + uint64_t chunk_size = b->blob.get_chunk_size(b->blob.has_csum(), block_size); //blob csum settings to be applied hence ignoring current config settings for csum enable/disable uint64_t head_pad = P2PHASE(offset, chunk_size); if (head_pad && o->onode.has_any_lextents(offset - head_pad, chunk_size)) { head_pad = 0; diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index e8c4654654b..c445f06d552 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -328,8 +328,8 @@ struct bluestore_blob_t { } /// return chunk (i.e. min readable block) size for the blob - uint64_t get_chunk_size(uint64_t dev_block_size) { - return has_csum() ? MAX(dev_block_size, get_csum_chunk_size()) : dev_block_size; + uint64_t get_chunk_size(bool csum_enabled, uint64_t dev_block_size) { + return csum_enabled && has_csum() ? MAX(dev_block_size, get_csum_chunk_size()) : dev_block_size; } uint32_t get_csum_chunk_size() const { return 1 << csum_chunk_order; -- 2.47.3