@@ -19,6 +19,23 @@ config RAID6_PQ_BENCHMARK
Benchmark all available RAID6 PQ functions on init and choose the
fastest one.
+config RAID6_PQ_DEFAULT_ALG_BOOL
+ bool "Default RAID6 PQ algorithm"
+ default n
+ depends on RAID6_PQ
+ help
+ Allow for specifying a default algorithm via the kernel
+ parameter "raid6_pq_default_alg", which forces the performance
+ tests to be skipped. This can save between 500ms to 2s
+ during boot.
+
+config RAID6_PQ_DEFAULT_ALG
+ string "Default RAID6 PQ algorithm name"
+ default ""
+ depends on RAID6_PQ_DEFAULT_ALG_BOOL
+ help
+ The default algorithm name to be used by default.
+
config PACKING
bool "Generic bitfield packing and unpacking"
default n
@@ -25,6 +25,12 @@ EXPORT_SYMBOL(raid6_empty_zero_page);
#endif
#endif
+#ifdef CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL
+static char raid6_pq_default_alg[32] = CONFIG_RAID6_PQ_DEFAULT_ALG;
+module_param_string(raid6_pq_default_alg, raid6_pq_default_alg, sizeof(raid6_pq_default_alg), 0444);
+MODULE_PARM_DESC(raid6_pq_default_alg, "Default gen/xor() algorithm");
+#endif
+
struct raid6_calls raid6_call;
EXPORT_SYMBOL_GPL(raid6_call);
@@ -153,6 +159,26 @@ static inline const struct raid6_calls *raid6_choose_gen(
const struct raid6_calls *const *algo;
const struct raid6_calls *best;
+#ifdef CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL
+ if (strlen(raid6_pq_default_alg)) {
+ for (algo = raid6_algos; *algo; algo++) {
+ if (!strncmp(raid6_pq_default_alg, (*algo)->name, sizeof(raid6_pq_default_alg))) {
+ if ((*algo)->valid && !(*algo)->valid()) {
+ pr_info("raid6: default alg \"%s\" is invalid.\n",
+ raid6_pq_default_alg);
+ continue;
+ }
+ pr_info("raid6: using default algorithm %s gen() without performace tests.\n",
+ (*algo)->name);
+ raid6_call = **algo;
+ return *algo;
+ }
+ }
+ pr_info("raid6: default alg \"%s\" not found. Choosing the best alg as fallback...\n",
+ raid6_pq_default_alg);
+ }
+#endif
+
for (bestgenperf = 0, bestxorperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) {
if (!best || (*algo)->prefer >= best->prefer) {
/* 2 ^ (RAID6_TIME_JIFFIES_LG2 - 0.5) */
BugLink: https://bugs.launchpad.net/bugs/1812728 BugLink: https://bugs.launchpad.net/bugs/1851538 Add a new config ("CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL") to enable specifying a default gen() algorithm for RAID_PQ via the kernel "raid6_pq_default_alg" cmdline option. When a default algorithm is given, the raid6_pq module will skip the performance round of tests. The config CONFIG_RAID6_PQ_DEFAULT_ALG can be used to define a default value for the kernel option. Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com> --- lib/Kconfig | 17 +++++++++++++++++ lib/raid6/algos.c | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)