This commit is contained in:
Orsiris de Jong 2025-06-16 22:39:22 -05:00 committed by GitHub
commit 86010c1773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 10 deletions

29
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 for system responsiveness
my $ncpus = int(`nproc`);
if ($ncpus > 2) { $ncpus -= 2;}
# Blank defaults to use ssh client's default
# TODO: Merge into a single "sshflags" option?
@ -1141,10 +1144,16 @@ 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",
},
'zstd-medium' => {
rawcmd => 'zstd',
args => "-T$ncpus -8",
decomrawcmd => 'zstd',
decomargs => "-T$ncpus -dc",
},
'zstdmt-fast' => {
rawcmd => 'zstdmt',
@ -1153,10 +1162,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',
@ -1186,7 +1195,7 @@ sub compressargset {
if ($value eq 'default') {
$value = $DEFAULT_COMPRESSION;
} elsif (!(grep $value eq $_, ('gzip', 'pigz-fast', 'pigz-slow', 'zstd-fast', 'zstdmt-fast', 'zstd-slow', 'zstdmt-slow', 'lz4', 'xz', 'lzo', 'default', 'none'))) {
} elsif (!(grep $value eq $_, ('gzip', 'pigz-fast', 'pigz-slow', 'zstd-fast', 'zstd-medium', 'zstdmt-fast', 'zstd-slow', 'zstdmt-slow', 'lz4', 'xz', 'lzo', 'default', 'none'))) {
writelog('WARN', "Unrecognised compression value $value, defaulting to $DEFAULT_COMPRESSION");
$value = $DEFAULT_COMPRESSION;
}
@ -2400,7 +2409,7 @@ syncoid - ZFS snapshot replication tool
Options:
--compress=FORMAT Compresses data during transfer. Currently accepted options are gzip, pigz-fast, pigz-slow, zstd-fast, zstdmt-fast, zstd-slow, zstdmt-slow, lz4, xz, lzo (default) & none
--compress=FORMAT Compresses data during transfer. Currently accepted options are gzip, pigz-fast, pigz-slow, zstd-fast, zstd-medium, zstdmt-fast, zstd-slow, zstdmt-slow, lz4, xz, lzo (default) & none
--identifier=EXTRA Extra identifier which is included in the snapshot name. Can be used for replicating to multiple targets.
--recursive|r Also transfers child datasets
--skip-parent Skips syncing of the parent dataset. Does nothing without '--recursive' option.