X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=lib%2Fraid6%2Falgos.c;h=3068c2d6910ae6d895977f5626282b8554673f74;hb=ec424413171fd60a8b3cd14fad14a4d0fdb1490a;hp=7857049fd7d3660022e9372fdd5a11adc243099b;hpb=050aaeab99067b6a08b34274ff15ca5dbb94a160;p=mirror_ubuntu-artful-kernel.git diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index 7857049fd7d3..3068c2d6910a 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c @@ -156,6 +156,10 @@ static inline const struct raid6_calls *raid6_choose_gen( 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) */ + const unsigned long raid6_time_jiffies = + ((1 << RAID6_TIME_JIFFIES_LG2) * 181) >> 8; + if ((*algo)->valid && !(*algo)->valid()) continue; @@ -166,7 +170,7 @@ static inline const struct raid6_calls *raid6_choose_gen( while ((j1 = jiffies) == j0) cpu_relax(); while (time_before(jiffies, - j1 + (1<gen_syndrome(disks, PAGE_SIZE, *dptrs); perf++; } @@ -177,7 +181,8 @@ static inline const struct raid6_calls *raid6_choose_gen( best = *algo; } pr_info("raid6: %-8s gen() %5ld MB/s\n", (*algo)->name, - (perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); + (((perf*HZ) >> + (20-16+RAID6_TIME_JIFFIES_LG2)) * 1448) >> 10); if (!(*algo)->xor_syndrome) continue; @@ -189,7 +194,7 @@ static inline const struct raid6_calls *raid6_choose_gen( while ((j1 = jiffies) == j0) cpu_relax(); while (time_before(jiffies, - j1 + (1<xor_syndrome(disks, start, stop, PAGE_SIZE, *dptrs); perf++; @@ -200,17 +205,20 @@ static inline const struct raid6_calls *raid6_choose_gen( bestxorperf = perf; pr_info("raid6: %-8s xor() %5ld MB/s\n", (*algo)->name, - (perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2+1)); + (((perf*HZ) >> + (20-16+RAID6_TIME_JIFFIES_LG2+1)) * 1448) >> 10); } } if (best) { pr_info("raid6: using algorithm %s gen() %ld MB/s\n", best->name, - (bestgenperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); + (((bestgenperf*HZ) >> + (20-16+RAID6_TIME_JIFFIES_LG2)) * 1448) >> 10); if (best->xor_syndrome) pr_info("raid6: .... xor() %ld MB/s, rmw enabled\n", - (bestxorperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2+1)); + (((bestxorperf*HZ) >> + (20-16+RAID6_TIME_JIFFIES_LG2+1)) * 1448) >> 10); raid6_call = *best; } else pr_err("raid6: Yikes! No algorithm found!\n");