Changeset 00c2de63 in mainline for uspace/lib/block/libblock.c
- Timestamp:
- 2011-07-29T14:50:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b6759f4
- Parents:
- 6c69d19 (diff), 7ae249d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/block/libblock.c
r6c69d19 r00c2de63 258 258 static hash_index_t cache_hash(unsigned long *key) 259 259 { 260 return *key& (CACHE_BUCKETS - 1);260 return MERGE_LOUP32(key[0], key[1]) & (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 == *key;266 return b->lba == MERGE_LOUP32(key[0], key[1]); 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, 1,307 if (!hash_table_create(&cache->block_hash, CACHE_BUCKETS, 2, 308 308 &cache_ops)) { 309 309 free(cache); … … 344 344 } 345 345 346 unsigned long key = b->lba; 347 hash_table_remove(&cache->block_hash, &key, 1); 346 unsigned long key[2] = { 347 LOWER32(b->lba), 348 UPPER32(b->lba) 349 }; 350 hash_table_remove(&cache->block_hash, key, 2); 348 351 349 352 free(b->data); … … 398 401 block_t *b; 399 402 link_t *l; 400 unsigned long key = ba; 403 unsigned long key[2] = { 404 LOWER32(ba), 405 UPPER32(ba) 406 }; 407 401 408 int rc; 402 409 … … 413 420 414 421 fibril_mutex_lock(&cache->lock); 415 l = hash_table_find(&cache->block_hash, &key);422 l = hash_table_find(&cache->block_hash, key); 416 423 if (l) { 417 424 found: … … 451 458 * Try to recycle a block from the free list. 452 459 */ 453 unsigned long temp_key;454 460 recycle: 455 461 if (list_empty(&cache->free_list)) { … … 499 505 goto retry; 500 506 } 501 l = hash_table_find(&cache->block_hash, &key);507 l = hash_table_find(&cache->block_hash, key); 502 508 if (l) { 503 509 /* … … 522 528 */ 523 529 list_remove(&b->free_link); 524 temp_key = b->lba; 525 hash_table_remove(&cache->block_hash, &temp_key, 1); 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); 526 535 } 527 536 … … 531 540 b->lba = ba; 532 541 b->pba = ba_ltop(devcon, b->lba); 533 hash_table_insert(&cache->block_hash, &key, &b->hash_link);542 hash_table_insert(&cache->block_hash, key, &b->hash_link); 534 543 535 544 /* … … 643 652 * Take the block out of the cache and free it. 644 653 */ 645 unsigned long key = block->lba; 646 hash_table_remove(&cache->block_hash, &key, 1); 654 unsigned long key[2] = { 655 LOWER32(block->lba), 656 UPPER32(block->lba) 657 }; 658 hash_table_remove(&cache->block_hash, key, 2); 647 659 fibril_mutex_unlock(&block->lock); 648 660 free(block->data);
Note:
See TracChangeset
for help on using the changeset viewer.