diff --git a/src/lib/homestore/heap_chunk_selector.cpp b/src/lib/homestore/heap_chunk_selector.cpp index 6e2db4e1..75a5a020 100644 --- a/src/lib/homestore/heap_chunk_selector.cpp +++ b/src/lib/homestore/heap_chunk_selector.cpp @@ -49,6 +49,7 @@ csharedChunk HeapChunkSelector::select_chunk(homestore::blk_count_t count, const it->second->first.lock(); if(it->second->second.empty()) { LOGINFO("No more available chunks found for pdev {}", pdevID); + it->second->first.unlock(); return nullptr; } diff --git a/src/lib/homestore/heap_chunk_selector.h b/src/lib/homestore/heap_chunk_selector.h index ebe55627..861fdf82 100644 --- a/src/lib/homestore/heap_chunk_selector.h +++ b/src/lib/homestore/heap_chunk_selector.h @@ -44,7 +44,9 @@ class HeapChunkSelector : public homestore::ChunkSelector { csharedChunk select_chunk([[maybe_unused]]homestore::blk_count_t nblks, const homestore::blk_alloc_hints& hints); private: + //this holds all the chunks for each pdev, they are all unselected. folly::ConcurrentHashMap< uint32_t, std::shared_ptr< std::pair< std::mutex, VChunkHeap > > > m_pdev_heap_map; + //for now, uint32_t is enough for the sum of all the available blocks of a pdev. //if necessary , we can change this to uint64_t to hold a larger sum. std::unordered_map< uint32_t, uint32_t> m_pdev_avalable_blk_map; @@ -52,6 +54,5 @@ class HeapChunkSelector : public homestore::ChunkSelector { //hold all the chunks , selected or not std::unordered_set< VChunk > m_chunks; std::mutex lock; - }; } // namespace homeobject \ No newline at end of file