diff --git a/conanfile.py b/conanfile.py index 61d77e40d..0fb9488de 100644 --- a/conanfile.py +++ b/conanfile.py @@ -2,7 +2,7 @@ class HomestoreConan(ConanFile): name = "homestore" - version = "3.7.1" + version = "3.7.2" homepage = "https://github.corp.ebay.com/SDS/homestore" description = "HomeStore" diff --git a/src/.clang-format b/src/.clang-format index 2f7712008..fdfa11f5e 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -18,7 +18,6 @@ AlignOperands: false AlignTrailingComments: true AllowShortBlocksOnASingleLine: true AllowShortIfStatementsOnASingleLine: true -AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false # AllowShortFunctionsOnASingleLine: InlineOnly # AllowShortLoopsOnASingleLine: false diff --git a/src/engine/blkstore/blkstore.hpp b/src/engine/blkstore/blkstore.hpp index 34d830bb3..87b3ecc79 100644 --- a/src/engine/blkstore/blkstore.hpp +++ b/src/engine/blkstore/blkstore.hpp @@ -54,7 +54,7 @@ VENUM(BlkStoreCacheType, uint8_t, PASS_THRU = 0, WRITEBACK_CACHE = 1, WRITETHRU_ * be either be discarded or copied into new buffer. This threshold dictates whats the value of (64K - N) upto which * it will copy. In other words ((64K - N) <= CACHE_DISCARD_THRESHOLD_SIZE) ? copy : discard */ -//#define CACHE_DISCARD_THRESHOLD_SIZE 16384 +// #define CACHE_DISCARD_THRESHOLD_SIZE 16384 class BlkStoreConfig { public: @@ -325,7 +325,7 @@ class BlkStore { BlkAllocStatus alloc_contiguous_blk(const uint32_t size, blk_alloc_hints& hints, BlkId* const out_blkid) { // Allocate a block from the device manager assert(size % m_pagesz == 0); - const blk_count_t nblks{static_cast< blk_count_t >(size / m_pagesz)}; + const uint32_t nblks{static_cast< uint32_t >(size / m_pagesz)}; hints.is_contiguous = true; HS_DBG_ASSERT_LE(nblks, BlkId::max_blks_in_op(), "nblks {} more than max blks {}", nblks, BlkId::max_blks_in_op()); @@ -336,14 +336,17 @@ class BlkStore { BlkAllocStatus alloc_blk(const uint32_t size, blk_alloc_hints& hints, std::vector< BlkId >& out_blkid) { // Allocate a block from the device manager assert(size % m_pagesz == 0); - blk_count_t nblks{static_cast< blk_count_t >(size / m_pagesz)}; + // Using a 16-bit value (blk_count_t) for page counts can lead to overflow issues when managing large storage + // devices. With a page size of 4096 bytes, a 16-bit value limits the addressable storage to 256 MB (65,536 + // pages * 4096 bytes/page). + uint32_t nblks{static_cast< uint32_t >(size / m_pagesz)}; if (nblks <= BlkId::max_blks_in_op()) { return (m_vdev.alloc_blk(nblks, hints, out_blkid)); } else { while (nblks != 0) { static thread_local std::vector< BlkId > result_blkid{}; result_blkid.clear(); - const blk_count_t nblks_op{std::min(static_cast< blk_count_t >(BlkId::max_blks_in_op()), nblks)}; + const uint32_t nblks_op{std::min(static_cast< uint32_t >(BlkId::max_blks_in_op()), nblks)}; const auto ret{m_vdev.alloc_blk(nblks_op, hints, result_blkid)}; if (ret != BlkAllocStatus::SUCCESS) { return ret; } out_blkid.insert(std::end(out_blkid), std::make_move_iterator(std::begin(result_blkid)), diff --git a/src/engine/meta/meta_blks_mgr.cpp b/src/engine/meta/meta_blks_mgr.cpp index 14d3c5f88..94cb4863a 100644 --- a/src/engine/meta/meta_blks_mgr.cpp +++ b/src/engine/meta/meta_blks_mgr.cpp @@ -1018,6 +1018,7 @@ void MetaBlkMgr::alloc_meta_blk(const uint64_t size, std::vector< BlkId >& bid) try { const auto ret{m_sb_blk_store->alloc_blk(size, hints, bid)}; HS_REL_ASSERT_EQ(ret, BlkAllocStatus::SUCCESS); + HS_REL_ASSERT_NE(bid.size(), 0); #ifndef NDEBUG uint64_t debug_size{0}; for (size_t i{0}; i < bid.size(); ++i) {