From f5e8b27d77774e904b12f4e190c6d8b7a0f73b2f Mon Sep 17 00:00:00 2001 From: Harihara Kadayam Date: Mon, 30 Oct 2023 16:17:10 -0700 Subject: [PATCH] Removed get_available_blocks() api completely --- src/lib/blkalloc/bitmap_blk_allocator.h | 2 -- src/lib/blkalloc/varsize_blk_allocator.cpp | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/blkalloc/bitmap_blk_allocator.h b/src/lib/blkalloc/bitmap_blk_allocator.h index a9063dd36..92231f5a1 100644 --- a/src/lib/blkalloc/bitmap_blk_allocator.h +++ b/src/lib/blkalloc/bitmap_blk_allocator.h @@ -43,7 +43,6 @@ class BlkAllocPortion { mutable std::mutex m_blk_lock; blk_num_t m_portion_num; blk_temp_t m_temperature; - blk_num_t m_available_blocks; public: BlkAllocPortion(blk_temp_t temp = default_temperature()) : m_temperature(temp) {} @@ -55,7 +54,6 @@ class BlkAllocPortion { auto portion_auto_lock() const { return std::scoped_lock< std::mutex >(m_blk_lock); } blk_num_t get_portion_num() const { return m_portion_num; } - blk_num_t get_available_blocks() const { return m_available_blocks; } blk_temp_t temperature() const { return m_temperature; } void set_portion_num(blk_num_t portion_num) { m_portion_num = portion_num; } diff --git a/src/lib/blkalloc/varsize_blk_allocator.cpp b/src/lib/blkalloc/varsize_blk_allocator.cpp index 33856b28f..ac44ab1bf 100644 --- a/src/lib/blkalloc/varsize_blk_allocator.cpp +++ b/src/lib/blkalloc/varsize_blk_allocator.cpp @@ -591,8 +591,7 @@ blk_count_t VarsizeBlkAllocator::alloc_blks_direct(blk_count_t nblks, blk_alloc_ auto const end_blk_id = cur_blk_id + get_blks_per_portion() - 1; { auto lock{portion.portion_auto_lock()}; - while (nblks_remain && (cur_blk_id <= end_blk_id) && portion.get_available_blocks() && - out_blkid.has_room()) { + while (nblks_remain && (cur_blk_id <= end_blk_id) && out_blkid.has_room()) { // Get next reset bits and insert to cache and then reset those bits auto const b = m_cache_bm->get_next_contiguous_n_reset_bits( cur_blk_id, end_blk_id, std::min(min_blks, nblks_remain), nblks_remain);