mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user