From 0c3e7682ba04e94c32ca5b8ade98d33324e78d1d Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 17 Nov 2020 18:28:58 +0100 Subject: [PATCH] marsadm: automatic systemd parallelization --- userspace/marsadm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/userspace/marsadm b/userspace/marsadm index 21894c6c..8b33b3f0 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -31,7 +31,7 @@ umask 0077; # global defaults -my $parallel = -1; +my $parallel = -999; my $single_step = 0; my $inject_phase = 0; my $compat_deletions = 1; @@ -9855,6 +9855,24 @@ sub expand_res_list { } elsif ($res =~ m/,/) { @res_list = split(",", $res); } + # check for any systemd activations once + if ($parallel <= -999) { + $parallel = -998; + my $count = scalar(@res_list); + if ($count > 1) { + my $systemd_activated = 0; + foreach my $this_res (@res_list) { + if (systemd_present($cmd, $this_res)) { + $systemd_activated++; + last; + } + } + if ($systemd_activated) { + lprint "Systemd is activated, acting like --parallel=0\n" if $verbose; + $parallel = 0; + } + } + } return sort alphanum_cmp @res_list; }