diff options
| -rw-r--r-- | include/linux/raid/pq.h | 1 | ||||
| -rw-r--r-- | lib/raid6/algos.c | 41 | ||||
| -rw-r--r-- | lib/raid6/altivec.uc | 1 | ||||
| -rw-r--r-- | lib/raid6/avx2.c | 3 | ||||
| -rw-r--r-- | lib/raid6/int.uc | 3 | ||||
| -rw-r--r-- | lib/raid6/mmx.c | 2 | ||||
| -rw-r--r-- | lib/raid6/neon.c | 1 | ||||
| -rw-r--r-- | lib/raid6/sse1.c | 2 | ||||
| -rw-r--r-- | lib/raid6/sse2.c | 3 | ||||
| -rw-r--r-- | lib/raid6/tilegx.uc | 1 |
10 files changed, 50 insertions, 8 deletions
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h index 73069cb6c54a..a7a06d1dcf9c 100644 --- a/include/linux/raid/pq.h +++ b/include/linux/raid/pq.h | |||
| @@ -72,6 +72,7 @@ extern const char raid6_empty_zero_page[PAGE_SIZE]; | |||
| 72 | /* Routine choices */ | 72 | /* Routine choices */ |
| 73 | struct raid6_calls { | 73 | struct raid6_calls { |
| 74 | void (*gen_syndrome)(int, size_t, void **); | 74 | void (*gen_syndrome)(int, size_t, void **); |
| 75 | void (*xor_syndrome)(int, int, int, size_t, void **); | ||
| 75 | int (*valid)(void); /* Returns 1 if this routine set is usable */ | 76 | int (*valid)(void); /* Returns 1 if this routine set is usable */ |
| 76 | const char *name; /* Name of this routine set */ | 77 | const char *name; /* Name of this routine set */ |
| 77 | int prefer; /* Has special performance attribute */ | 78 | int prefer; /* Has special performance attribute */ |
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index dbef2314901e..975c6e0434bd 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c | |||
| @@ -131,11 +131,12 @@ static inline const struct raid6_recov_calls *raid6_choose_recov(void) | |||
| 131 | static inline const struct raid6_calls *raid6_choose_gen( | 131 | static inline const struct raid6_calls *raid6_choose_gen( |
| 132 | void *(*const dptrs)[(65536/PAGE_SIZE)+2], const int disks) | 132 | void *(*const dptrs)[(65536/PAGE_SIZE)+2], const int disks) |
| 133 | { | 133 | { |
| 134 | unsigned long perf, bestperf, j0, j1; | 134 | unsigned long perf, bestgenperf, bestxorperf, j0, j1; |
| 135 | int start = (disks>>1)-1, stop = disks-3; /* work on the second half of the disks */ | ||
| 135 | const struct raid6_calls *const *algo; | 136 | const struct raid6_calls *const *algo; |
| 136 | const struct raid6_calls *best; | 137 | const struct raid6_calls *best; |
| 137 | 138 | ||
| 138 | for (bestperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) { | 139 | for (bestgenperf = 0, bestxorperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) { |
| 139 | if (!best || (*algo)->prefer >= best->prefer) { | 140 | if (!best || (*algo)->prefer >= best->prefer) { |
| 140 | if ((*algo)->valid && !(*algo)->valid()) | 141 | if ((*algo)->valid && !(*algo)->valid()) |
| 141 | continue; | 142 | continue; |
| @@ -153,19 +154,45 @@ static inline const struct raid6_calls *raid6_choose_gen( | |||
| 153 | } | 154 | } |
| 154 | preempt_enable(); | 155 | preempt_enable(); |
| 155 | 156 | ||
| 156 | if (perf > bestperf) { | 157 | if (perf > bestgenperf) { |
| 157 | bestperf = perf; | 158 | bestgenperf = perf; |
| 158 | best = *algo; | 159 | best = *algo; |
| 159 | } | 160 | } |
| 160 | pr_info("raid6: %-8s %5ld MB/s\n", (*algo)->name, | 161 | pr_info("raid6: %-8s gen() %5ld MB/s\n", (*algo)->name, |
| 161 | (perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); | 162 | (perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); |
| 163 | |||
| 164 | if (!(*algo)->xor_syndrome) | ||
| 165 | continue; | ||
| 166 | |||
| 167 | perf = 0; | ||
| 168 | |||
| 169 | preempt_disable(); | ||
| 170 | j0 = jiffies; | ||
| 171 | while ((j1 = jiffies) == j0) | ||
| 172 | cpu_relax(); | ||
| 173 | while (time_before(jiffies, | ||
| 174 | j1 + (1<<RAID6_TIME_JIFFIES_LG2))) { | ||
| 175 | (*algo)->xor_syndrome(disks, start, stop, | ||
| 176 | PAGE_SIZE, *dptrs); | ||
| 177 | perf++; | ||
| 178 | } | ||
| 179 | preempt_enable(); | ||
| 180 | |||
| 181 | if (best == *algo) | ||
| 182 | bestxorperf = perf; | ||
| 183 | |||
| 184 | pr_info("raid6: %-8s xor() %5ld MB/s\n", (*algo)->name, | ||
| 185 | (perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2+1)); | ||
| 162 | } | 186 | } |
| 163 | } | 187 | } |
| 164 | 188 | ||
| 165 | if (best) { | 189 | if (best) { |
| 166 | pr_info("raid6: using algorithm %s (%ld MB/s)\n", | 190 | pr_info("raid6: using algorithm %s gen() %ld MB/s\n", |
| 167 | best->name, | 191 | best->name, |
| 168 | (bestperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); | 192 | (bestgenperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2)); |
| 193 | if (best->xor_syndrome) | ||
| 194 | pr_info("raid6: .... xor() %ld MB/s, rmw enabled\n", | ||
| 195 | (bestxorperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2+1)); | ||
| 169 | raid6_call = *best; | 196 | raid6_call = *best; |
| 170 | } else | 197 | } else |
| 171 | pr_err("raid6: Yikes! No algorithm found!\n"); | 198 | pr_err("raid6: Yikes! No algorithm found!\n"); |
diff --git a/lib/raid6/altivec.uc b/lib/raid6/altivec.uc index 7cc12b532e95..bec27fce7501 100644 --- a/lib/raid6/altivec.uc +++ b/lib/raid6/altivec.uc | |||
| @@ -119,6 +119,7 @@ int raid6_have_altivec(void) | |||
| 119 | 119 | ||
| 120 | const struct raid6_calls raid6_altivec$# = { | 120 | const struct raid6_calls raid6_altivec$# = { |
| 121 | raid6_altivec$#_gen_syndrome, | 121 | raid6_altivec$#_gen_syndrome, |
| 122 | NULL, /* XOR not yet implemented */ | ||
| 122 | raid6_have_altivec, | 123 | raid6_have_altivec, |
| 123 | "altivecx$#", | 124 | "altivecx$#", |
| 124 | 0 | 125 | 0 |
diff --git a/lib/raid6/avx2.c b/lib/raid6/avx2.c index bc3b1dd436eb..76734004358d 100644 --- a/lib/raid6/avx2.c +++ b/lib/raid6/avx2.c | |||
| @@ -89,6 +89,7 @@ static void raid6_avx21_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 89 | 89 | ||
| 90 | const struct raid6_calls raid6_avx2x1 = { | 90 | const struct raid6_calls raid6_avx2x1 = { |
| 91 | raid6_avx21_gen_syndrome, | 91 | raid6_avx21_gen_syndrome, |
| 92 | NULL, /* XOR not yet implemented */ | ||
| 92 | raid6_have_avx2, | 93 | raid6_have_avx2, |
| 93 | "avx2x1", | 94 | "avx2x1", |
| 94 | 1 /* Has cache hints */ | 95 | 1 /* Has cache hints */ |
| @@ -150,6 +151,7 @@ static void raid6_avx22_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 150 | 151 | ||
| 151 | const struct raid6_calls raid6_avx2x2 = { | 152 | const struct raid6_calls raid6_avx2x2 = { |
| 152 | raid6_avx22_gen_syndrome, | 153 | raid6_avx22_gen_syndrome, |
| 154 | NULL, /* XOR not yet implemented */ | ||
| 153 | raid6_have_avx2, | 155 | raid6_have_avx2, |
| 154 | "avx2x2", | 156 | "avx2x2", |
| 155 | 1 /* Has cache hints */ | 157 | 1 /* Has cache hints */ |
| @@ -242,6 +244,7 @@ static void raid6_avx24_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 242 | 244 | ||
| 243 | const struct raid6_calls raid6_avx2x4 = { | 245 | const struct raid6_calls raid6_avx2x4 = { |
| 244 | raid6_avx24_gen_syndrome, | 246 | raid6_avx24_gen_syndrome, |
| 247 | NULL, /* XOR not yet implemented */ | ||
| 245 | raid6_have_avx2, | 248 | raid6_have_avx2, |
| 246 | "avx2x4", | 249 | "avx2x4", |
| 247 | 1 /* Has cache hints */ | 250 | 1 /* Has cache hints */ |
diff --git a/lib/raid6/int.uc b/lib/raid6/int.uc index 5b50f8dfc5d2..5ca60bee1388 100644 --- a/lib/raid6/int.uc +++ b/lib/raid6/int.uc | |||
| @@ -109,7 +109,8 @@ static void raid6_int$#_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 109 | 109 | ||
| 110 | const struct raid6_calls raid6_intx$# = { | 110 | const struct raid6_calls raid6_intx$# = { |
| 111 | raid6_int$#_gen_syndrome, | 111 | raid6_int$#_gen_syndrome, |
| 112 | NULL, /* always valid */ | 112 | NULL, /* XOR not yet implemented */ |
| 113 | NULL, /* always valid */ | ||
| 113 | "int" NSTRING "x$#", | 114 | "int" NSTRING "x$#", |
| 114 | 0 | 115 | 0 |
| 115 | }; | 116 | }; |
diff --git a/lib/raid6/mmx.c b/lib/raid6/mmx.c index 590c71c9e200..b3b0e1fcd3af 100644 --- a/lib/raid6/mmx.c +++ b/lib/raid6/mmx.c | |||
| @@ -76,6 +76,7 @@ static void raid6_mmx1_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 76 | 76 | ||
| 77 | const struct raid6_calls raid6_mmxx1 = { | 77 | const struct raid6_calls raid6_mmxx1 = { |
| 78 | raid6_mmx1_gen_syndrome, | 78 | raid6_mmx1_gen_syndrome, |
| 79 | NULL, /* XOR not yet implemented */ | ||
| 79 | raid6_have_mmx, | 80 | raid6_have_mmx, |
| 80 | "mmxx1", | 81 | "mmxx1", |
| 81 | 0 | 82 | 0 |
| @@ -134,6 +135,7 @@ static void raid6_mmx2_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 134 | 135 | ||
| 135 | const struct raid6_calls raid6_mmxx2 = { | 136 | const struct raid6_calls raid6_mmxx2 = { |
| 136 | raid6_mmx2_gen_syndrome, | 137 | raid6_mmx2_gen_syndrome, |
| 138 | NULL, /* XOR not yet implemented */ | ||
| 137 | raid6_have_mmx, | 139 | raid6_have_mmx, |
| 138 | "mmxx2", | 140 | "mmxx2", |
| 139 | 0 | 141 | 0 |
diff --git a/lib/raid6/neon.c b/lib/raid6/neon.c index 36ad4705df1a..d9ad6ee284f4 100644 --- a/lib/raid6/neon.c +++ b/lib/raid6/neon.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | } \ | 42 | } \ |
| 43 | struct raid6_calls const raid6_neonx ## _n = { \ | 43 | struct raid6_calls const raid6_neonx ## _n = { \ |
| 44 | raid6_neon ## _n ## _gen_syndrome, \ | 44 | raid6_neon ## _n ## _gen_syndrome, \ |
| 45 | NULL, /* XOR not yet implemented */ \ | ||
| 45 | raid6_have_neon, \ | 46 | raid6_have_neon, \ |
| 46 | "neonx" #_n, \ | 47 | "neonx" #_n, \ |
| 47 | 0 \ | 48 | 0 \ |
diff --git a/lib/raid6/sse1.c b/lib/raid6/sse1.c index f76297139445..9025b8ca9aa3 100644 --- a/lib/raid6/sse1.c +++ b/lib/raid6/sse1.c | |||
| @@ -92,6 +92,7 @@ static void raid6_sse11_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 92 | 92 | ||
| 93 | const struct raid6_calls raid6_sse1x1 = { | 93 | const struct raid6_calls raid6_sse1x1 = { |
| 94 | raid6_sse11_gen_syndrome, | 94 | raid6_sse11_gen_syndrome, |
| 95 | NULL, /* XOR not yet implemented */ | ||
| 95 | raid6_have_sse1_or_mmxext, | 96 | raid6_have_sse1_or_mmxext, |
| 96 | "sse1x1", | 97 | "sse1x1", |
| 97 | 1 /* Has cache hints */ | 98 | 1 /* Has cache hints */ |
| @@ -154,6 +155,7 @@ static void raid6_sse12_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
| 154 | 155 | ||
| 155 | const struct raid6_calls raid6_sse1x2 = { | 156 | const struct raid6_calls raid6_sse1x2 = { |
| 156 | raid6_sse12_gen_syndrome, | ||
