Ext2FS: Don't reload already-cached block list when freeing inode
If we already have a cached copy of the inode's block list, we can use that to free the blocks. No need to reload the list.
This commit is contained in:
parent
1f9409a658
commit
1e737a5c50
Notes:
sideshowbarker
2024-07-18 21:54:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1e737a5c508
1 changed files with 4 additions and 2 deletions
|
@ -543,8 +543,10 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
dbgln_if(EXT2_DEBUG, "Ext2FS: Inode {} has no more links, time to delete!", inode.index());
|
||||
|
||||
// Mark all blocks used by this inode as free.
|
||||
auto block_list = block_list_for_inode(inode.m_raw_inode, true);
|
||||
for (auto block_index : block_list) {
|
||||
if (inode.m_block_list.is_empty())
|
||||
inode.m_block_list = block_list_for_inode(inode.m_raw_inode, true);
|
||||
|
||||
for (auto block_index : inode.m_block_list) {
|
||||
VERIFY(block_index <= super_block().s_blocks_count);
|
||||
if (block_index.value()) {
|
||||
auto result = set_block_allocation_state(block_index, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue