zstd has better compression ratio and time consumption balance than zlib/lzo/snappy. When no customized compression method is specified in kdump.conf, we will use zstd as the default compression method for initrd.
Signed-off-by: Tao Liu ltao@redhat.com --- kdump-lib.sh | 7 +++++++ mkdumprd | 4 ++++ mkfadumprd | 4 ++++ 3 files changed, 15 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index e435498..82c2616 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -443,6 +443,13 @@ is_wdt_active() return 1 }
+have_compression_in_dracut_args() +{ + grep -q "^dracut_args .*-- + (gzip|bzip2|lzma|xz|lzo|lz4|zstd|compress|no-compress) + ([[:space:]]|$)" /etc/kdump.conf +} + # If "dracut_args" contains "--mount" information, use it # directly without any check(users are expected to ensure # its correctness). diff --git a/mkdumprd b/mkdumprd index d87d588..9c26ecc 100644 --- a/mkdumprd +++ b/mkdumprd @@ -431,6 +431,10 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
+if ! have_compression_in_dracut_args; then + add_dracut_arg "--compress" "zstd" +fi + if [[ -n $extra_modules ]]; then add_dracut_arg "--add-drivers" "$extra_modules" fi diff --git a/mkfadumprd b/mkfadumprd index b890f83..16fdacc 100644 --- a/mkfadumprd +++ b/mkfadumprd @@ -62,6 +62,10 @@ if is_squash_available; then _dracut_isolate_args+=(--add squash) fi
+if ! have_compression_in_dracut_args; then + _dracut_isolate_args+=(--compress zstd) +fi + if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability" fi
Tao Liu ltao@redhat.com 于2021年12月20日周一 21:26写道:
zstd has better compression ratio and time consumption balance than zlib/lzo/snappy. When no customized compression method is specified in kdump.conf, we will use zstd as the default compression method for initrd.
Signed-off-by: Tao Liu ltao@redhat.com
kdump-lib.sh | 7 +++++++ mkdumprd | 4 ++++ mkfadumprd | 4 ++++ 3 files changed, 15 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index e435498..82c2616 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -443,6 +443,13 @@ is_wdt_active() return 1 }
+have_compression_in_dracut_args() +{
- grep -q "^dracut_args .*--
\(gzip\|bzip2\|lzma\|xz\|lzo\|lz4\|zstd\|compress\|no-compress\)
\([[:space:]]\|$\)" /etc/kdump.conf
+}
Hi Tao,
This looks a bit fragile, maybe you can have a look at the kdump_get_conf_val helper which was introduced to parse the config file.
# If "dracut_args" contains "--mount" information, use it # directly without any check(users are expected to ensure # its correctness). diff --git a/mkdumprd b/mkdumprd index d87d588..9c26ecc 100644 --- a/mkdumprd +++ b/mkdumprd @@ -431,6 +431,10 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
+if ! have_compression_in_dracut_args; then
add_dracut_arg "--compress" "zstd"
+fi
if [[ -n $extra_modules ]]; then add_dracut_arg "--add-drivers" "$extra_modules" fi diff --git a/mkfadumprd b/mkfadumprd index b890f83..16fdacc 100644 --- a/mkfadumprd +++ b/mkfadumprd @@ -62,6 +62,10 @@ if is_squash_available; then _dracut_isolate_args+=(--add squash) fi
+if ! have_compression_in_dracut_args; then
_dracut_isolate_args+=(--compress zstd)
+fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability" fi -- 2.33.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Hi Kairui,
Nice to hear from you again, thanks for reviewing the patch!
On Mon, Dec 20, 2021 at 11:26 PM Kairui Song ryncsn@gmail.com wrote:
Tao Liu ltao@redhat.com 于2021年12月20日周一 21:26写道:
zstd has better compression ratio and time consumption balance than zlib/lzo/snappy. When no customized compression method is specified in kdump.conf, we will use zstd as the default compression method for initrd.
Signed-off-by: Tao Liu ltao@redhat.com
kdump-lib.sh | 7 +++++++ mkdumprd | 4 ++++ mkfadumprd | 4 ++++ 3 files changed, 15 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index e435498..82c2616 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -443,6 +443,13 @@ is_wdt_active() return 1 }
+have_compression_in_dracut_args() +{
- grep -q "^dracut_args .*--
\(gzip\|bzip2\|lzma\|xz\|lzo\|lz4\|zstd\|compress\|no-compress\)
\([[:space:]]\|$\)" /etc/kdump.conf
+}
Hi Tao,
This looks a bit fragile, maybe you can have a look at the kdump_get_conf_val helper which was introduced to parse the config file.
Thanks for pointing it out, I'v submitted v2 patch based on kdump_get_conf_val helper.
Thanks, Tao Liu
# If "dracut_args" contains "--mount" information, use it # directly without any check(users are expected to ensure # its correctness). diff --git a/mkdumprd b/mkdumprd index d87d588..9c26ecc 100644 --- a/mkdumprd +++ b/mkdumprd @@ -431,6 +431,10 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
+if ! have_compression_in_dracut_args; then
add_dracut_arg "--compress" "zstd"
+fi
if [[ -n $extra_modules ]]; then add_dracut_arg "--add-drivers" "$extra_modules" fi diff --git a/mkfadumprd b/mkfadumprd index b890f83..16fdacc 100644 --- a/mkfadumprd +++ b/mkfadumprd @@ -62,6 +62,10 @@ if is_squash_available; then _dracut_isolate_args+=(--add squash) fi
+if ! have_compression_in_dracut_args; then
_dracut_isolate_args+=(--compress zstd)
+fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability" fi -- 2.33.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure