kernel/parallel_xz.sh
Justin M. Forbes 9a733b7fc9 kernel-5.10.0-0.rc4.20201119gitc2e7554e1b85.80
* Thu Nov 19 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.10.0-0.rc4.20201119gitc2e7554e1b85.80]
- No need to review, Temporary workarounds due to DEBUG_INFO_BTF not working ("Justin M. Forbes")
Resolves: rhbz#

Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-11-19 09:51:09 -06:00

32 lines
827 B
Bash
Executable File

#!/bin/sh
# Reads filenames on stdin, xz-compresses each in place.
# Not optimal for "compress relatively few, large files" scenario!
# How many xz's to run in parallel:
procgroup=""
while test "$#" != 0; do
# Get it from -jNUM
N="${1#-j}"
if test "$N" = "$1"; then
# Not -j<something> - warn and ignore
echo "parallel_xz: warning: unrecognized argument: '$1'"
else
procgroup="$N"
fi
shift
done
#This seems to cause problems with large numbers
if (( $procgroup > 4 )); then
procgroup=4
fi
# If told to use only one cpu:
test "$procgroup" || exec xargs -r xz
test "$procgroup" = 1 && exec xargs -r xz
# xz has some startup cost. If files are really small,
# this cost might be significant. To combat this,
# process several files (in sequence) by each xz process via -n 16:
exec xargs -r -n 16 -P $procgroup xz