Kernel: Don't rewrite the whole file on sys$msync

This commit is contained in:
Hendiadyoin1 2021-11-18 15:54:39 +01:00 committed by Andreas Kling
parent 259f78545a
commit c7b90fa7d3
Notes: sideshowbarker 2024-07-17 23:15:58 +09:00
3 changed files with 10 additions and 4 deletions

View file

@ -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;