MCPcopy Create free account
hub / github.com/F-Stack/f-stack / arc_alloc_compressed_buf

Function arc_alloc_compressed_buf

freebsd/contrib/openzfs/module/zfs/arc.c:3645–3675  ·  view source on GitHub ↗

* Allocate a compressed buf in the same manner as arc_alloc_buf. Don't use this * for bufs containing metadata. */

Source from the content-addressed store, hash-verified

3643 * for bufs containing metadata.
3644 */
3645arc_buf_t *
3646arc_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
3677arc_buf_t *
3678arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj, boolean_t byteorder,

Callers 2

arc_loan_compressed_bufFunction · 0.85

Calls 7

arc_hdr_allocFunction · 0.85
spa_load_guidFunction · 0.85
arc_buf_alloc_implFunction · 0.85
arc_buf_thawFunction · 0.85
arc_buf_is_sharedFunction · 0.85
arc_hdr_free_abdFunction · 0.85
arc_share_bufFunction · 0.85

Tested by

no test coverage detected