summaryrefslogtreecommitdiff
path: root/Kernel/Memory/SharedInodeVMObject.cpp
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-11-18 15:54:39 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-01 09:47:46 +0100
commitc7b90fa7d310dec30da393280a00223464ab5569 (patch)
treeb2cea9a54af49698ea483151cefa86e1f8af9c3f /Kernel/Memory/SharedInodeVMObject.cpp
parent259f78545a8dedbc17d2b377c6e8a3a33c02021b (diff)
downloadserenity-c7b90fa7d310dec30da393280a00223464ab5569.zip
Kernel: Don't rewrite the whole file on sys$msync
Diffstat (limited to 'Kernel/Memory/SharedInodeVMObject.cpp')
-rw-r--r--Kernel/Memory/SharedInodeVMObject.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Memory/SharedInodeVMObject.cpp b/Kernel/Memory/SharedInodeVMObject.cpp
index 15ad1c39e2..9d31e82fc7 100644
--- a/Kernel/Memory/SharedInodeVMObject.cpp
+++ b/Kernel/Memory/SharedInodeVMObject.cpp
@@ -35,11 +35,13 @@ SharedInodeVMObject::SharedInodeVMObject(SharedInodeVMObject const& other)
{
}
-ErrorOr<void> SharedInodeVMObject::sync()
+ErrorOr<void> SharedInodeVMObject::sync(off_t offset_in_pages, size_t pages)
{
SpinlockLocker locker(m_lock);
- for (size_t page_index = 0; page_index < page_count(); ++page_index) {
+ size_t highest_page_to_flush = min(page_count(), offset_in_pages + pages);
+
+ for (size_t page_index = offset_in_pages; page_index < highest_page_to_flush; ++page_index) {
auto& physical_page = m_physical_pages[page_index];
if (!physical_page)
continue;