mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +00:00
Kernel: Don't rewrite the whole file on sys$msync
This commit is contained in:
parent
259f78545a
commit
c7b90fa7d3
Notes:
sideshowbarker
2024-07-17 23:15:58 +09:00
Author: https://github.com/Hendiadyoin1
Commit: c7b90fa7d3
Pull-request: https://github.com/SerenityOS/serenity/pull/10957
Reviewed-by: https://github.com/Dexesttp
3 changed files with 10 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue