From 27e9f1de6ae598da51b55f71ff599575db5ef893 Mon Sep 17 00:00:00 2001 From: Jie Yao Date: Tue, 19 Sep 2023 01:07:16 -0700 Subject: [PATCH] remove #define --- src/lib/homestore/heap_chunk_selector.cpp | 8 +++----- src/lib/homestore/heap_chunk_selector.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/homestore/heap_chunk_selector.cpp b/src/lib/homestore/heap_chunk_selector.cpp index 4d228996..53773073 100644 --- a/src/lib/homestore/heap_chunk_selector.cpp +++ b/src/lib/homestore/heap_chunk_selector.cpp @@ -8,13 +8,11 @@ namespace homeobject { //https://github.com/facebook/folly/blob/61c11d77eb9a8bdc60f673017fccfbe900125cb6/folly/AtomicHashMap.h#L42 //AtomichashMap has a max size limit of ~18x initial size. -//we support max of 64k chunks for now, so 64*1024/18 + 1 = 3641, we use 4000 for sufficiently initial size -#define DEFAULT_ATOMICHASHMAP_INITIAL_SIZE 4000 HeapChunkSelector::HeapChunkSelector() : -m_pdev_heap_map(PdevHeapMap(pdev_atomicmap_init_size())), -m_pdev_avalable_blk_map(PdevAvalableBlkMap(pdev_atomicmap_init_size())), -m_chunks(chunk_atomicmap_init_size()) {} +m_pdev_heap_map(PdevHeapMap(pdev_atomicmap_init_size)), +m_pdev_avalable_blk_map(pdev_atomicmap_init_size), +m_chunks(chunk_atomicmap_init_size) {} HeapChunkSelector::HeapChunkSelector(const uint32_t& pdev_heap_map_initial_size, const uint32_t& pdev_avalable_blk_map_initial_size, const uint32_t& chunk_initial_num) : diff --git a/src/lib/homestore/heap_chunk_selector.h b/src/lib/homestore/heap_chunk_selector.h index 5b50217f..768f4e1c 100644 --- a/src/lib/homestore/heap_chunk_selector.h +++ b/src/lib/homestore/heap_chunk_selector.h @@ -42,10 +42,10 @@ class HeapChunkSelector : public homestore::ChunkSelector { void release_chunk(const uint32_t&); // we use 64K for the initial size - static constexpr uint32_t chunk_atomicmap_init_size() {return 1<<16;} + static constexpr uint32_t chunk_atomicmap_init_size = 1<<16; // we suppose our max pdev number is 64(64 physical disks) - static constexpr uint32_t pdev_atomicmap_init_size() {return 1<<6;} + static constexpr uint32_t pdev_atomicmap_init_size = 1<<6; using PdevHeapMap = folly::AtomicHashMap< uint32_t, std::shared_ptr< std::pair< std::mutex, VChunkHeap > > >; using PdevAvalableBlkMap = folly::AtomicHashMap< uint32_t, std::atomic_uint32_t >;