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:
brody-qq
2024-06-02 01:51:14 +01:00
committed by Tim Ledbetter
parent 0608f15e25
commit a4ca757db9
5 changed files with 18 additions and 21 deletions

View File

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