|
@@ -54,9 +54,15 @@ static void disk_cache_init(void)
|
|
|
dll_init(hp++);
|
|
|
}
|
|
|
|
|
|
-static inline struct dll *hash_slot(block_t block)
|
|
|
+static inline __attribute__((const)) struct dll *hash_slot(block_t block)
|
|
|
{
|
|
|
- return &cache_hash[(0x34f1f85d * block) % CACHE_BLOCKS];
|
|
|
+ uint64_t m;
|
|
|
+ uint32_t hash;
|
|
|
+
|
|
|
+ m = UINT64_C(0x34f1f85d) * block;
|
|
|
+ hash = (m >> 32) + m;
|
|
|
+
|
|
|
+ return &cache_hash[hash % CACHE_BLOCKS];
|
|
|
}
|
|
|
|
|
|
static struct cache_block *disk_cache_find(block_t block)
|