Allow threaded zstd usage

This commit is contained in:
Orsiris de Jong 2025-04-29 15:16:57 +02:00 committed by GitHub
parent 6beef5fee6
commit d3ad1caa15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 8 deletions

19
syncoid
View File

@ -17,6 +17,9 @@ use Capture::Tiny ':all';
my $mbuffer_size = "16M";
my $pvoptions = "-p -t -e -r -b";
# Get number of CPUs for zstd threading, but leave at least two cores empty
my $ncpus = int(`nproc`);
if ($ncpus > 2) { $ncpus -= 2;}
# Blank defaults to use ssh client's default
# TODO: Merge into a single "sshflags" option?
@ -1142,10 +1145,10 @@ sub compressargset {
decomargs => '-dc',
},
'zstd-fast' => {
rawcmd => 'zstd',
args => '-3',
decomrawcmd => 'zstd',
decomargs => '-dc',
rawcmd => 'zstd',
args => "-T$ncpus -3",
decomrawcmd => 'zstd',
decomargs => "-T$ncpus -dc",
},
'zstdmt-fast' => {
rawcmd => 'zstdmt',
@ -1154,10 +1157,10 @@ sub compressargset {
decomargs => '-dc',
},
'zstd-slow' => {
rawcmd => 'zstd',
args => '-19',
decomrawcmd => 'zstd',
decomargs => '-dc',
rawcmd => 'zstd',
args => "-T$ncpus -19",
decomrawcmd => 'zstd',
decomargs => "-T$ncpus -dc",
},
'zstdmt-slow' => {
rawcmd => 'zstdmt',