diff options
Diffstat (limited to 'raid6-default-algo.patch')
-rw-r--r-- | raid6-default-algo.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/raid6-default-algo.patch b/raid6-default-algo.patch new file mode 100644 index 0000000..98bfd54 --- /dev/null +++ b/raid6-default-algo.patch @@ -0,0 +1,70 @@ +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -10,6 +10,23 @@ menu "Library routines" + config RAID6_PQ + tristate + ++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 BITREVERSE + tristate + +diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c +index d3b16f43c39f..480cbfbe293f 100644 +--- a/lib/raid6/algos.c ++++ b/lib/raid6/algos.c +@@ -30,6 +30,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); + +@@ -157,6 +163,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) */ |