diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-26 13:05:53 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-26 14:05:18 +0100 |
commit | 1e737a5c50837a9746bcbf8762f9f45caa332787 (patch) | |
tree | 9b65a848fe084ded3f87545d0d3fc8da163c1086 /Kernel/FileSystem/Ext2FileSystem.cpp | |
parent | 1f9409a65846cfa3b139a250fc652b41650bc6ad (diff) | |
download | serenity-1e737a5c50837a9746bcbf8762f9f45caa332787.zip |
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.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 4fcca1d199..c9247eb731 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -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); |