Blame SOURCES/0055-Run-xz-and-lzma-with-multiple-threads.patch

712866
From 90441c4476481e4e05edacf44903aeac2feecd6d Mon Sep 17 00:00:00 2001
712866
From: Vratislav Podzimek <vpodzime@redhat.com>
712866
Date: Wed, 13 Nov 2013 13:20:39 +0100
712866
Subject: [PATCH] Run 'xz' and 'lzma' with multiple threads
712866
712866
This speeds up compression a lot on multicore systems.
712866
712866
https://bugzilla.redhat.com/show_bug.cgi?id=1029786
712866
712866
[Edited-by: Harald Hoyer: use getconf for cpu_count]
712866
---
712866
 dracut.sh | 6 ++++--
712866
 1 file changed, 4 insertions(+), 2 deletions(-)
712866
712866
diff --git a/dracut.sh b/dracut.sh
5c6c2a
index b03522bf..59d3e4b2 100755
712866
--- a/dracut.sh
712866
+++ b/dracut.sh
712866
@@ -693,12 +693,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
712866
 # eliminate IFS hackery when messing with fw_dir
712866
 fw_dir=${fw_dir//:/ }
712866
 
712866
+cpu_count=$(getconf _NPROCESSORS_ONLN)
712866
+
712866
 # handle compression options.
712866
 [[ $compress ]] || compress="gzip"
712866
 case $compress in
712866
     bzip2) compress="bzip2 -9";;
712866
-    lzma)  compress="lzma -9";;
712866
-    xz)    compress="xz --check=crc32 --lzma2=dict=1MiB";;
712866
+    lzma)  compress="lzma -9 ${cpu_count:+-T$cpu_count}";;
712866
+    xz)    compress="xz --check=crc32 --lzma2=dict=1MiB ${cpu_count:+-T$cpu_count}";;
712866
     gzip)  compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
712866
     lzo)   compress="lzop -9";;
712866
     lz4)   compress="lz4 -9";;