util-linux/0052-zramctl-add-hint-about-supported-algorithms.patch

61 lines
2.9 KiB
Diff
Raw Normal View History

From c16421a093d2b6678f6c66eefaac75b67c6a423e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 9 Aug 2023 13:39:32 +0200
Subject: zramctl: add hint about supported algorithms
It seems the current list of the algorithms is confusing for
end-users, because it's inaccurate in many cases. Let's explain why
the list cannot be "perfect".
Upstream: http://github.com/util-linux/util-linux/commit/2d7549b79f2b32f33cec3a5b518cddfe9a63506b
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2203324
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/zramctl.8.adoc | 4 +++-
sys-utils/zramctl.c | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sys-utils/zramctl.8.adoc b/sys-utils/zramctl.8.adoc
index 7b684ed44..ff83b6ec9 100644
--- a/sys-utils/zramctl.8.adoc
+++ b/sys-utils/zramctl.8.adoc
@@ -38,8 +38,10 @@ Note that _zramdev_ node specified on command line has to already exist. The com
== OPTIONS
-*-a*, **--algorithm lzo**|**lz4**|**lz4hc**|**deflate**|*842*::
+*-a*, **--algorithm lzo**|**lz4**|**lz4hc**|**deflate**|**842**|**zstd**::
Set the compression algorithm to be used for compressing data in the zram device.
++
+The *list of supported algorithms could be inaccurate* as it depends on the current kernel configuration. A basic overview can be obtained by using the command "cat /sys/block/zram0/comp_algorithm"; however, please note that this list might also be incomplete. This is due to the fact that ZRAM utilizes the Crypto API, and if certain algorithms were built as modules, it becomes impossible to enumerate all of them.
*-f*, *--find*::
Find the first unused zram device. If a *--size* argument is present, then initialize the device.
diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c
index 64d5fcd81..a84ce665b 100644
--- a/sys-utils/zramctl.c
+++ b/sys-utils/zramctl.c
@@ -547,7 +547,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_("Set up and control zram devices.\n"), out);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -a, --algorithm lzo|lz4|lz4hc|deflate|842 compression algorithm to use\n"), out);
+ fputs(_(" -a, --algorithm <alg> compression algorithm to use\n"), out);
fputs(_(" -b, --bytes print sizes in bytes rather than in human readable format\n"), out);
fputs(_(" -f, --find find a free device\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
@@ -564,6 +564,10 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_ARGUMENTS, out);
printf(USAGE_ARG_SIZE(_("<size>")));
+ fputs(_(" <alg> specify algorithm, supported are:\n"), out);
+ fputs(_(" lzo, lz4, lz4hc, deflate, 842 and zstd\n"), out);
+ fputs(_(" (List may be inaccurate, consult man page.)\n"), out);
+
fputs(USAGE_COLUMNS, out);
for (i = 0; i < ARRAY_SIZE(infos); i++)
fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
--
2.40.1