Kernel VM: Style cleanup; No functional change
This commit is contained in:
@@ -284,8 +284,9 @@ swap_slot_alloc(uint32 count)
|
|||||||
// if this swap file has used more than 90% percent of its space
|
// if this swap file has used more than 90% percent of its space
|
||||||
// switch to another
|
// switch to another
|
||||||
if (sSwapFileAlloc->bmp->free_slots
|
if (sSwapFileAlloc->bmp->free_slots
|
||||||
< (sSwapFileAlloc->last_slot - sSwapFileAlloc->first_slot) / 10)
|
< (sSwapFileAlloc->last_slot - sSwapFileAlloc->first_slot) / 10) {
|
||||||
sSwapFileAlloc = sSwapFileList.GetNext(sSwapFileAlloc);
|
sSwapFileAlloc = sSwapFileList.GetNext(sSwapFileAlloc);
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&sSwapFileListLock);
|
mutex_unlock(&sSwapFileListLock);
|
||||||
|
|
||||||
@@ -299,9 +300,10 @@ find_swap_file(swap_addr_t slotIndex)
|
|||||||
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
|
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
|
||||||
swap_file* swapFile = it.Next();) {
|
swap_file* swapFile = it.Next();) {
|
||||||
if (slotIndex >= swapFile->first_slot
|
if (slotIndex >= swapFile->first_slot
|
||||||
&& slotIndex < swapFile->last_slot)
|
&& slotIndex < swapFile->last_slot) {
|
||||||
return swapFile;
|
return swapFile;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
panic("find_swap_file(): can't find swap file for slot %ld\n", slotIndex);
|
panic("find_swap_file(): can't find swap file for slot %ld\n", slotIndex);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -474,8 +476,8 @@ VMAnonymousCache::Resize(off_t newSize, int priority)
|
|||||||
swap_block* swapBlock = NULL;
|
swap_block* swapBlock = NULL;
|
||||||
|
|
||||||
for (page_num_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
for (page_num_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
pageIndex < oldPageCount && fAllocatedSwapSize > 0;
|
pageIndex < oldPageCount && fAllocatedSwapSize > 0; pageIndex++) {
|
||||||
pageIndex++) {
|
|
||||||
WriteLocker locker(sSwapHashLock);
|
WriteLocker locker(sSwapHashLock);
|
||||||
|
|
||||||
// Get the swap slot index for the page.
|
// Get the swap slot index for the page.
|
||||||
@@ -731,8 +733,8 @@ VMAnonymousCache::WriteAsync(off_t offset, const generic_io_vec* vecs,
|
|||||||
_callback->IOFinished(B_NO_MEMORY, true, 0);
|
_callback->IOFinished(B_NO_MEMORY, true, 0);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
// TODO: If the page already had swap space assigned, we don't need an own
|
// TODO: If the page already had swap space assigned, we don't need an own
|
||||||
// callback.
|
// callback.
|
||||||
|
|
||||||
callback->SetTo(pageIndex, slotIndex, newSlot);
|
callback->SetTo(pageIndex, slotIndex, newSlot);
|
||||||
|
|
||||||
@@ -1291,8 +1293,8 @@ void
|
|||||||
swap_init(void)
|
swap_init(void)
|
||||||
{
|
{
|
||||||
// create swap block cache
|
// create swap block cache
|
||||||
sSwapBlockCache = create_object_cache("swapblock",
|
sSwapBlockCache = create_object_cache("swapblock", sizeof(swap_block),
|
||||||
sizeof(swap_block), sizeof(void*), NULL, NULL, NULL);
|
sizeof(void*), NULL, NULL, NULL);
|
||||||
if (sSwapBlockCache == NULL)
|
if (sSwapBlockCache == NULL)
|
||||||
panic("swap_init(): can't create object cache for swap blocks\n");
|
panic("swap_init(): can't create object cache for swap blocks\n");
|
||||||
|
|
||||||
@@ -1352,8 +1354,9 @@ swap_init_post_modules()
|
|||||||
size = string ? atoll(string) : 0;
|
size = string ? atoll(string) : 0;
|
||||||
|
|
||||||
unload_driver_settings(settings);
|
unload_driver_settings(settings);
|
||||||
} else
|
} else {
|
||||||
size = (off_t)vm_page_num_pages() * B_PAGE_SIZE * 2;
|
size = (off_t)vm_page_num_pages() * B_PAGE_SIZE * 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (size < B_PAGE_SIZE)
|
if (size < B_PAGE_SIZE)
|
||||||
return;
|
return;
|
||||||
@@ -1419,16 +1422,19 @@ swap_total_swap_pages()
|
|||||||
|
|
||||||
uint32 totalSwapSlots = 0;
|
uint32 totalSwapSlots = 0;
|
||||||
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
|
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
|
||||||
swap_file* swapFile = it.Next();)
|
swap_file* swapFile = it.Next();) {
|
||||||
totalSwapSlots += swapFile->last_slot - swapFile->first_slot;
|
totalSwapSlots += swapFile->last_slot - swapFile->first_slot;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&sSwapFileListLock);
|
mutex_unlock(&sSwapFileListLock);
|
||||||
|
|
||||||
return totalSwapSlots;
|
return totalSwapSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // ENABLE_SWAP_SUPPORT
|
#endif // ENABLE_SWAP_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
swap_get_info(struct system_memory_info* info)
|
swap_get_info(struct system_memory_info* info)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user