24 #include <linux/module.h>
26 #if !RAID6_USE_EMPTY_ZERO_PAGE
41 #if defined(__i386__) && !defined(__arch_um__)
49 #if defined(__x86_64__) && !defined(__arch_um__)
74 #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
82 #define RAID6_TIME_JIFFIES_LG2 4
85 #define RAID6_TIME_JIFFIES_LG2 9
86 #define time_before(x, y) ((x) < (y))
94 for (best =
NULL, algo = raid6_recov_algos; *algo; algo++)
96 if (!(*algo)->valid || (*algo)->valid())
103 printk(
"raid6: using %s recovery algorithm\n", best->
name);
105 printk(
"raid6: Yikes! No recovery algorithm found!\n");
110 static inline const struct raid6_calls *raid6_choose_gen(
111 void *(*
const dptrs)[(65536/
PAGE_SIZE)+2],
const int disks)
113 unsigned long perf, bestperf, j0, j1;
117 for (bestperf = 0, best =
NULL, algo = raid6_algos; *algo; algo++) {
119 if ((*algo)->valid && !(*algo)->valid())
126 while ((j1 = jiffies) == j0)
130 (*algo)->gen_syndrome(disks,
PAGE_SIZE, *dptrs);
135 if (perf > bestperf) {
139 printk(
"raid6: %-8s %5ld MB/s\n", (*algo)->name,
145 printk(
"raid6: using algorithm %s (%ld MB/s)\n",
150 printk(
"raid6: Yikes! No algorithm found!\n");
169 for (i = 0; i < disks-2; i++)
170 dptrs[i] = ((
char *)raid6_gfmul) +
PAGE_SIZE*i;
176 printk(
"raid6: Yikes! No memory available.\n");
180 dptrs[disks-2] = syndromes;
184 gen_best = raid6_choose_gen(&dptrs, disks);
187 rec_best = raid6_choose_recov();
191 return gen_best && rec_best ? 0 : -
EINVAL;
194 static void raid6_exit(
void)