]> git.proxmox.com Git - mirror_zfs.git/blob - cmd/raidz_test/raidz_test.h
Add parity generation/rebuild using 128-bits NEON for Aarch64
[mirror_zfs.git] / cmd / raidz_test / raidz_test.h
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (C) 2016 Gvozden Nešković. All rights reserved.
24 */
25
26 #ifndef RAIDZ_TEST_H
27 #define RAIDZ_TEST_H
28
29 #include <sys/spa.h>
30
31 static const char *raidz_impl_names[] = {
32 "original",
33 "scalar",
34 "sse2",
35 "ssse3",
36 "avx2",
37 "aarch64_neon",
38 "aarch64_neonx2",
39 NULL
40 };
41
42 typedef struct raidz_test_opts {
43 size_t rto_ashift;
44 size_t rto_offset;
45 size_t rto_dcols;
46 size_t rto_dsize;
47 size_t rto_v;
48 size_t rto_sweep;
49 size_t rto_sweep_timeout;
50 size_t rto_benchmark;
51 size_t rto_sanity;
52 size_t rto_gdb;
53
54 /* non-user options */
55 boolean_t rto_should_stop;
56
57 zio_t *zio_golden;
58 raidz_map_t *rm_golden;
59 } raidz_test_opts_t;
60
61 static const raidz_test_opts_t rto_opts_defaults = {
62 .rto_ashift = 9,
63 .rto_offset = 1ULL << 0,
64 .rto_dcols = 8,
65 .rto_dsize = 1<<19,
66 .rto_v = 0,
67 .rto_sweep = 0,
68 .rto_benchmark = 0,
69 .rto_sanity = 0,
70 .rto_gdb = 0,
71 .rto_should_stop = B_FALSE
72 };
73
74 extern raidz_test_opts_t rto_opts;
75
76 static inline size_t ilog2(size_t a)
77 {
78 return (a > 1 ? 1 + ilog2(a >> 1) : 0);
79 }
80
81
82 #define D_ALL 0
83 #define D_INFO 1
84 #define D_DEBUG 2
85
86 #define LOG(lvl, a...) \
87 { \
88 if (rto_opts.rto_v >= lvl) \
89 (void) fprintf(stdout, a); \
90 } \
91
92 #define LOG_OPT(lvl, opt, a...) \
93 { \
94 if (opt->rto_v >= lvl) \
95 (void) fprintf(stdout, a); \
96 } \
97
98 #define ERR(a...) (void) fprintf(stderr, a)
99
100
101 #define DBLSEP "================\n"
102 #define SEP "----------------\n"
103
104
105 #define raidz_alloc(size) zio_data_buf_alloc(size)
106 #define raidz_free(p, size) zio_data_buf_free(p, size)
107
108
109 void init_zio_data(zio_t *zio);
110
111 void run_raidz_benchmark(void);
112
113 #endif /* RAIDZ_TEST_H */