Move resizing the page_protections before resizing the cache to avoid a needless

resize operation that has to be undone and may fail when doing so.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42332 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2011-06-28 00:15:12 +00:00
parent 1e1e05fdba
commit 02cd58f418

View File

@ -4761,10 +4761,6 @@ vm_resize_area(area_id areaID, size_t newSize, bool kernel)
}
}
// shrinking the cache can't fail, so we do it now
if (status == B_OK && newSize < oldSize)
status = cache->Resize(cache->virtual_base + newSize, priority);
if (status == B_OK) {
// Shrink or grow individual page protections if in use.
if (area->page_protections != NULL) {
@ -4792,6 +4788,10 @@ vm_resize_area(area_id areaID, size_t newSize, bool kernel)
}
}
// shrinking the cache can't fail, so we do it now
if (status == B_OK && newSize < oldSize)
status = cache->Resize(cache->virtual_base + newSize, priority);
if (status != B_OK) {
// Something failed -- resize the areas back to their original size.
// This can fail, too, in which case we're seriously screwed.