mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-09 00:22:43 +02:00
Kernel/Ext2FS: Store the block list as a HashMap rather than a Vector
Since we now only store blocks that are actually allocated, it is entirely valid for the block list to be empty, so this commit lifts the restrictions on accessing inodes with an empty block list.
This commit is contained in:
committed by
Tim Schumacher
parent
ba96a0e4f8
commit
06d4672564
@@ -619,10 +619,9 @@ ErrorOr<void> Ext2FS::free_inode(Ext2FSInode& inode)
|
||||
// Mark all blocks used by this inode as free.
|
||||
{
|
||||
auto blocks = TRY(inode.compute_block_list_with_meta_blocks());
|
||||
for (auto block_index : blocks) {
|
||||
VERIFY(block_index <= super_block().s_blocks_count);
|
||||
if (block_index.value())
|
||||
TRY(set_block_allocation_state(block_index, false));
|
||||
for (auto const& [_, block_index] : blocks) {
|
||||
VERIFY(block_index <= super_block().s_blocks_count && block_index != 0);
|
||||
TRY(set_block_allocation_state(block_index, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user