Skip to content

Commit

Permalink
remove #define
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonYao287 committed Sep 19, 2023
1 parent b2682fd commit 27e9f1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/lib/homestore/heap_chunk_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) :
Expand Down
4 changes: 2 additions & 2 deletions src/lib/homestore/heap_chunk_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 >;
Expand Down

0 comments on commit 27e9f1d

Please sign in to comment.