VMAnonymousCache.cpp: use off_t instead of page_num_t
* use off_t instead of page_num_t to fit in swap_hash_key struct. * this fixes narrowing conversion and signedness warnings on GCC 4.7.
This commit is contained in:
@@ -490,10 +490,10 @@ VMAnonymousCache::Resize(off_t newSize, int priority)
|
|||||||
{
|
{
|
||||||
// If the cache size shrinks, drop all swap pages beyond the new size.
|
// If the cache size shrinks, drop all swap pages beyond the new size.
|
||||||
if (fAllocatedSwapSize > 0) {
|
if (fAllocatedSwapSize > 0) {
|
||||||
page_num_t oldPageCount = (virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
off_t oldPageCount = (virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
swap_block* swapBlock = NULL;
|
swap_block* swapBlock = NULL;
|
||||||
|
|
||||||
for (page_num_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
for (off_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
pageIndex < oldPageCount && fAllocatedSwapSize > 0; pageIndex++) {
|
pageIndex < oldPageCount && fAllocatedSwapSize > 0; pageIndex++) {
|
||||||
|
|
||||||
WriteLocker locker(sSwapHashLock);
|
WriteLocker locker(sSwapHashLock);
|
||||||
@@ -579,7 +579,7 @@ VMAnonymousCache::HasPage(off_t offset)
|
|||||||
bool
|
bool
|
||||||
VMAnonymousCache::DebugHasPage(off_t offset)
|
VMAnonymousCache::DebugHasPage(off_t offset)
|
||||||
{
|
{
|
||||||
page_num_t pageIndex = offset >> PAGE_SHIFT;
|
off_t pageIndex = offset >> PAGE_SHIFT;
|
||||||
swap_hash_key key = { this, pageIndex };
|
swap_hash_key key = { this, pageIndex };
|
||||||
swap_block* swap = sSwapHashTable.Lookup(key);
|
swap_block* swap = sSwapHashTable.Lookup(key);
|
||||||
if (swap == NULL)
|
if (swap == NULL)
|
||||||
@@ -1093,7 +1093,7 @@ VMAnonymousCache::_MergeSwapPages(VMAnonymousCache* source)
|
|||||||
|
|
||||||
WriteLocker locker(sSwapHashLock);
|
WriteLocker locker(sSwapHashLock);
|
||||||
|
|
||||||
page_num_t swapBlockPageIndex = offset >> PAGE_SHIFT;
|
off_t swapBlockPageIndex = offset >> PAGE_SHIFT;
|
||||||
swap_hash_key key = { source, swapBlockPageIndex };
|
swap_hash_key key = { source, swapBlockPageIndex };
|
||||||
swap_block* sourceSwapBlock = sSwapHashTable.Lookup(key);
|
swap_block* sourceSwapBlock = sSwapHashTable.Lookup(key);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user