applied On Wed, Sep 13, 2017 at 11:10:57AM +0200, Thomas Lamprecht wrote: > A "sysconf(84)" is not really descripitve. There is no POSIX const > entry for _SC_NPROCESSORS_ONLN (number of processors online) as its > not standard but an adoption of glibc. > Better just use our proven ProcFSTool's cpuinfo method for getting > the desired information. > > This is kept only for backwards compatibillity as we guaranteed that > we use #cpus/2 if 'pigz' is set to 1, else I would have removed this > alltogether and just directly passed 'pigz' to the command... > > Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com> > --- > PVE/VZDump.pm | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm > index ef20e679..b7779de8 100644 > --- a/PVE/VZDump.pm > +++ b/PVE/VZDump.pm > @@ -7,7 +7,6 @@ use PVE::Exception qw(raise_param_exc); > use IO::File; > use IO::Select; > use IPC::Open3; > -use POSIX; > use File::Path; > use PVE::RPCEnvironment; > use PVE::Storage; > @@ -708,9 +707,11 @@ sub compressor_info { > return ('lzop', 'lzo'); > } elsif ($opt_compress eq 'gzip') { > if ($opts->{pigz} > 0) { > - # As default use int((#cores + 1)/2), we need #cores+1 for the case > that #cores = 1 > - my $cores = POSIX::sysconf(84); > - my $pigz_threads = ($opts->{pigz} > 1) ? $opts->{pigz} : > int(($cores + 1)/2); > + my $pigz_threads = $opts->{pigz}; > + if ($pigz_threads == 1) { > + my $cpuinfo = PVE::ProcFSTools::read_cpuinfo(); > + $pigz_threads = int(($cpuinfo->{cpus} + 1)/2); > + } > return ("pigz -p ${pigz_threads}", 'gz'); > } else { > return ('gzip', 'gz'); > -- > 2.11.0
_______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel