* at a time single thread can be active as well as single biggest
* contiguous allocation that can be requested.
*
- * Rest of the nodes are classified in to three catagories:
+ * Rest of the nodes are classified into three catagories:
* root note or Allocator
* internal nodes or BitMapAreaIN
- * finally nodes that contains Zones called BitMapAreaLeaf
+ * final nodes that contains Zones called BitMapAreaLeaf
* This classification is according to their own implmentation of some
* of the interfaces defined in BitMapArea.
*/
bmap_t BmapEntry::bit_mask(int bit)
{
return m_bit_to_mask[bit];
-// return ((bmap_t) 0x1 << ((BmapEntry::size() - 1) - bit));
}
bool BmapEntry::check_bit(int bit)
{
}
/*
- * Find N free bits starting search from an given offset.
+ * Find N free bits starting search from a given offset.
*
* Returns number of bits found, start bit and end of
* index next to bit where our search ended + 1.
while ((child = (BitMapArea *) iter.next())) {
if (!child_check_n_lock(child, 1)) {
- hint = 0;
+ hint = 0;
continue;
}
alloc_assert(num_child);
m_child_size_blocks = total_blocks / num_child;
- alloc_assert(m_level == 1);
BitMapArea **children = new BitMapArea*[num_child];
for (int i = 0; i < num_child; i++) {
children[i] = new BitMapZone(cct, m_child_size_blocks, i, def);
while ((child = (BitMapArea *) iter.next())) {
if (!child_check_n_lock(child, 1, false)) {
- hint = 0;
+ hint = 0;
continue;
}
if (allocated == num_blocks) {
break;
}
- hint = 0;
+ hint = 0;
}
return allocated;
}
init(total_blocks, 0, def);
if (!def && unaligned_blocks) {
/*
- * Mark extra padded blocks used from begning.
+ * Mark extra padded blocks used from beginning.
*/
set_blocks_used(total_blocks - m_extra_blocks, m_extra_blocks);
}
bool BitAllocator::check_input_dis(int64_t num_blocks)
{
- if (num_blocks == 0) {
- return false;
- }
-
- if (num_blocks > size()) {
+ if (num_blocks == 0 || num_blocks > size()) {
return false;
}
return true;
bool BitAllocator::check_input(int64_t num_blocks)
{
- if (num_blocks == 0) {
- return false;
- }
-
- if (num_blocks > get_zone_size(cct)) {
+ if (num_blocks == 0 || num_blocks > get_zone_size(cct)) {
return false;
}
return true;