mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Ext2FS: Remove unused allocate_block()
We only use allocate_blocks() now. If you want a single block, you can just call allocate_blocks() with a count of 1.
This commit is contained in:
parent
259ead5d7a
commit
75a6b27f73
2 changed files with 0 additions and 35 deletions
|
@ -1049,40 +1049,6 @@ bool Ext2FS::write_ext2_inode(unsigned inode, const ext2_inode& e2inode)
|
|||
return success;
|
||||
}
|
||||
|
||||
Ext2FS::BlockIndex Ext2FS::allocate_block(GroupIndex preferred_group_index)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
dbg() << "Ext2FS: allocate_block() preferred_group_index: " << preferred_group_index;
|
||||
#endif
|
||||
bool found_a_group = false;
|
||||
GroupIndex group_index = preferred_group_index;
|
||||
|
||||
if (group_descriptor(preferred_group_index).bg_free_blocks_count) {
|
||||
found_a_group = true;
|
||||
} else {
|
||||
for (group_index = 1; group_index < m_block_group_count; ++group_index) {
|
||||
if (group_descriptor(group_index).bg_free_blocks_count) {
|
||||
found_a_group = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT(found_a_group);
|
||||
auto& bgd = group_descriptor(group_index);
|
||||
auto& cached_bitmap = get_bitmap_block(bgd.bg_block_bitmap);
|
||||
|
||||
int blocks_in_group = min(blocks_per_group(), super_block().s_blocks_count);
|
||||
auto block_bitmap = Bitmap::wrap(cached_bitmap.buffer.data(), blocks_in_group);
|
||||
|
||||
BlockIndex first_block_in_group = (group_index - 1) * blocks_per_group() + first_block_index();
|
||||
auto first_unset_bit_index = block_bitmap.find_first_unset();
|
||||
ASSERT(first_unset_bit_index.has_value());
|
||||
BlockIndex block_index = first_unset_bit_index.value() + first_block_in_group;
|
||||
set_block_allocation_state(block_index, true);
|
||||
return block_index;
|
||||
}
|
||||
|
||||
Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
|
|
|
@ -136,7 +136,6 @@ private:
|
|||
BlockIndex first_block_index() const;
|
||||
InodeIndex find_a_free_inode(GroupIndex preferred_group, off_t expected_size);
|
||||
Vector<BlockIndex> allocate_blocks(GroupIndex preferred_group_index, size_t count);
|
||||
BlockIndex allocate_block(GroupIndex preferred_group_index);
|
||||
GroupIndex group_index_from_inode(InodeIndex) const;
|
||||
GroupIndex group_index_from_block_index(BlockIndex) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue