Skip to content

Commit

Permalink
os/bluestore: align BitMap allocator's init_rm_free/init_add_free par…
Browse files Browse the repository at this point in the history
…ameters with min_alloc_size

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 1b6a56e)
  • Loading branch information
ifed01 committed Mar 15, 2019
1 parent 5525533 commit d42bb17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/os/bluestore/BitmapFastAllocator.cc
Expand Up @@ -53,13 +53,21 @@ void BitmapFastAllocator::init_add_free(uint64_t offset, uint64_t length)
{
ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
_mark_free(offset, length);

auto mas = get_min_alloc_size();
uint64_t offs = round_up_to(offset, mas);
uint64_t l = p2align(offset + length - offs, mas);

_mark_free(offs, l);
}
void BitmapFastAllocator::init_rm_free(uint64_t offset, uint64_t length)
{
ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
_mark_allocated(offset, length);
auto mas = get_min_alloc_size();
uint64_t offs = round_up_to(offset, mas);
uint64_t l = p2align(offset + length - offs, mas);
_mark_allocated(offs, l);
}

void BitmapFastAllocator::shutdown()
Expand Down
10 changes: 10 additions & 0 deletions src/os/bluestore/fastbmap_allocator_impl.h
Expand Up @@ -103,6 +103,12 @@ class AllocatorLevel01 : public AllocatorLevel
inline bool _is_slot_fully_allocated(uint64_t idx) const {
return l1[idx] == all_slot_clear;
}
public:
inline uint64_t get_min_alloc_size() const
{
return l0_granularity;
}

};

template <class T>
Expand Down Expand Up @@ -537,6 +543,10 @@ class AllocatorLevel02 : public AllocatorLevel
std::lock_guard<std::mutex> l(lock);
return available;
}
inline uint64_t get_min_alloc_size() const
{
return l1.get_min_alloc_size();
}

protected:
std::mutex lock;
Expand Down

0 comments on commit d42bb17

Please sign in to comment.