mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-13 02:16:39 +02:00
Kernel: Add method to clean up remapping region loops
In the VMObject code there are multiple examples of loops over the VMObject's regions (using for_each_region()) that call remap() on each region. To clean up usage of this pattern, this patch adds a method in VMObject that does this remapping loop. VMObject code that needs to remap its regions call the new method.
This commit is contained in:
@@ -59,11 +59,8 @@ int InodeVMObject::release_all_clean_pages()
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (count) {
|
||||
for_each_region([](auto& region) {
|
||||
region.remap();
|
||||
});
|
||||
}
|
||||
if (count)
|
||||
remap_regions();
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -78,11 +75,8 @@ int InodeVMObject::try_release_clean_pages(int page_amount)
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (count) {
|
||||
for_each_region([](auto& region) {
|
||||
region.remap();
|
||||
});
|
||||
}
|
||||
if (count)
|
||||
remap_regions();
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user