| 3675 | } |
| 3676 | |
| 3677 | arc_buf_t * |
| 3678 | arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj, boolean_t byteorder, |
| 3679 | const uint8_t *salt, const uint8_t *iv, const uint8_t *mac, |
| 3680 | dmu_object_type_t ot, uint64_t psize, uint64_t lsize, |
| 3681 | enum zio_compress compression_type, uint8_t complevel) |
| 3682 | { |
| 3683 | arc_buf_hdr_t *hdr; |
| 3684 | arc_buf_t *buf; |
| 3685 | arc_buf_contents_t type = DMU_OT_IS_METADATA(ot) ? |
| 3686 | ARC_BUFC_METADATA : ARC_BUFC_DATA; |
| 3687 | |
| 3688 | ASSERT3U(lsize, >, 0); |
| 3689 | ASSERT3U(lsize, >=, psize); |
| 3690 | ASSERT3U(compression_type, >=, ZIO_COMPRESS_OFF); |
| 3691 | ASSERT3U(compression_type, <, ZIO_COMPRESS_FUNCTIONS); |
| 3692 | |
| 3693 | hdr = arc_hdr_alloc(spa_load_guid(spa), psize, lsize, B_TRUE, |
| 3694 | compression_type, complevel, type, B_TRUE); |
| 3695 | |
| 3696 | hdr->b_crypt_hdr.b_dsobj = dsobj; |
| 3697 | hdr->b_crypt_hdr.b_ot = ot; |
| 3698 | hdr->b_l1hdr.b_byteswap = (byteorder == ZFS_HOST_BYTEORDER) ? |
| 3699 | DMU_BSWAP_NUMFUNCS : DMU_OT_BYTESWAP(ot); |
| 3700 | bcopy(salt, hdr->b_crypt_hdr.b_salt, ZIO_DATA_SALT_LEN); |
| 3701 | bcopy(iv, hdr->b_crypt_hdr.b_iv, ZIO_DATA_IV_LEN); |
| 3702 | bcopy(mac, hdr->b_crypt_hdr.b_mac, ZIO_DATA_MAC_LEN); |
| 3703 | |
| 3704 | /* |
| 3705 | * This buffer will be considered encrypted even if the ot is not an |
| 3706 | * encrypted type. It will become authenticated instead in |
| 3707 | * arc_write_ready(). |
| 3708 | */ |
| 3709 | buf = NULL; |
| 3710 | VERIFY0(arc_buf_alloc_impl(hdr, spa, NULL, tag, B_TRUE, B_TRUE, |
| 3711 | B_FALSE, B_FALSE, &buf)); |
| 3712 | arc_buf_thaw(buf); |
| 3713 | ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); |
| 3714 | |
| 3715 | return (buf); |
| 3716 | } |
| 3717 | |
| 3718 | static void |
| 3719 | l2arc_hdr_arcstats_update(arc_buf_hdr_t *hdr, boolean_t incr, |
no test coverage detected