From 391fe055c943e33e9c191dbeeb21995c0d54ccd9 Mon Sep 17 00:00:00 2001 From: Sentry Date: Tue, 14 Jul 2020 15:58:43 +0200 Subject: kernel 5.7.8 --- SOURCES/parallel_xz.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 SOURCES/parallel_xz.sh (limited to 'SOURCES/parallel_xz.sh') diff --git a/SOURCES/parallel_xz.sh b/SOURCES/parallel_xz.sh new file mode 100755 index 0000000..bc08a54 --- /dev/null +++ b/SOURCES/parallel_xz.sh @@ -0,0 +1,26 @@ +#!/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 - warn and ignore + echo "parallel_xz: warning: unrecognized argument: '$1'" + else + procgroup="$N" + fi + shift +done + +# 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 -- cgit v1.2.3