1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +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:
Andreas Kling 2019-02-05 08:17:46 +01:00
parent af21a45b1a
commit ca16d9d98e
7 changed files with 117 additions and 11 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Vector.h>
#include <AK/HashTable.h>
#include <AK/AKString.h>
#include <AK/Badge.h>
#include <Kernel/VirtualFileSystem.h>
#define PAGE_ROUND_UP(x) ((((dword)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
@ -98,11 +99,17 @@ public:
const Vector<RetainPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
Vector<RetainPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }
void inode_contents_changed(Badge<Inode>, off_t, size_t, const byte*);
void inode_size_changed(Badge<Inode>, size_t old_size, size_t new_size);
private:
VMObject(RetainPtr<Inode>&&);
explicit VMObject(VMObject&);
explicit VMObject(size_t);
VMObject(PhysicalAddress, size_t);
template<typename Callback> void for_each_region(Callback);
String m_name;
bool m_anonymous { false };
off_t m_inode_offset { 0 };
@ -225,7 +232,7 @@ public:
RetainPtr<PhysicalPage> allocate_physical_page(ShouldZeroFill);
RetainPtr<PhysicalPage> allocate_supervisor_physical_page();
void remap_region(Process&, Region&);
void remap_region(PageDirectory&, Region&);
size_t ram_size() const { return m_ram_size; }