mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 01:54:57 +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:
parent
af21a45b1a
commit
ca16d9d98e
7 changed files with 117 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue