mirror of https://github.com/digint/btrbk
btrbk: add support for zstd adaptive compression
Requires zstd version >= 1.3.6pull/409/head
parent
907a5065ab
commit
322ae2c78f
13
btrbk
13
btrbk
|
@ -54,7 +54,7 @@ my %compression = (
|
||||||
xz => { name => 'xz', format => 'xz', compress_cmd => [ 'xz', '-c' ], decompress_cmd => [ 'xz', '-d', '-c' ], level_min => 0, level_max => 9, threads => '-T' },
|
xz => { name => 'xz', format => 'xz', compress_cmd => [ 'xz', '-c' ], decompress_cmd => [ 'xz', '-d', '-c' ], level_min => 0, level_max => 9, threads => '-T' },
|
||||||
lzo => { name => 'lzo', format => 'lzo', compress_cmd => [ 'lzop', '-c' ], decompress_cmd => [ 'lzop', '-d', '-c' ], level_min => 1, level_max => 9 },
|
lzo => { name => 'lzo', format => 'lzo', compress_cmd => [ 'lzop', '-c' ], decompress_cmd => [ 'lzop', '-d', '-c' ], level_min => 1, level_max => 9 },
|
||||||
lz4 => { name => 'lz4', format => 'lz4', compress_cmd => [ 'lz4', '-c' ], decompress_cmd => [ 'lz4', '-d', '-c' ], level_min => 1, level_max => 9 },
|
lz4 => { name => 'lz4', format => 'lz4', compress_cmd => [ 'lz4', '-c' ], decompress_cmd => [ 'lz4', '-d', '-c' ], level_min => 1, level_max => 9 },
|
||||||
zstd => { name => 'zstd', format => 'zst', compress_cmd => [ 'zstd', '-c' ], decompress_cmd => [ 'zstd', '-d', '-c' ], level_min => 1, level_max => 19, threads => '-T', long => '--long=' },
|
zstd => { name => 'zstd', format => 'zst', compress_cmd => [ 'zstd', '-c' ], decompress_cmd => [ 'zstd', '-d', '-c' ], level_min => 1, level_max => 19, threads => '-T', long => '--long=', adapt => '--adapt' },
|
||||||
);
|
);
|
||||||
|
|
||||||
my $compress_format_alt = join '|', map { $_->{format} } values %compression; # note: this contains duplicate alternations
|
my $compress_format_alt = join '|', map { $_->{format} } values %compression; # note: this contains duplicate alternations
|
||||||
|
@ -110,6 +110,7 @@ my %config_options = (
|
||||||
stream_compress_level => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
stream_compress_level => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
||||||
stream_compress_long => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
stream_compress_long => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
||||||
stream_compress_threads => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
stream_compress_threads => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
||||||
|
stream_compress_adapt => { default => undef, accept => [ "yes", "no" ] },
|
||||||
|
|
||||||
raw_target_compress => { default => undef, accept => [ "no", (keys %compression) ] },
|
raw_target_compress => { default => undef, accept => [ "no", (keys %compression) ] },
|
||||||
raw_target_compress_level => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
raw_target_compress_level => { default => "default", accept => [ "default" ], accept_numeric => 1 },
|
||||||
|
@ -737,6 +738,15 @@ sub compress_cmd_text($;$)
|
||||||
WARN_ONCE "Long distance matching is not supported for '$cc->{name}', ignoring";
|
WARN_ONCE "Long distance matching is not supported for '$cc->{name}', ignoring";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(defined($def->{adapt})) {
|
||||||
|
my $adapt_opt = $cc->{adapt};
|
||||||
|
if($adapt_opt) {
|
||||||
|
push @cmd, $adapt_opt;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WARN_ONCE "Adaptive compression is not supported for '$cc->{name}', ignoring";
|
||||||
|
}
|
||||||
|
}
|
||||||
return { cmd_text => join(' ', @cmd) };
|
return { cmd_text => join(' ', @cmd) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3994,6 +4004,7 @@ sub config_compress_hash($$)
|
||||||
level => config_key($config, $config_key . "_level"),
|
level => config_key($config, $config_key . "_level"),
|
||||||
long => config_key($config, $config_key . "_long"),
|
long => config_key($config, $config_key . "_long"),
|
||||||
threads => config_key($config, $config_key . "_threads"),
|
threads => config_key($config, $config_key . "_threads"),
|
||||||
|
adapt => config_key($config, $config_key . "_adapt"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,10 @@ option in ssh_config(5).
|
||||||
Number of threads to use for <compress_command>. Only supported
|
Number of threads to use for <compress_command>. Only supported
|
||||||
for "pigz", "pbzip2", "zstd" and recent versions of "xz".
|
for "pigz", "pbzip2", "zstd" and recent versions of "xz".
|
||||||
|
|
||||||
|
*stream_compress_adapt* default|<number>::
|
||||||
|
Enable adaptive compression for <compress_command>. Only supported
|
||||||
|
for "zstd" (version >= 1.3.6).
|
||||||
|
|
||||||
*stream_buffer* <size>|no::
|
*stream_buffer* <size>|no::
|
||||||
Add a buffer to the btrfs send stream (locally, on uncompressed
|
Add a buffer to the btrfs send stream (locally, on uncompressed
|
||||||
data), with a maximum size of '<size>'. This can give a speed
|
data), with a maximum size of '<size>'. This can give a speed
|
||||||
|
|
Loading…
Reference in New Issue