* NAME: findbucket() * DESCRIPTION: locate a bucket in the cache, and/or its hash slot */
| 372 | * DESCRIPTION: locate a bucket in the cache, and/or its hash slot |
| 373 | */ |
| 374 | static |
| 375 | bucket *findbucket(bcache *cache, unsigned long bnum, bucket ***hslot) |
| 376 | { |
| 377 | bucket *b; |
| 378 | |
| 379 | *hslot = &cache->hash[bnum & (HFS_HASHSZ - 1)]; |
| 380 | |
| 381 | for (b = **hslot; b; b = b->hnext) |
| 382 | { |
| 383 | if (INUSE(b) && b->bnum == bnum) |
| 384 | break; |
| 385 | } |
| 386 | |
| 387 | return b; |
| 388 | } |
| 389 | |
| 390 | /* |
| 391 | * NAME: reuse() |