Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f701d589 authored by Dan Williams's avatar Dan Williams Committed by NeilBrown
Browse files

md/raid6: move raid6 data processing to raid6_pq.ko



Move the raid6 data processing routines into a standalone module
(raid6_pq) to prepare them to be called from async_tx wrappers and other
non-md drivers/modules.  This precludes a circular dependency of raid456
needing the async modules for data processing while those modules in
turn depend on raid456 for the base level synchronous raid6 routines.

To support this move:
1/ The exportable definitions in raid6.h move to include/linux/raid/pq.h
2/ The raid6_call, recovery calls, and table symbols are exported
3/ Extra #ifdef __KERNEL__ statements to enable the userspace raid6test to
   compile

Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 18b00334
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ config MD_RAID10
config MD_RAID456
	tristate "RAID-4/RAID-5/RAID-6 mode"
	depends on BLK_DEV_MD
	select MD_RAID6_PQ
	select ASYNC_MEMCPY
	select ASYNC_XOR
	---help---
@@ -180,6 +181,9 @@ config MD_RAID5_RESHAPE

	  If unsure, say Y.

config MD_RAID6_PQ
	tristate

config MD_MULTIPATH
	tristate "Multipath I/O support"
	depends on BLK_DEV_MD
+3 −1
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ dm-snapshot-y += dm-snap.o dm-exception-store.o dm-snap-transient.o \
		    dm-snap-persistent.o
dm-mirror-y	+= dm-raid1.o
md-mod-y	+= md.o bitmap.o
raid456-y	+= raid5.o raid6algos.o raid6recov.o raid6tables.o \
raid456-y	+= raid5.o
raid6_pq-y	+= raid6algos.o raid6recov.o raid6tables.o \
		   raid6int1.o raid6int2.o raid6int4.o \
		   raid6int8.o raid6int16.o raid6int32.o \
		   raid6altivec1.o raid6altivec2.o raid6altivec4.o \
@@ -26,6 +27,7 @@ obj-$(CONFIG_MD_LINEAR) += linear.o
obj-$(CONFIG_MD_RAID0)		+= raid0.o
obj-$(CONFIG_MD_RAID1)		+= raid1.o
obj-$(CONFIG_MD_RAID10)		+= raid10.o
obj-$(CONFIG_MD_RAID6_PQ)	+= raid6_pq.o
obj-$(CONFIG_MD_RAID456)	+= raid456.o
obj-$(CONFIG_MD_MULTIPATH)	+= multipath.o
obj-$(CONFIG_MD_FAULTY)		+= faulty.o
+13 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
	uint8_t v;
	uint8_t exptbl[256], invtbl[256];

	printf("#include \"raid6.h\"\n");
	printf("#include <linux/raid/pq.h>\n");

	/* Compute multiplication table */
	printf("\nconst u8  __attribute__((aligned(256)))\n"
@@ -76,6 +76,9 @@ int main(int argc, char *argv[])
		printf("\t},\n");
	}
	printf("};\n");
	printf("#ifdef __KERNEL__\n");
	printf("EXPORT_SYMBOL(raid6_gfmul);\n");
	printf("#endif\n");

	/* Compute power-of-2 table (exponent) */
	v = 1;
@@ -92,6 +95,9 @@ int main(int argc, char *argv[])
		}
	}
	printf("};\n");
	printf("#ifdef __KERNEL__\n");
	printf("EXPORT_SYMBOL(raid6_gfexp);\n");
	printf("#endif\n");

	/* Compute inverse table x^-1 == x^254 */
	printf("\nconst u8 __attribute__((aligned(256)))\n"
@@ -104,6 +110,9 @@ int main(int argc, char *argv[])
		}
	}
	printf("};\n");
	printf("#ifdef __KERNEL__\n");
	printf("EXPORT_SYMBOL(raid6_gfinv);\n");
	printf("#endif\n");

	/* Compute inv(2^x + 1) (exponent-xor-inverse) table */
	printf("\nconst u8 __attribute__((aligned(256)))\n"
@@ -115,6 +124,9 @@ int main(int argc, char *argv[])
			       (j == 7) ? '\n' : ' ');
	}
	printf("};\n");
	printf("#ifdef __KERNEL__\n");
	printf("EXPORT_SYMBOL(raid6_gfexi);\n");
	printf("#endif\n");

	return 0;
}
+1 −11
Original line number Diff line number Diff line
@@ -45,11 +45,11 @@

#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/raid/pq.h>
#include <linux/async_tx.h>
#include <linux/seq_file.h>
#include "md.h"
#include "raid5.h"
#include "raid6.h"
#include "bitmap.h"

/*
@@ -94,11 +94,6 @@

#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))

#if !RAID6_USE_EMPTY_ZERO_PAGE
/* In .bss so it's zeroed */
const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
#endif

/*
 * We maintain a biased count of active stripes in the bottom 16 bits of
 * bi_phys_segments, and a count of processed stripes in the upper 16 bits
@@ -5153,11 +5148,6 @@ static struct mdk_personality raid4_personality =

static int __init raid5_init(void)
{
	int e;

	e = raid6_select_algo();
	if ( e )
		return e;
	register_md_personality(&raid6_personality);
	register_md_personality(&raid5_personality);
	register_md_personality(&raid4_personality);
+2 −0
Original line number Diff line number Diff line
@@ -269,6 +269,8 @@ struct r6_state {
#define READ_MODIFY_WRITE	2
/* not a write method, but a compute_parity mode */
#define	CHECK_PARITY		3
/* Additional compute_parity mode -- updates the parity w/o LOCKING */
#define UPDATE_PARITY		4

/*
 * Stripe state
Loading