Kernel VM: Style cleanup; No functional change

This commit is contained in:
Alexander von Gluck IV
2012-09-04 08:42:36 -05:00
parent 098967cee1
commit 3d87b8120c
+14 -8
View File
@@ -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.
@@ -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)
{ {