* Use zio_buf_alloc to allocate ZFS metadata. This data will appear in a * crashdump if the kernel panics, so use it judiciously. Obviously, it's * useful to inspect ZFS metadata, but if possible, we should avoid keeping * excess / transient data in-core during a crashdump. */
| 319 | * excess / transient data in-core during a crashdump. |
| 320 | */ |
| 321 | void * |
| 322 | zio_buf_alloc(size_t size) |
| 323 | { |
| 324 | size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; |
| 325 | |
| 326 | VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); |
| 327 | #if defined(ZFS_DEBUG) && !defined(_KERNEL) |
| 328 | atomic_add_64(&zio_buf_cache_allocs[c], 1); |
| 329 | #endif |
| 330 | |
| 331 | return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | * Use zio_data_buf_alloc to allocate data. The data will not appear in a |
no test coverage detected