FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
/*
 * Releases the temporary b_tmp_cdata buffer in an l2arc header structure.
 * This buffer serves as a temporary holder of compressed or padded data while
 * the buffer entry is being written to an l2arc device. Once that is
 * done, we can dispose of it.
 */
Releases the temporary b_tmp_cdata buffer in an l2arc header structure.
This buffer serves as a temporary holder of compressed or padded data while
the buffer entry is being written to an l2arc device. Once that is
done, we can dispose of it.
Releases the temporary b_tmp_cdata buffer in an l2arc header structure . This buffer serves as a temporary holder of compressed or padded data while the buffer entry is being written to an l2arc device . Once that is done we can dispose of it .
static void
l2arc_release_cdata_buf(arc_buf_hdr_t *hdr)
{
	size_t align, asize, len;
	enum zio_compress comp = hdr->b_l2hdr.b_compress;
	ASSERT(HDR_HAS_L2HDR(hdr));
	ASSERT(HDR_HAS_L1HDR(hdr));
	ASSERT(comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS(comp));
	if (hdr->b_l1hdr.b_tmp_cdata != NULL) {
		ASSERT(comp != ZIO_COMPRESS_EMPTY);
		len = hdr->b_size;
		align = (size_t)1 << hdr->b_l2hdr.b_dev->l2ad_vdev->vdev_ashift;
		asize = P2ROUNDUP(len, align);
		zio_data_buf_free(hdr->b_l1hdr.b_tmp_cdata, asize);
		hdr->b_l1hdr.b_tmp_cdata = NULL;
	} else {
		ASSERT(comp == ZIO_COMPRESS_OFF || comp == ZIO_COMPRESS_EMPTY);
	}
}
static void l2arc_release_cdata_buf ( arc_buf_hdr_t * hdr ) { size_t align , asize , len ; enum zio_compress comp = hdr -> b_l2hdr . b_compress ; ASSERT ( HDR_HAS_L2HDR ( hdr ) ) ; ASSERT ( HDR_HAS_L1HDR ( hdr ) ) ; ASSERT ( comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS ( comp ) ) ; if ( hdr -> b_l1hdr . b_tmp_cdata != NULL ) { ASSERT ( comp != ZIO_COMPRESS_EMPTY ) ; len = hdr -> b_size ; align = ( size_t ) 1 << hdr -> b_l2hdr . b_dev -> l2ad_vdev -> vdev_ashift ; asize = P2ROUNDUP ( len , align ) ; zio_data_buf_free ( hdr -> b_l1hdr . b_tmp_cdata , asize ) ; hdr -> b_l1hdr . b_tmp_cdata = NULL ; } else { ASSERT ( comp == ZIO_COMPRESS_OFF || comp == ZIO_COMPRESS_EMPTY ) ; } }
Releases the temporary b_tmp_cdata buffer in an l2arc header structure.
Releases the temporary b_tmp_cdata buffer in an l2arc header structure .