mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 06:34:11 +08:00
4d7696f1b0
Headline item is multithreading for RAID5 so that more IO/sec can be supported on fast (SSD) devices. Also TILE-Gx SIMD suppor for RAID6 calculations and an assortment of bug fixes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIVAwUAUi6dRTnsnt1WYoG5AQIqMBAAm/XUEqfyBNUiTPHmIU/OyReOlfsp8A2o xtcmSzaCtIUz4btPszUrw3PShqnk+lXXX2AB0rp3PzfOgyNYXBRKbzOf3eGr2VEp L/Cm0iSWHqQ7V7MoV5ZrqtvuyJV1a7FK3a3VaoKaUk424o4sZ7P67t/YZAnTCP/i 9wQoPeIOJ8YjZsaAQjzI3q7yRMRE8ytyBnF4NdgeMyr2p17w2e9pnmNfCTo4wnWs Nu2wPr2QCPQXr/FoIhdIVEy3kVatqH8qXG8Fw+5n07HJYxGCvQZLDuoOVDYyFeoW gnNq2MMgLZm/7Nzqd1bN+QQZuBCd5JL4VJ2G4vLfYrn3ZSdSysrVKQXFKYG3Gkua 1KP4Pv0hndAl4DtGbUk8CiZp6b+c5qeWvq+sO2NuhUGmumFMK2q4DJhITNexjmrs Eg4opnR8JMLDkYD6o52Ziu5KQR/q1PKRLj80eoVuqB2QQM5+NPb4s3k2WN+53lQD L9fH2alUxxSK+5R8ykk923QQ/XErMUwXaka+O/gGFAlYvaaW/GKTxFnKn/GIXAkc tKW88zB+zA5EZEFec+K43z1UjtGxMWsryvDN55ON2iV+LIZBISm7krroBeR55cyO +3tHlPsga0pO+9DdSm7hvZeWRrq5ZJTiZmL/e2FYygrC5tFAY0p+z49fK3e9Th13 C85G7fg3yDY= =zLxh -----END PGP SIGNATURE----- Merge tag 'md/3.12' of git://neil.brown.name/md Pull md update from Neil Brown: "Headline item is multithreading for RAID5 so that more IO/sec can be supported on fast (SSD) devices. Also TILE-Gx SIMD suppor for RAID6 calculations and an assortment of bug fixes" * tag 'md/3.12' of git://neil.brown.name/md: raid5: only wakeup necessary threads md/raid5: flush out all pending requests before proceeding with reshape. md/raid5: use seqcount to protect access to shape in make_request. raid5: sysfs entry to control worker thread number raid5: offload stripe handle to workqueue raid5: fix stripe release order raid5: make release_stripe lockless md: avoid deadlock when dirty buffers during md_stop. md: Don't test all of mddev->flags at once. md: Fix apparent cut-and-paste error in super_90_validate raid6/test: replace echo -e with printf RAID: add tilegx SIMD implementation of raid6 md: fix safe_mode buglet. md: don't call md_allow_write in get_bitmap_file.
178 lines
5.3 KiB
C
178 lines
5.3 KiB
C
/* -*- linux-c -*- ------------------------------------------------------- *
|
|
*
|
|
* Copyright 2003 H. Peter Anvin - All Rights Reserved
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, Inc., 53 Temple Place Ste 330,
|
|
* Boston MA 02111-1307, USA; either version 2 of the License, or
|
|
* (at your option) any later version; incorporated herein by reference.
|
|
*
|
|
* ----------------------------------------------------------------------- */
|
|
|
|
#ifndef LINUX_RAID_RAID6_H
|
|
#define LINUX_RAID_RAID6_H
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
/* Set to 1 to use kernel-wide empty_zero_page */
|
|
#define RAID6_USE_EMPTY_ZERO_PAGE 0
|
|
#include <linux/blkdev.h>
|
|
|
|
/* We need a pre-zeroed page... if we don't want to use the kernel-provided
|
|
one define it here */
|
|
#if RAID6_USE_EMPTY_ZERO_PAGE
|
|
# define raid6_empty_zero_page empty_zero_page
|
|
#else
|
|
extern const char raid6_empty_zero_page[PAGE_SIZE];
|
|
#endif
|
|
|
|
#else /* ! __KERNEL__ */
|
|
/* Used for testing in user space */
|
|
|
|
#include <errno.h>
|
|
#include <inttypes.h>
|
|
#include <limits.h>
|
|
#include <stddef.h>
|
|
#include <sys/mman.h>
|
|
#include <sys/types.h>
|
|
|
|
/* Not standard, but glibc defines it */
|
|
#define BITS_PER_LONG __WORDSIZE
|
|
|
|
typedef uint8_t u8;
|
|
typedef uint16_t u16;
|
|
typedef uint32_t u32;
|
|
typedef uint64_t u64;
|
|
|
|
#ifndef PAGE_SIZE
|
|
# define PAGE_SIZE 4096
|
|
#endif
|
|
extern const char raid6_empty_zero_page[PAGE_SIZE];
|
|
|
|
#define __init
|
|
#define __exit
|
|
#define __attribute_const__ __attribute__((const))
|
|
#define noinline __attribute__((noinline))
|
|
|
|
#define preempt_enable()
|
|
#define preempt_disable()
|
|
#define cpu_has_feature(x) 1
|
|
#define enable_kernel_altivec()
|
|
#define disable_kernel_altivec()
|
|
|
|
#define EXPORT_SYMBOL(sym)
|
|
#define EXPORT_SYMBOL_GPL(sym)
|
|
#define MODULE_LICENSE(licence)
|
|
#define MODULE_DESCRIPTION(desc)
|
|
#define subsys_initcall(x)
|
|
#define module_exit(x)
|
|
#endif /* __KERNEL__ */
|
|
|
|
/* Routine choices */
|
|
struct raid6_calls {
|
|
void (*gen_syndrome)(int, size_t, void **);
|
|
int (*valid)(void); /* Returns 1 if this routine set is usable */
|
|
const char *name; /* Name of this routine set */
|
|
int prefer; /* Has special performance attribute */
|
|
};
|
|
|
|
/* Selected algorithm */
|
|
extern struct raid6_calls raid6_call;
|
|
|
|
/* Various routine sets */
|
|
extern const struct raid6_calls raid6_intx1;
|
|
extern const struct raid6_calls raid6_intx2;
|
|
extern const struct raid6_calls raid6_intx4;
|
|
extern const struct raid6_calls raid6_intx8;
|
|
extern const struct raid6_calls raid6_intx16;
|
|
extern const struct raid6_calls raid6_intx32;
|
|
extern const struct raid6_calls raid6_mmxx1;
|
|
extern const struct raid6_calls raid6_mmxx2;
|
|
extern const struct raid6_calls raid6_sse1x1;
|
|
extern const struct raid6_calls raid6_sse1x2;
|
|
extern const struct raid6_calls raid6_sse2x1;
|
|
extern const struct raid6_calls raid6_sse2x2;
|
|
extern const struct raid6_calls raid6_sse2x4;
|
|
extern const struct raid6_calls raid6_altivec1;
|
|
extern const struct raid6_calls raid6_altivec2;
|
|
extern const struct raid6_calls raid6_altivec4;
|
|
extern const struct raid6_calls raid6_altivec8;
|
|
extern const struct raid6_calls raid6_avx2x1;
|
|
extern const struct raid6_calls raid6_avx2x2;
|
|
extern const struct raid6_calls raid6_avx2x4;
|
|
extern const struct raid6_calls raid6_tilegx8;
|
|
|
|
struct raid6_recov_calls {
|
|
void (*data2)(int, size_t, int, int, void **);
|
|
void (*datap)(int, size_t, int, void **);
|
|
int (*valid)(void);
|
|
const char *name;
|
|
int priority;
|
|
};
|
|
|
|
extern const struct raid6_recov_calls raid6_recov_intx1;
|
|
extern const struct raid6_recov_calls raid6_recov_ssse3;
|
|
extern const struct raid6_recov_calls raid6_recov_avx2;
|
|
|
|
extern const struct raid6_calls raid6_neonx1;
|
|
extern const struct raid6_calls raid6_neonx2;
|
|
extern const struct raid6_calls raid6_neonx4;
|
|
extern const struct raid6_calls raid6_neonx8;
|
|
|
|
/* Algorithm list */
|
|
extern const struct raid6_calls * const raid6_algos[];
|
|
extern const struct raid6_recov_calls *const raid6_recov_algos[];
|
|
int raid6_select_algo(void);
|
|
|
|
/* Return values from chk_syndrome */
|
|
#define RAID6_OK 0
|
|
#define RAID6_P_BAD 1
|
|
#define RAID6_Q_BAD 2
|
|
#define RAID6_PQ_BAD 3
|
|
|
|
/* Galois field tables */
|
|
extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
|
|
extern const u8 raid6_vgfmul[256][32] __attribute__((aligned(256)));
|
|
extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
|
|
extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
|
|
extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
|
|
|
|
/* Recovery routines */
|
|
extern void (*raid6_2data_recov)(int disks, size_t bytes, int faila, int failb,
|
|
void **ptrs);
|
|
extern void (*raid6_datap_recov)(int disks, size_t bytes, int faila,
|
|
void **ptrs);
|
|
void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
|
|
void **ptrs);
|
|
|
|
/* Some definitions to allow code to be compiled for testing in userspace */
|
|
#ifndef __KERNEL__
|
|
|
|
# define jiffies raid6_jiffies()
|
|
# define printk printf
|
|
# define GFP_KERNEL 0
|
|
# define __get_free_pages(x, y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), \
|
|
PROT_READ|PROT_WRITE, \
|
|
MAP_PRIVATE|MAP_ANONYMOUS,\
|
|
0, 0))
|
|
# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y))
|
|
|
|
static inline void cpu_relax(void)
|
|
{
|
|
/* Nothing */
|
|
}
|
|
|
|
#undef HZ
|
|
#define HZ 1000
|
|
static inline uint32_t raid6_jiffies(void)
|
|
{
|
|
struct timeval tv;
|
|
gettimeofday(&tv, NULL);
|
|
return tv.tv_sec*1000 + tv.tv_usec/1000;
|
|
}
|
|
|
|
#endif /* ! __KERNEL__ */
|
|
|
|
#endif /* LINUX_RAID_RAID6_H */
|