aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/Kconfig4
-rw-r--r--drivers/md/Makefile4
-rw-r--r--drivers/md/mktables.c14
-rw-r--r--drivers/md/raid5.c12
-rw-r--r--drivers/md/raid5.h2
-rw-r--r--drivers/md/raid6algos.c19
-rw-r--r--drivers/md/raid6altivec.uc2
-rw-r--r--drivers/md/raid6int.uc2
-rw-r--r--drivers/md/raid6mmx.c2
-rw-r--r--drivers/md/raid6recov.c11
-rw-r--r--drivers/md/raid6sse1.c2
-rw-r--r--drivers/md/raid6sse2.c2
-rw-r--r--drivers/md/raid6test/Makefile2
-rw-r--r--drivers/md/raid6test/test.c2
-rw-r--r--include/linux/raid/pq.h (renamed from drivers/md/raid6.h)20
15 files changed, 66 insertions, 34 deletions
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 2281b5098e95..449d0b9cac14 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -121,6 +121,7 @@ config MD_RAID10
121config MD_RAID456 121config MD_RAID456
122 tristate "RAID-4/RAID-5/RAID-6 mode" 122 tristate "RAID-4/RAID-5/RAID-6 mode"
123 depends on BLK_DEV_MD 123 depends on BLK_DEV_MD
124 select MD_RAID6_PQ
124 select ASYNC_MEMCPY 125 select ASYNC_MEMCPY
125 select ASYNC_XOR 126 select ASYNC_XOR
126 ---help--- 127 ---help---
@@ -180,6 +181,9 @@ config MD_RAID5_RESHAPE
180 181
181 If unsure, say Y. 182 If unsure, say Y.
182 183
184config MD_RAID6_PQ
185 tristate
186
183config MD_MULTIPATH 187config MD_MULTIPATH
184 tristate "Multipath I/O support" 188 tristate "Multipath I/O support"
185 depends on BLK_DEV_MD 189 depends on BLK_DEV_MD
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index 3b118da575ee..45cc5951d928 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -9,7 +9,8 @@ dm-snapshot-y += dm-snap.o dm-exception-store.o dm-snap-transient.o \
9 dm-snap-persistent.o 9 dm-snap-persistent.o
10dm-mirror-y += dm-raid1.o 10dm-mirror-y += dm-raid1.o
11md-mod-y += md.o bitmap.o 11md-mod-y += md.o bitmap.o
12raid456-y += raid5.o raid6algos.o raid6recov.o raid6tables.o \ 12raid456-y += raid5.o
13raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \
13 raid6int1.o raid6int2.o raid6int4.o \ 14 raid6int1.o raid6int2.o raid6int4.o \
14 raid6int8.o raid6int16.o raid6int32.o \ 15 raid6int8.o raid6int16.o raid6int32.o \
15 raid6altivec1.o raid6altivec2.o raid6altivec4.o \ 16 raid6altivec1.o raid6altivec2.o raid6altivec4.o \
@@ -26,6 +27,7 @@ obj-$(CONFIG_MD_LINEAR) += linear.o
26obj-$(CONFIG_MD_RAID0) += raid0.o 27obj-$(CONFIG_MD_RAID0) += raid0.o
27obj-$(CONFIG_MD_RAID1) += raid1.o 28obj-$(CONFIG_MD_RAID1) += raid1.o
28obj-$(CONFIG_MD_RAID10) += raid10.o 29obj-$(CONFIG_MD_RAID10) += raid10.o
30obj-$(CONFIG_MD_RAID6_PQ) += raid6_pq.o
29obj-$(CONFIG_MD_RAID456) += raid456.o 31obj-$(CONFIG_MD_RAID456) += raid456.o
30obj-$(CONFIG_MD_MULTIPATH) += multipath.o 32obj-$(CONFIG_MD_MULTIPATH) += multipath.o
31obj-$(CONFIG_MD_FAULTY) += faulty.o 33obj-$(CONFIG_MD_FAULTY) += faulty.o
diff --git a/drivers/md/mktables.c b/drivers/md/mktables.c
index b61d5767aae7..3b1500843bba 100644
--- a/drivers/md/mktables.c
+++ b/drivers/md/mktables.c
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
59 uint8_t v; 59 uint8_t v;
60 uint8_t exptbl[256], invtbl[256]; 60 uint8_t exptbl[256], invtbl[256];
61 61
62 printf("#include \"raid6.h\"\n"); 62 printf("#include <linux/raid/pq.h>\n");
63 63
64 /* Compute multiplication table */ 64 /* Compute multiplication table */
65 printf("\nconst u8 __attribute__((aligned(256)))\n" 65 printf("\nconst u8 __attribute__((aligned(256)))\n"
@@ -76,6 +76,9 @@ int main(int argc, char *argv[])
76 printf("\t},\n"); 76 printf("\t},\n");
77 } 77 }
78 printf("};\n"); 78 printf("};\n");
79 printf("#ifdef __KERNEL__\n");
80 printf("EXPORT_SYMBOL(raid6_gfmul);\n");
81 printf("#endif\n");
79 82
80 /* Compute power-of-2 table (exponent) */ 83 /* Compute power-of-2 table (exponent) */
81 v = 1; 84 v = 1;
@@ -92,6 +95,9 @@ int main(int argc, char *argv[])
92 } 95 }
93 } 96 }
94 printf("};\n"); 97 printf("};\n");
98 printf("#ifdef __KERNEL__\n");
99 printf("EXPORT_SYMBOL(raid6_gfexp);\n");
100 printf("#endif\n");
95 101
96 /* Compute inverse table x^-1 == x^254 */ 102 /* Compute inverse table x^-1 == x^254 */
97 printf("\nconst u8 __attribute__((aligned(256)))\n" 103 printf("\nconst u8 __attribute__((aligned(256)))\n"
@@ -104,6 +110,9 @@ int main(int argc, char *argv[])
104 } 110 }
105 } 111 }
106 printf("};\n"); 112 printf("};\n");
113 printf("#ifdef __KERNEL__\n");
114 printf("EXPORT_SYMBOL(raid6_gfinv);\n");
115 printf("#endif\n");
107 116
108 /* Compute inv(2^x + 1) (exponent-xor-inverse) table */ 117 /* Compute inv(2^x + 1) (exponent-xor-inverse) table */
109 printf("\nconst u8 __attribute__((aligned(256)))\n" 118 printf("\nconst u8 __attribute__((aligned(256)))\n"
@@ -115,6 +124,9 @@ int main(int argc, char *argv[])
115 (j == 7) ? '\n' : ' '); 124 (j == 7) ? '\n' : ' ');
116 } 125 }
117 printf("};\n"); 126 printf("};\n");
127 printf("#ifdef __KERNEL__\n");
128 printf("EXPORT_SYMBOL(raid6_gfexi);\n");
129 printf("#endif\n");
118 130
119 return 0; 131 return 0;
120} 132}
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e1ee181b79bb..1f1b054ff0b6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -45,11 +45,11 @@
45 45
46#include <linux/blkdev.h> 46#include <linux/blkdev.h>
47#include <linux/kthread.h> 47#include <linux/kthread.h>
48#include <linux/raid/pq.h>
48#include <linux/async_tx.h> 49#include <linux/async_tx.h>
49#include <linux/seq_file.h> 50#include <linux/seq_file.h>
50#include "md.h" 51#include "md.h"
51#include "raid5.h" 52#include "raid5.h"
52#include "raid6.h"
53#include "bitmap.h" 53#include "bitmap.h"
54 54
55/* 55/*
@@ -94,11 +94,6 @@
94 94
95#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args))) 95#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
96 96
97#if !RAID6_USE_EMPTY_ZERO_PAGE
98/* In .bss so it's zeroed */
99const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
100#endif
101
102/* 97/*
103 * We maintain a biased count of active stripes in the bottom 16 bits of 98 * We maintain a biased count of active stripes in the bottom 16 bits of
104 * bi_phys_segments, and a count of processed stripes in the upper 16 bits 99 * bi_phys_segments, and a count of processed stripes in the upper 16 bits
@@ -5153,11 +5148,6 @@ static struct mdk_personality raid4_personality =
5153 5148
5154static int __init raid5_init(void) 5149static int __init raid5_init(void)
5155{ 5150{
5156 int e;
5157
5158 e = raid6_select_algo();
5159 if ( e )
5160 return e;
5161 register_md_personality(&raid6_personality); 5151 register_md_personality(&raid6_personality);
5162 register_md_personality(&raid5_personality); 5152 register_md_personality(&raid5_personality);
5163 register_md_personality(&raid4_personality); 5153 register_md_personality(&raid4_personality);
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index c172371481c7..2934ee0a39c6 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -269,6 +269,8 @@ struct r6_state {
269#define READ_MODIFY_WRITE 2 269#define READ_MODIFY_WRITE 2
270/* not a write method, but a compute_parity mode */ 270/* not a write method, but a compute_parity mode */
271#define CHECK_PARITY 3 271#define CHECK_PARITY 3
272/* Additional compute_parity mode -- updates the parity w/o LOCKING */
273#define UPDATE_PARITY 4
272 274
273/* 275/*
274 * Stripe state 276 * Stripe state
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c
index 1f6a3c82ee0c..866215ac7f25 100644
--- a/drivers/md/raid6algos.c
+++ b/drivers/md/raid6algos.c
@@ -16,13 +16,20 @@
16 * Algorithm list and algorithm selection for RAID-6 16 * Algorithm list and algorithm selection for RAID-6
17 */ 17 */
18 18
19#include "raid6.h" 19#include <linux/raid/pq.h>
20#ifndef __KERNEL__ 20#ifndef __KERNEL__
21#include <sys/mman.h> 21#include <sys/mman.h>
22#include <stdio.h> 22#include <stdio.h>
23#else
24#if !RAID6_USE_EMPTY_ZERO_PAGE
25/* In .bss so it's zeroed */
26const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
27EXPORT_SYMBOL(raid6_empty_zero_page);
28#endif
23#endif 29#endif
24 30
25struct raid6_calls raid6_call; 31struct raid6_calls raid6_call;
32EXPORT_SYMBOL_GPL(raid6_call);
26 33
27/* Various routine sets */ 34/* Various routine sets */
28extern const struct raid6_calls raid6_intx1; 35extern const struct raid6_calls raid6_intx1;
@@ -79,6 +86,7 @@ const struct raid6_calls * const raid6_algos[] = {
79#else 86#else
80/* Need more time to be stable in userspace */ 87/* Need more time to be stable in userspace */
81#define RAID6_TIME_JIFFIES_LG2 9 88#define RAID6_TIME_JIFFIES_LG2 9
89#define time_before(x, y) ((x) < (y))
82#endif 90#endif
83 91
84/* Try to pick the best algorithm */ 92/* Try to pick the best algorithm */
@@ -152,3 +160,12 @@ int __init raid6_select_algo(void)
152 160
153 return best ? 0 : -EINVAL; 161 return best ? 0 : -EINVAL;
154} 162}
163
164static void raid6_exit(void)
165{
166 do { } while (0);
167}
168
169subsys_initcall(raid6_select_algo);
170module_exit(raid6_exit);
171MODULE_LICENSE("GPL");
diff --git a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc
index 217580667e0c..699dfeee4944 100644
--- a/drivers/md/raid6altivec.uc
+++ b/drivers/md/raid6altivec.uc
@@ -22,7 +22,7 @@
22 * bracked this with preempt_disable/enable or in a lock) 22 * bracked this with preempt_disable/enable or in a lock)
23 */ 23 */
24 24
25#include "raid6.h" 25#include <linux/raid/pq.h>
26 26
27#ifdef CONFIG_ALTIVEC 27#ifdef CONFIG_ALTIVEC
28 28
diff --git a/drivers/md/raid6int.uc b/drivers/md/raid6int.uc
index 32a0bac3eb3d..f9bf9cba357f 100644
--- a/drivers/md/raid6int.uc
+++ b/drivers/md/raid6int.uc
@@ -18,7 +18,7 @@
18 * This file is postprocessed using unroll.pl 18 * This file is postprocessed using unroll.pl
19 */ 19 */
20 20
21#include "raid6.h" 21#include <linux/raid/pq.h>
22 22
23/* 23/*
24 * This is the C data type to use 24 * This is the C data type to use
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c
index 804cb50ecc19..e7f6c13132bf 100644
--- a/drivers/md/raid6mmx.c
+++ b/drivers/md/raid6mmx.c
@@ -18,7 +18,7 @@
18 18
19#if defined(__i386__) && !defined(__arch_um__) 19#if defined(__i386__) && !defined(__arch_um__)
20 20
21#include "raid6.h" 21#include <linux/raid/pq.h>
22#include "raid6x86.h" 22#include "raid6x86.h"
23 23
24/* Shared with raid6sse1.c */ 24/* Shared with raid6sse1.c */
diff --git a/drivers/md/raid6recov.c b/drivers/md/raid6recov.c
index 7a98b8652582..2609f00e0d61 100644
--- a/drivers/md/raid6recov.c
+++ b/drivers/md/raid6recov.c
@@ -18,7 +18,7 @@
18 * the syndrome.) 18 * the syndrome.)
19 */ 19 */
20 20
21#include "raid6.h" 21#include <linux/raid/pq.h>
22 22
23/* Recover two failed data blocks. */ 23/* Recover two failed data blocks. */
24void raid6_2data_recov(int disks, size_t bytes, int faila, int failb, 24void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
@@ -63,9 +63,7 @@ void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
63 p++; q++; 63 p++; q++;
64 } 64 }
65} 65}
66 66EXPORT_SYMBOL_GPL(raid6_2data_recov);
67
68
69 67
70/* Recover failure of one data block plus the P block */ 68/* Recover failure of one data block plus the P block */
71void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs) 69void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs)
@@ -97,9 +95,10 @@ void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs)
97 q++; dq++; 95 q++; dq++;
98 } 96 }
99} 97}
98EXPORT_SYMBOL_GPL(raid6_datap_recov);
100 99
101 100#ifndef __KERNEL__
102#ifndef __KERNEL__ /* Testing only */ 101/* Testing only */
103 102
104/* Recover two failed blocks. */ 103/* Recover two failed blocks. */
105void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, void **ptrs) 104void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, void **ptrs)
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c
index 15c588905225..b274dd5eab8f 100644
--- a/drivers/md/raid6sse1.c
+++ b/drivers/md/raid6sse1.c
@@ -23,7 +23,7 @@
23 23
24#if defined(__i386__) && !defined(__arch_um__) 24#if defined(__i386__) && !defined(__arch_um__)
25 25
26#include "raid6.h" 26#include <linux/raid/pq.h>
27#include "raid6x86.h" 27#include "raid6x86.h"
28 28
29/* Defined in raid6mmx.c */ 29/* Defined in raid6mmx.c */
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c
index 2e92e96275be..6ed6c6c0389f 100644
--- a/drivers/md/raid6sse2.c
+++ b/drivers/md/raid6sse2.c
@@ -19,7 +19,7 @@
19 19
20#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) 20#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
21 21
22#include "raid6.h" 22#include <linux/raid/pq.h>
23#include "raid6x86.h" 23#include "raid6x86.h"
24 24
25static const struct raid6_sse_constants { 25static const struct raid6_sse_constants {
diff --git a/drivers/md/raid6test/Makefile b/drivers/md/raid6test/Makefile
index 78e0396adf2a..58ffdf4f5161 100644
--- a/drivers/md/raid6test/Makefile
+++ b/drivers/md/raid6test/Makefile
@@ -5,7 +5,7 @@
5 5
6CC = gcc 6CC = gcc
7OPTFLAGS = -O2 # Adjust as desired 7OPTFLAGS = -O2 # Adjust as desired
8CFLAGS = -I.. -g $(OPTFLAGS) 8CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)
9LD = ld 9LD = ld
10PERL = perl 10PERL = perl
11AR = ar 11AR = ar
diff --git a/drivers/md/raid6test/test.c b/drivers/md/raid6test/test.c
index 559cc41b2585..7a930318b17d 100644
--- a/drivers/md/raid6test/test.c
+++ b/drivers/md/raid6test/test.c
@@ -17,7 +17,7 @@
17#include <stdlib.h> 17#include <stdlib.h>
18#include <stdio.h> 18#include <stdio.h>
19#include <string.h> 19#include <string.h>
20#include "raid6.h" 20#include <linux/raid/pq.h>
21 21
22#define NDISKS 16 /* Including P and Q */ 22#define NDISKS 16 /* Including P and Q */
23 23
diff --git a/drivers/md/raid6.h b/include/linux/raid/pq.h
index 8a9c823bab9e..d92480f8285c 100644
--- a/drivers/md/raid6.h
+++ b/include/linux/raid/pq.h
@@ -19,9 +19,6 @@
19#define RAID6_USE_EMPTY_ZERO_PAGE 0 19#define RAID6_USE_EMPTY_ZERO_PAGE 0
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21 21
22/* Additional compute_parity mode -- updates the parity w/o LOCKING */
23#define UPDATE_PARITY 4
24
25/* We need a pre-zeroed page... if we don't want to use the kernel-provided 22/* We need a pre-zeroed page... if we don't want to use the kernel-provided
26 one define it here */ 23 one define it here */
27#if RAID6_USE_EMPTY_ZERO_PAGE 24#if RAID6_USE_EMPTY_ZERO_PAGE
@@ -64,6 +61,10 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];
64#define enable_kernel_altivec() 61#define enable_kernel_altivec()
65#define disable_kernel_altivec() 62#define disable_kernel_altivec()
66 63
64#define EXPORT_SYMBOL(sym)
65#define MODULE_LICENSE(licence)
66#define subsys_initcall(x)
67#define module_exit(x)
67#endif /* __KERNEL__ */ 68#endif /* __KERNEL__ */
68 69
69/* Routine choices */ 70/* Routine choices */
@@ -94,9 +95,11 @@ extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
94extern const u8 raid6_gfexi[256] __attribute__((aligned(256))); 95extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
95 96
96/* Recovery routines */ 97/* Recovery routines */
97void raid6_2data_recov(int disks, size_t bytes, int faila, int failb, void **ptrs); 98void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
99 void **ptrs);
98void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs); 100void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs);
99void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, void **ptrs); 101void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
102 void **ptrs);
100 103
101/* Some definitions to allow code to be compiled for testing in userspace */ 104/* Some definitions to allow code to be compiled for testing in userspace */
102#ifndef __KERNEL__ 105#ifndef __KERNEL__
@@ -104,8 +107,11 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, void **ptrs
104# define jiffies raid6_jiffies() 107# define jiffies raid6_jiffies()
105# define printk printf 108# define printk printf
106# define GFP_KERNEL 0 109# define GFP_KERNEL 0
107# define __get_free_pages(x,y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) 110# define __get_free_pages(x, y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), \
108# define free_pages(x,y) munmap((void *)(x), (y)*PAGE_SIZE) 111 PROT_READ|PROT_WRITE, \
112 MAP_PRIVATE|MAP_ANONYMOUS,\
113 0, 0))
114# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE)
109 115
110static inline void cpu_relax(void) 116static inline void cpu_relax(void)
111{ 117{