compress: change compression providers API to use ABDs

This commit changes the provider compress and decompress API to take ABD
pointers instead of buffer pointers for both data source and
destination. It then updates all providers to match.

This doesn't actually change the providers to do chunked compression,
just changes the API to allow such an update in the future. Helper
macros are added to easily adapt the ABD functions to their buffer-based
implementations.

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-30 12:10:00 +10:00
committed by Tony Hutter
parent 522816498c
commit d3c12383c9
11 changed files with 120 additions and 54 deletions
+3 -3
View File
@@ -90,12 +90,12 @@ typedef struct zfs_zstd_meta {
int zstd_init(void);
void zstd_fini(void);
size_t zfs_zstd_compress(void *s_start, void *d_start, size_t s_len,
size_t zfs_zstd_compress(abd_t *src, abd_t *dst, size_t s_len,
size_t d_len, int level);
int zfs_zstd_get_level(void *s_start, size_t s_len, uint8_t *level);
int zfs_zstd_decompress_level(void *s_start, void *d_start, size_t s_len,
int zfs_zstd_decompress_level(abd_t *src, abd_t *dst, size_t s_len,
size_t d_len, uint8_t *level);
int zfs_zstd_decompress(void *s_start, void *d_start, size_t s_len,
int zfs_zstd_decompress(abd_t *src, abd_t *dst, size_t s_len,
size_t d_len, int n);
void zfs_zstd_cache_reap_now(void);