diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-01 12:11:50 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-01 12:11:50 +0100 |
commit | b6144620795df0f01708694e1d45217af6fa0286 (patch) | |
tree | 6008c30bddc1de45577606b373e0db2e956eb1f2 | |
parent | 0ef83911d7e94c6a47b6559e9c3c8bdf7993a10c (diff) | |
download | serenity-b6144620795df0f01708694e1d45217af6fa0286.zip |
Kernel: Include the dirty bits when cloning an InodeVMObject
Now that (private) InodeVMObjects can be CoW-cloned on fork(), we need
to make sure we clone the dirty bits as well.
-rw-r--r-- | Kernel/VM/InodeVMObject.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index 0e027fe501..8c5b07d413 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -41,7 +41,10 @@ InodeVMObject::InodeVMObject(Inode& inode, size_t size) InodeVMObject::InodeVMObject(const InodeVMObject& other) : VMObject(other) , m_inode(other.m_inode) + , m_dirty_pages(page_count(), false) { + for (size_t i = 0; i < page_count(); ++i) + m_dirty_pages.set(i, other.m_dirty_pages.get(i)); } InodeVMObject::~InodeVMObject() @@ -51,7 +54,7 @@ InodeVMObject::~InodeVMObject() size_t InodeVMObject::amount_clean() const { size_t count = 0; - ASSERT(page_count() == (size_t)m_dirty_pages.size()); + ASSERT(page_count() == m_dirty_pages.size()); for (size_t i = 0; i < page_count(); ++i) { if (!m_dirty_pages.get(i) && m_physical_pages[i]) ++count; |