mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
Kernel: Invalidate file-backed VMO's when inodes are written.
The current strategy is simply to nuke all physical pages and force reload them from disk. This is obviously not optimal and should eventually be optimized. It should be fairly straightforward.
This commit is contained in:
@@ -484,6 +484,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, size_t count, const byte* data, F
|
||||
ASSERT(offset >= 0);
|
||||
|
||||
const size_t block_size = fs().block_size();
|
||||
size_t old_size = size();
|
||||
size_t new_size = max(static_cast<size_t>(offset) + count, size());
|
||||
|
||||
unsigned blocks_needed_before = ceil_div(size(), block_size);
|
||||
@@ -557,6 +558,10 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, size_t count, const byte* data, F
|
||||
|
||||
// NOTE: Make sure the cached block list is up to date!
|
||||
m_block_list = move(block_list);
|
||||
|
||||
if (old_size != new_size)
|
||||
inode_size_changed(old_size, new_size);
|
||||
inode_contents_changed(offset, count, data);
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user