On 04/26/2013 09:20 PM, korli@xxxxxxxxxxxxxxxx wrote: [...]
############################################################################ Revision: hrev45558 Commit: f7176b0ee50d5367762d904a943a693b0a8e3e2f URL: http://cgit.haiku-os.org/haiku/commit/?id=f7176b0 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Fri Apr 26 18:45:53 2013 UTC VMAnonymousCache.cpp: changed page_index type to page_num_t * consistently use page_num_t for page numbers and off_t for offsets and sizes. ---------------------------------------------------------------------------- diff --git a/src/system/kernel/vm/VMAnonymousCache.cpp b/src/system/kernel/vm/VMAnonymousCache.cpp index 8302f99..ed2161f 100644 --- a/src/system/kernel/vm/VMAnonymousCache.cpp +++ b/src/system/kernel/vm/VMAnonymousCache.cpp @@ -96,7 +96,7 @@ struct swap_file : DoublyLinkedListLinkImpl<swap_file> { struct swap_hash_key { VMAnonymousCache *cache; - off_t page_index; // page index in the cache + page_num_t page_index; // page index in the cache };
Unfortunately this (speaking of the whole commit) isn't quite correct. The data type page_num_t is meant to address physical pages. On a pure 32-bit platform it is only 32 bits wide (not on x86, due to PAE being built in), while the index type used for pages in the cache must be able to address pages in a file. 16 TiB files might seem a bit futuristic ATM, but should we ever get around to re-implementing the block cache on top of VMCache it will be about partition sizes.
So, long story short: off_t is the correct type to use for addressing pages in a cache/file, which page_num_t should only be used for physical pages. The uint32's weren't correct in either case.
CU, Ingo