Skip to content

Commit

Permalink
compress: remove zio_decompress_data_buf
Browse files Browse the repository at this point in the history
Nothing uses it anymore!

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <[email protected]>
  • Loading branch information
robn authored and tonyhutter committed Aug 22, 2024
1 parent b4d81b1 commit e119483
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 0 additions & 2 deletions include/sys/zio_compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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);
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);

#ifdef __cplusplus
Expand Down
24 changes: 10 additions & 14 deletions module/zfs/zio_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,22 @@ zio_compress_data(enum zio_compress c, abd_t *src, void **dst, size_t s_len,
}

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)
{
zio_compress_info_t *ci = &zio_compress_table[c];
if ((uint_t)c >= ZIO_COMPRESS_FUNCTIONS || ci->ci_decompress == NULL)
return (SET_ERROR(EINVAL));

if (ci->ci_decompress_level != NULL && level != NULL)
return (ci->ci_decompress_level(src, dst, s_len, d_len, level));
void *sbuf = abd_borrow_buf_copy(src, s_len);

return (ci->ci_decompress(src, dst, s_len, d_len, ci->ci_level));
}
int err;
if (ci->ci_decompress_level != NULL && level != NULL)
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);

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);
abd_return_buf(src, sbuf, s_len);

/*
* Decompression shouldn't fail, because we've already verified
Expand All @@ -189,9 +185,9 @@ zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
*/
if (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
Expand Down

0 comments on commit e119483

Please sign in to comment.