diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:38:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:38:19 -0400 |
| commit | 3d30701b58970425e1d45994d6cb82f828924fdd (patch) | |
| tree | 8b14cf462628bebf8548c1b8c205a674564052d1 /lib | |
| parent | 8cbd84f2dd4e52a8771b191030c374ba3e56d291 (diff) | |
| parent | fd8aa2c1811bf60ccb2d5de0579c6f62aec1772d (diff) | |
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: (24 commits)
md: clean up do_md_stop
md: fix another deadlock with removing sysfs attributes.
md: move revalidate_disk() back outside open_mutex
md/raid10: fix deadlock with unaligned read during resync
md/bitmap: separate out loading a bitmap from initialising the structures.
md/bitmap: prepare for storing write-intent-bitmap via dm-dirty-log.
md/bitmap: optimise scanning of empty bitmaps.
md/bitmap: clean up plugging calls.
md/bitmap: reduce dependence on sysfs.
md/bitmap: white space clean up and similar.
md/raid5: export raid5 unplugging interface.
md/plug: optionally use plugger to unplug an array during resync/recovery.
md/raid5: add simple plugging infrastructure.
md/raid5: export is_congested test
raid5: Don't set read-ahead when there is no queue
md: add support for raising dm events.
md: export various start/stop interfaces
md: split out md_rdev_init
md: be more careful setting MD_CHANGE_CLEAN
md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk
...
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig | 3 | ||||
| -rw-r--r-- | lib/Makefile | 1 | ||||
| -rw-r--r-- | lib/raid6/Makefile | 78 | ||||
| -rw-r--r-- | lib/raid6/mktables.c | 132 | ||||
| -rw-r--r-- | lib/raid6/raid6algos.c | 154 | ||||
| -rw-r--r-- | lib/raid6/raid6altivec.uc | 130 | ||||
| -rw-r--r-- | lib/raid6/raid6int.uc | 117 | ||||
| -rw-r--r-- | lib/raid6/raid6mmx.c | 142 | ||||
| -rw-r--r-- | lib/raid6/raid6recov.c | 132 | ||||
| -rw-r--r-- | lib/raid6/raid6sse1.c | 162 | ||||
| -rw-r--r-- | lib/raid6/raid6sse2.c | 262 | ||||
| -rw-r--r-- | lib/raid6/raid6test/Makefile | 75 | ||||
| -rw-r--r-- | lib/raid6/raid6test/test.c | 124 | ||||
| -rw-r--r-- | lib/raid6/raid6x86.h | 61 | ||||
| -rw-r--r-- | lib/raid6/unroll.awk | 20 |
15 files changed, 1593 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 5b916bc0fbae..fa9bf2c06199 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -7,6 +7,9 @@ config BINARY_PRINTF | |||
| 7 | 7 | ||
| 8 | menu "Library routines" | 8 | menu "Library routines" |
| 9 | 9 | ||
| 10 | config RAID6_PQ | ||
| 11 | tristate | ||
| 12 | |||
| 10 | config BITREVERSE | 13 | config BITREVERSE |
| 11 | tristate | 14 | tristate |
| 12 | 15 | ||
diff --git a/lib/Makefile b/lib/Makefile index 0bfabba1bb32..e6a3763b8212 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -69,6 +69,7 @@ obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ | |||
| 69 | obj-$(CONFIG_REED_SOLOMON) += reed_solomon/ | 69 | obj-$(CONFIG_REED_SOLOMON) += reed_solomon/ |
| 70 | obj-$(CONFIG_LZO_COMPRESS) += lzo/ | 70 | obj-$(CONFIG_LZO_COMPRESS) += lzo/ |
| 71 | obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ | 71 | obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ |
| 72 | obj-$(CONFIG_RAID6_PQ) += raid6/ | ||
| 72 | 73 | ||
| 73 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o | 74 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o |
| 74 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o | 75 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o |
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile new file mode 100644 index 000000000000..19bf32da644f --- /dev/null +++ b/lib/raid6/Makefile | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | obj-$(CONFIG_RAID6_PQ) += raid6_pq.o | ||
| 2 | |||
| 3 | raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \ | ||
| 4 | raid6int1.o raid6int2.o raid6int4.o \ | ||
| 5 | raid6int8.o raid6int16.o raid6int32.o \ | ||
| 6 | raid6altivec1.o raid6altivec2.o raid6altivec4.o \ | ||
| 7 | raid6altivec8.o \ | ||
| 8 | raid6mmx.o raid6sse1.o raid6sse2.o | ||
| 9 | hostprogs-y += mktables | ||
| 10 | |||
| 11 | quiet_cmd_unroll = UNROLL $@ | ||
| 12 | cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \ | ||
| 13 | < $< > $@ || ( rm -f $@ && exit 1 ) | ||
| 14 | |||
| 15 | ifeq ($(CONFIG_ALTIVEC),y) | ||
| 16 | altivec_flags := -maltivec -mabi=altivec | ||
| 17 | endif | ||
| 18 | |||
| 19 | targets += raid6int1.c | ||
| 20 | $(obj)/raid6int1.c: UNROLL := 1 | ||
| 21 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 22 | $(call if_changed,unroll) | ||
| 23 | |||
| 24 | targets += raid6int2.c | ||
| 25 | $(obj)/raid6int2.c: UNROLL := 2 | ||
| 26 | $(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 27 | $(call if_changed,unroll) | ||
| 28 | |||
| 29 | targets += raid6int4.c | ||
| 30 | $(obj)/raid6int4.c: UNROLL := 4 | ||
| 31 | $(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 32 | $(call if_changed,unroll) | ||
| 33 | |||
| 34 | targets += raid6int8.c | ||
| 35 | $(obj)/raid6int8.c: UNROLL := 8 | ||
| 36 | $(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 37 | $(call if_changed,unroll) | ||
| 38 | |||
| 39 | targets += raid6int16.c | ||
| 40 | $(obj)/raid6int16.c: UNROLL := 16 | ||
| 41 | $(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 42 | $(call if_changed,unroll) | ||
| 43 | |||
| 44 | targets += raid6int32.c | ||
| 45 | $(obj)/raid6int32.c: UNROLL := 32 | ||
| 46 | $(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | ||
| 47 | $(call if_changed,unroll) | ||
| 48 | |||
| 49 | CFLAGS_raid6altivec1.o += $(altivec_flags) | ||
| 50 | targets += raid6altivec1.c | ||
| 51 | $(obj)/raid6altivec1.c: UNROLL := 1 | ||
| 52 | $(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | ||
| 53 | $(call if_changed,unroll) | ||
| 54 | |||
| 55 | CFLAGS_raid6altivec2.o += $(altivec_flags) | ||
| 56 | targets += raid6altivec2.c | ||
| 57 | $(obj)/raid6altivec2.c: UNROLL := 2 | ||
| 58 | $(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | ||
| 59 | $(call if_changed,unroll) | ||
| 60 | |||
| 61 | CFLAGS_raid6altivec4.o += $(altivec_flags) | ||
| 62 | targets += raid6altivec4.c | ||
| 63 | $(obj)/raid6altivec4.c: UNROLL := 4 | ||
| 64 | $(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | ||
| 65 | $(call if_changed,unroll) | ||
| 66 | |||
| 67 | CFLAGS_raid6altivec8.o += $(altivec_flags) | ||
| 68 | targets += raid6altivec8.c | ||
| 69 | $(obj)/raid6altivec8.c: UNROLL := 8 | ||
| 70 | $(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | ||
| 71 | $(call if_changed,unroll) | ||
| 72 | |||
| 73 | quiet_cmd_mktable = TABLE $@ | ||
| 74 | cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 ) | ||
| 75 | |||
| 76 | targets += raid6tables.c | ||
| 77 | $(obj)/raid6tables.c: $(obj)/mktables FORCE | ||
| 78 | $(call if_changed,mktable) | ||
diff --git a/lib/raid6/mktables.c b/lib/raid6/mktables.c new file mode 100644 index 000000000000..3b1500843bba --- /dev/null +++ b/lib/raid6/mktables.c | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | /* -*- linux-c -*- ------------------------------------------------------- * | ||
| 2 | * | ||
| 3 | * Copyright 2002-2007 H. Peter Anvin - All Rights Reserved | ||
| 4 | * | ||
| 5 | * This file is part of the Linux kernel, and is made available under | ||
| 6 | * the terms of the GNU General Public License version 2 or (at your | ||
| 7 | * option) any later version; incorporated herein by reference. | ||
| 8 | * | ||
| 9 | * ----------------------------------------------------------------------- */ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * mktables.c | ||
| 13 | * | ||
| 14 | * Make RAID-6 tables. This is a host user space program to be run at | ||
| 15 | * compile time. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdio.h> | ||
| 19 | #include <string.h> | ||
| 20 | #include <inttypes.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <time.h> | ||
| 23 | |||
| 24 | static uint8_t gfmul(uint8_t a, uint8_t b) | ||
| 25 | { | ||
| 26 | uint8_t v = 0; | ||
| 27 | |||
| 28 | while (b) { | ||
| 29 | if (b & 1) | ||
| 30 | v ^= a; | ||
| 31 | a = (a << 1) ^ (a & 0x80 ? 0x1d : 0); | ||
| 32 | b >>= 1; | ||
| 33 | } | ||
| 34 | |||
| 35 | return v; | ||
| 36 | } | ||
| 37 | |||
| 38 | static uint8_t gfpow(uint8_t a, int b) | ||
| 39 | { | ||
| 40 | uint8_t v = 1; | ||
| 41 | |||
| 42 | b %= 255; | ||
| 43 | if (b < 0) | ||
| 44 | b += 255; | ||
| 45 | |||
| 46 | while (b) { | ||
| 47 | if (b & 1) | ||
| 48 | v = gfmul(v, a); | ||
| 49 | a = gfmul(a, a); | ||
| 50 | b >>= 1; | ||
| 51 | } | ||
| 52 | |||
| 53 | return v; | ||
| 54 | } | ||
| 55 | |||
| 56 | int main(int argc, char *argv[]) | ||
| 57 | { | ||
| 58 | int i, j, k; | ||
| 59 | uint8_t v; | ||
| 60 | uint8_t exptbl[256], invtbl[256]; | ||
| 61 | |||
| 62 | printf("#include <linux/raid/pq.h>\n"); | ||
| 63 | |||
| 64 | /* Compute multiplication table */ | ||
| 65 | printf("\nconst u8 __attribute__((aligned(256)))\n" | ||
| 66 | "raid6_gfmul[256][256] =\n" | ||
| 67 | "{\n"); | ||
| 68 | for (i = 0; i < 256; i++) { | ||
| 69 | printf("\t{\n"); | ||
| 70 | for (j = 0; j < 256; j += 8) { | ||
| 71 | printf("\t\t"); | ||
| 72 | for (k = 0; k < 8; k++) | ||
