mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Ext2FS: Use cached inode block list in resize() if available
If we have already cached the block list of an Ext2FSInode, we can save a lot of time by not regenerating it.
This commit is contained in:
parent
541579bc04
commit
20205708b9
Notes:
sideshowbarker
2024-07-19 01:17:18 +09:00
Author: https://github.com/awesomekling
Commit: 20205708b9
1 changed files with 6 additions and 1 deletions
|
@ -772,7 +772,12 @@ KResult Ext2FSInode::resize(u64 new_size)
|
|||
return KResult(-ENOSPC);
|
||||
}
|
||||
|
||||
auto block_list = fs().block_list_for_inode(m_raw_inode);
|
||||
Vector<Ext2FS::BlockIndex> block_list;
|
||||
if (!m_block_list.is_empty())
|
||||
block_list = m_block_list;
|
||||
else
|
||||
fs().block_list_for_inode(m_raw_inode);
|
||||
|
||||
if (blocks_needed_after > blocks_needed_before) {
|
||||
auto new_blocks = fs().allocate_blocks(fs().group_index_from_inode(index()), blocks_needed_after - blocks_needed_before);
|
||||
block_list.append(move(new_blocks));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue