compress: change zio_compress API to use ABDs

This commit changes the frontend zio_compress_data and
zio_decompress_data APIs to take ABD points instead of buffer pointers.

All callers are updated to match. Any that already have an appropriate
ABD nearby now use it directly, while at the rest we create an one.

Internally, the ABDs are passed through to the provider directly.

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-07-04 14:48:38 +10:00
committed by Tony Hutter
parent d3c12383c9
commit f62e6e1f98
10 changed files with 116 additions and 112 deletions
+4 -2
View File
@@ -569,9 +569,11 @@ zfs_zstd_compress_buf(void *s_start, void *d_start, size_t s_len, size_t d_len,
if (zstd_earlyabort_pass > 0 && zstd_level >= zstd_cutoff_level &&
s_len >= actual_abort_size) {
int pass_len = 1;
abd_t sabd;
abd_t sabd, dabd;
abd_get_from_buf_struct(&sabd, s_start, s_len);
pass_len = zfs_lz4_compress(&sabd, d_start, s_len, d_len, 0);
abd_get_from_buf_struct(&dabd, d_start, d_len);
pass_len = zfs_lz4_compress(&sabd, &dabd, s_len, d_len, 0);
abd_free(&dabd);
abd_free(&sabd);
if (pass_len < d_len) {
ZSTDSTAT_BUMP(zstd_stat_lz4pass_allowed);