compress: remove zio_decompress_data_buf

Nothing uses it anymore!

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
This commit is contained in:
Rob Norris 2024-06-29 11:47:16 +10:00 committed by Tony Hutter
parent b4d81b1a6a
commit e119483a95
2 changed files with 10 additions and 16 deletions

View File

@ -187,8 +187,6 @@ extern size_t zio_compress_data(enum zio_compress c, abd_t *src, void **dst,
size_t s_len, uint8_t level); size_t s_len, uint8_t level);
extern int zio_decompress_data(enum zio_compress c, abd_t *src, void *dst, extern int zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
size_t s_len, size_t d_len, uint8_t *level); size_t s_len, size_t d_len, uint8_t *level);
extern int zio_decompress_data_buf(enum zio_compress c, void *src, void *dst,
size_t s_len, size_t d_len, uint8_t *level);
extern int zio_compress_to_feature(enum zio_compress comp); extern int zio_compress_to_feature(enum zio_compress comp);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -161,26 +161,22 @@ zio_compress_data(enum zio_compress c, abd_t *src, void **dst, size_t s_len,
} }
int int
zio_decompress_data_buf(enum zio_compress c, void *src, void *dst, zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
size_t s_len, size_t d_len, uint8_t *level) size_t s_len, size_t d_len, uint8_t *level)
{ {
zio_compress_info_t *ci = &zio_compress_table[c]; zio_compress_info_t *ci = &zio_compress_table[c];
if ((uint_t)c >= ZIO_COMPRESS_FUNCTIONS || ci->ci_decompress == NULL) if ((uint_t)c >= ZIO_COMPRESS_FUNCTIONS || ci->ci_decompress == NULL)
return (SET_ERROR(EINVAL)); return (SET_ERROR(EINVAL));
void *sbuf = abd_borrow_buf_copy(src, s_len);
int err;
if (ci->ci_decompress_level != NULL && level != NULL) if (ci->ci_decompress_level != NULL && level != NULL)
return (ci->ci_decompress_level(src, dst, s_len, d_len, level)); err = ci->ci_decompress_level(sbuf, dst, s_len, d_len, level);
else
err = ci->ci_decompress(sbuf, dst, s_len, d_len, ci->ci_level);
return (ci->ci_decompress(src, dst, s_len, d_len, ci->ci_level)); abd_return_buf(src, sbuf, s_len);
}
int
zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
size_t s_len, size_t d_len, uint8_t *level)
{
void *tmp = abd_borrow_buf_copy(src, s_len);
int ret = zio_decompress_data_buf(c, tmp, dst, s_len, d_len, level);
abd_return_buf(src, tmp, s_len);
/* /*
* Decompression shouldn't fail, because we've already verified * Decompression shouldn't fail, because we've already verified
@ -189,9 +185,9 @@ zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
*/ */
if (zio_decompress_fail_fraction != 0 && if (zio_decompress_fail_fraction != 0 &&
random_in_range(zio_decompress_fail_fraction) == 0) random_in_range(zio_decompress_fail_fraction) == 0)
ret = SET_ERROR(EINVAL); err = SET_ERROR(EINVAL);
return (ret); return (err);
} }
int int