| 282 | } |
| 283 | |
| 284 | static struct bcache_item *_bcache_alloc_freeblock() |
| 285 | { |
| 286 | struct list_elem *e = NULL; |
| 287 | struct bcache_item *item; |
| 288 | |
| 289 | spin_lock(&freelist_lock); |
| 290 | e = list_pop_front(&freelist); |
| 291 | if (e) { |
| 292 | freelist_count--; |
| 293 | } |
| 294 | spin_unlock(&freelist_lock); |
| 295 | |
| 296 | if (e) { |
| 297 | item = _get_entry(e, struct bcache_item, list_elem); |
| 298 | return item; |
| 299 | } |
| 300 | return NULL; |
| 301 | } |
| 302 | |
| 303 | static void _bcache_release_freeblock(struct bcache_item *item) |
| 304 | { |
no test coverage detected