Changes in uspace/lib/block/libblock.c [867e2555:b72efe8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/block/libblock.c
r867e2555 rb72efe8 258 258 static hash_index_t cache_hash(unsigned long *key) 259 259 { 260 return MERGE_LOUP32(key[0], key[1])& (CACHE_BUCKETS - 1);260 return *key & (CACHE_BUCKETS - 1); 261 261 } 262 262 … … 264 264 { 265 265 block_t *b = hash_table_get_instance(item, block_t, hash_link); 266 return b->lba == MERGE_LOUP32(key[0], key[1]);266 return b->lba == *key; 267 267 } 268 268 … … 305 305 cache->blocks_cluster = cache->lblock_size / devcon->pblock_size; 306 306 307 if (!hash_table_create(&cache->block_hash, CACHE_BUCKETS, 2,307 if (!hash_table_create(&cache->block_hash, CACHE_BUCKETS, 1, 308 308 &cache_ops)) { 309 309 free(cache); … … 344 344 } 345 345 346 unsigned long key[2] = { 347 LOWER32(b->lba), 348 UPPER32(b->lba) 349 }; 350 hash_table_remove(&cache->block_hash, key, 2); 346 unsigned long key = b->lba; 347 hash_table_remove(&cache->block_hash, &key, 1); 351 348 352 349 free(b->data); … … 401 398 block_t *b; 402 399 link_t *l; 403 unsigned long key[2] = { 404 LOWER32(ba), 405 UPPER32(ba) 406 }; 407 400 unsigned long key = ba; 408 401 int rc; 409 402 … … 420 413 421 414 fibril_mutex_lock(&cache->lock); 422 l = hash_table_find(&cache->block_hash, key);415 l = hash_table_find(&cache->block_hash, &key); 423 416 if (l) { 424 417 found: … … 458 451 * Try to recycle a block from the free list. 459 452 */ 453 unsigned long temp_key; 460 454 recycle: 461 455 if (list_empty(&cache->free_list)) { … … 505 499 goto retry; 506 500 } 507 l = hash_table_find(&cache->block_hash, key);501 l = hash_table_find(&cache->block_hash, &key); 508 502 if (l) { 509 503 /* … … 528 522 */ 529 523 list_remove(&b->free_link); 530 unsigned long temp_key[2] = { 531 LOWER32(b->lba), 532 UPPER32(b->lba) 533 }; 534 hash_table_remove(&cache->block_hash, temp_key, 2); 524 temp_key = b->lba; 525 hash_table_remove(&cache->block_hash, &temp_key, 1); 535 526 } 536 527 … … 540 531 b->lba = ba; 541 532 b->pba = ba_ltop(devcon, b->lba); 542 hash_table_insert(&cache->block_hash, key, &b->hash_link);533 hash_table_insert(&cache->block_hash, &key, &b->hash_link); 543 534 544 535 /* … … 652 643 * Take the block out of the cache and free it. 653 644 */ 654 unsigned long key[2] = { 655 LOWER32(block->lba), 656 UPPER32(block->lba) 657 }; 658 hash_table_remove(&cache->block_hash, key, 2); 645 unsigned long key = block->lba; 646 hash_table_remove(&cache->block_hash, &key, 1); 659 647 fibril_mutex_unlock(&block->lock); 660 648 free(block->data);
Note:
See TracChangeset
for help on using the changeset viewer.