* Allocate a compressed buf in the same manner as arc_alloc_buf. Don't use this * for bufs containing metadata. */
| 3643 | * for bufs containing metadata. |
| 3644 | */ |
| 3645 | arc_buf_t * |
| 3646 | arc_alloc_compressed_buf(spa_t *spa, void *tag, uint64_t psize, uint64_t lsize, |
| 3647 | enum zio_compress compression_type, uint8_t complevel) |
| 3648 | { |
| 3649 | ASSERT3U(lsize, >, 0); |
| 3650 | ASSERT3U(lsize, >=, psize); |
| 3651 | ASSERT3U(compression_type, >, ZIO_COMPRESS_OFF); |
| 3652 | ASSERT3U(compression_type, <, ZIO_COMPRESS_FUNCTIONS); |
| 3653 | |
| 3654 | arc_buf_hdr_t *hdr = arc_hdr_alloc(spa_load_guid(spa), psize, lsize, |
| 3655 | B_FALSE, compression_type, complevel, ARC_BUFC_DATA, B_FALSE); |
| 3656 | |
| 3657 | arc_buf_t *buf = NULL; |
| 3658 | VERIFY0(arc_buf_alloc_impl(hdr, spa, NULL, tag, B_FALSE, |
| 3659 | B_TRUE, B_FALSE, B_FALSE, &buf)); |
| 3660 | arc_buf_thaw(buf); |
| 3661 | ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); |
| 3662 | |
| 3663 | if (!arc_buf_is_shared(buf)) { |
| 3664 | /* |
| 3665 | * To ensure that the hdr has the correct data in it if we call |
| 3666 | * arc_untransform() on this buf before it's been written to |
| 3667 | * disk, it's easiest if we just set up sharing between the |
| 3668 | * buf and the hdr. |
| 3669 | */ |
| 3670 | arc_hdr_free_abd(hdr, B_FALSE); |
| 3671 | arc_share_buf(hdr, buf); |
| 3672 | } |
| 3673 | |
| 3674 | return (buf); |
| 3675 | } |
| 3676 | |
| 3677 | arc_buf_t * |
| 3678 | arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj, boolean_t byteorder, |
no test coverage detected