area = (BitMapArea *) m_child_list->get_nth_item(
start_block / m_child_size_blocks);
- area_block_offset = start_block % area->size();
+ area_block_offset = start_block % m_child_size_blocks;
falling_in_area = MIN(m_child_size_blocks - area_block_offset,
num_blocks);
if (!area->is_allocated(area_block_offset, falling_in_area)) {
}
BitAllocator::BitAllocator(int64_t total_blocks, int64_t zone_size_block,
- bmap_alloc_mode_t mode, bool def):
- BitMapAreaIN(total_blocks, zone_size_block, def)
+ bmap_alloc_mode_t mode, bool def)
{
init_check(total_blocks, zone_size_block, mode, def, false);
}
BitAllocator::BitAllocator(int64_t total_blocks, int64_t zone_size_block,
- bmap_alloc_mode_t mode, bool def, bool stats_on):
- BitMapAreaIN(total_blocks, zone_size_block, def)
+ bmap_alloc_mode_t mode, bool def, bool stats_on)
{
init_check(total_blocks, zone_size_block, mode, def, stats_on);
}
{
dout(10) << __func__ <<" instance "<< (uint64_t) this <<
" offset " << offset << " length " << length << dendl;
+ uint64_t size = m_bit_alloc->size() * m_block_size;
- insert_free(ROUND_UP_TO(offset, m_block_size),
- (length / m_block_size) * m_block_size);
+ uint64_t offset_adj = ROUND_UP_TO(offset, m_block_size);
+ uint64_t length_adj = ((length - (offset_adj - offset)) /
+ m_block_size) * m_block_size;
+
+ if ((offset_adj + length_adj) > size) {
+ assert(((offset_adj + length_adj) - m_block_size) < size);
+ length_adj = size - offset_adj;
+ }
+
+ insert_free(offset_adj, length_adj);
}
void BitMapAllocator::init_rm_free(uint64_t offset, uint64_t length)