summaryrefslogtreecommitdiff
path: root/include/linux/raid/pq.h
diff options
context:
space:
mode:
authorZhengyuan Liu <liuzhengyuan@kylinos.cn>2019-12-20 10:21:28 +0800
committerSong Liu <songliubraving@fb.com>2020-01-13 11:44:09 -0800
commitf591df3cc6d60cadf8ceff5d44af73ea6ba0a39a (patch)
treeada457cd4702edff2fb46542299ff13eed508379 /include/linux/raid/pq.h
parent5e5ac01c2b8802921fee680518a986011cb59820 (diff)
md/raid6: fix algorithm choice under larger PAGE_SIZE
There are several algorithms available for raid6 to generate xor and syndrome parity, including basic int1, int2 ... int32 and SIMD optimized implementation like sse and neon. To test and choose the best algorithms at the initial stage, we need provide enough disk data to feed the algorithms. However, the disk number we provided depends on page size and gfmul table, seeing bellow: const int disks = (65536/PAGE_SIZE) + 2; So when come to 64K PAGE_SIZE, there is only one data disk plus 2 parity disk, as a result the chosed algorithm is not reliable. For example, on my arm64 machine with 64K page enabled, it will choose intx32 as the best one, although the NEON implementation is better. This patch tries to fix the problem by defining a constant raid6 disk number to supporting arbitrary page size. Suggested-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn> Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'include/linux/raid/pq.h')
-rw-r--r--include/linux/raid/pq.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index e0ddb47f4402..154e954b711d 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -28,6 +28,7 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];
#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -43,6 +44,9 @@ typedef uint64_t u64;
#ifndef PAGE_SIZE
# define PAGE_SIZE 4096
#endif
+#ifndef PAGE_SHIFT
+# define PAGE_SHIFT 12
+#endif
extern const char raid6_empty_zero_page[PAGE_SIZE];
#define __init