compress: rework callers to always use the zio_compress calls
This will make future refactoring easier. There are two we can't change for the moment, because zio_compress_data does hole detection & collapsing which zio_decompress_data does not actually know how to handle. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
This commit is contained in:
parent
ba2209ec9e
commit
5eede0d5fd
|
@ -142,8 +142,11 @@ decode_embedded_bp(const blkptr_t *bp, void *buf, int buflen)
|
|||
if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF) {
|
||||
uint8_t dstbuf[BPE_PAYLOAD_SIZE];
|
||||
decode_embedded_bp_compressed(bp, dstbuf);
|
||||
VERIFY0(zio_decompress_data_buf(BP_GET_COMPRESS(bp),
|
||||
dstbuf, buf, psize, buflen, NULL));
|
||||
abd_t dstabd;
|
||||
abd_get_from_buf_struct(&dstabd, dstbuf, psize);
|
||||
VERIFY0(zio_decompress_data(BP_GET_COMPRESS(bp), &dstabd,
|
||||
buf, psize, buflen, NULL));
|
||||
abd_free(&dstabd);
|
||||
} else {
|
||||
ASSERT3U(lsize, ==, psize);
|
||||
decode_embedded_bp_compressed(bp, buf);
|
||||
|
|
|
@ -52,6 +52,7 @@ ddt_zap_compress(const void *src, uchar_t *dst, size_t s_len, size_t d_len)
|
|||
|
||||
ASSERT3U(d_len, >=, s_len + 1); /* no compression plus version byte */
|
||||
|
||||
/* Call compress function directly to avoid hole detection. */
|
||||
c_len = ci->ci_compress((void *)src, dst, s_len, d_len - 1,
|
||||
ci->ci_level);
|
||||
|
||||
|
@ -72,12 +73,16 @@ ddt_zap_decompress(uchar_t *src, void *dst, size_t s_len, size_t d_len)
|
|||
{
|
||||
uchar_t version = *src++;
|
||||
int cpfunc = version & DDT_ZAP_COMPRESS_FUNCTION_MASK;
|
||||
zio_compress_info_t *ci = &zio_compress_table[cpfunc];
|
||||
|
||||
if (ci->ci_decompress != NULL)
|
||||
(void) ci->ci_decompress(src, dst, s_len, d_len, ci->ci_level);
|
||||
else
|
||||
if (zio_compress_table[cpfunc].ci_decompress == NULL) {
|
||||
memcpy(dst, src, d_len);
|
||||
return;
|
||||
}
|
||||
|
||||
abd_t sabd;
|
||||
abd_get_from_buf_struct(&sabd, src, s_len);
|
||||
VERIFY0(zio_decompress_data(cpfunc, &sabd, dst, s_len, d_len, NULL));
|
||||
abd_free(&sabd);
|
||||
|
||||
if (((version & DDT_ZAP_COMPRESS_BYTEORDER_MASK) != 0) !=
|
||||
(ZFS_HOST_BYTEORDER != 0))
|
||||
|
|
|
@ -2425,6 +2425,7 @@ get_receive_resume_token_impl(dsl_dataset_t *ds)
|
|||
fnvlist_free(token_nv);
|
||||
compressed = kmem_alloc(packed_size, KM_SLEEP);
|
||||
|
||||
/* Call compress function directly to avoid hole detection. */
|
||||
compressed_size = gzip_compress(packed, compressed,
|
||||
packed_size, packed_size, 6);
|
||||
|
||||
|
|
Loading…
Reference in New Issue