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

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