mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Ext2FS: Resizing an Inode to its current size should do nothing
We were writing out the full block list whenever Ext2FSInode::resize() was called, even if the old and new sizes were identical. This patch makes it a no-op, which drastically improves "cp" speed since we now take full advantage of the up-front call to ftruncate().
This commit is contained in:
parent
5835569527
commit
94a6b248ca
Notes:
sideshowbarker
2024-07-19 11:28:24 +09:00
Author: https://github.com/awesomekling
Commit: 94a6b248ca
1 changed files with 4 additions and 1 deletions
|
@ -668,8 +668,11 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, u8* buffer, FileDes
|
|||
|
||||
KResult Ext2FSInode::resize(u64 new_size)
|
||||
{
|
||||
u64 block_size = fs().block_size();
|
||||
u64 old_size = size();
|
||||
if (old_size == new_size)
|
||||
return KSuccess;
|
||||
|
||||
u64 block_size = fs().block_size();
|
||||
int blocks_needed_before = ceil_div(old_size, block_size);
|
||||
int blocks_needed_after = ceil_div(new_size, block_size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue