]>
Commit | Line | Data |
---|---|---|
ab9f4b0b GN |
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", | |
ae25d222 GN |
34 | "sse2", |
35 | "ssse3", | |
ab9f4b0b | 36 | "avx2", |
7f547f85 RD |
37 | "avx512f", |
38 | "avx512bw", | |
62a65a65 RD |
39 | "aarch64_neon", |
40 | "aarch64_neonx2", | |
35b07497 | 41 | "powerpc_altivec", |
ab9f4b0b GN |
42 | NULL |
43 | }; | |
44 | ||
45 | typedef struct raidz_test_opts { | |
46 | size_t rto_ashift; | |
b2255edc | 47 | uint64_t rto_offset; |
ab9f4b0b GN |
48 | size_t rto_dcols; |
49 | size_t rto_dsize; | |
50 | size_t rto_v; | |
51 | size_t rto_sweep; | |
52 | size_t rto_sweep_timeout; | |
53 | size_t rto_benchmark; | |
b2255edc BB |
54 | size_t rto_expand; |
55 | uint64_t rto_expand_offset; | |
ab9f4b0b GN |
56 | size_t rto_sanity; |
57 | size_t rto_gdb; | |
58 | ||
292d573e GN |
59 | /* non-user options */ |
60 | boolean_t rto_should_stop; | |
61 | ||
ab9f4b0b GN |
62 | zio_t *zio_golden; |
63 | raidz_map_t *rm_golden; | |
64 | } raidz_test_opts_t; | |
65 | ||
66 | static const raidz_test_opts_t rto_opts_defaults = { | |
67 | .rto_ashift = 9, | |
68 | .rto_offset = 1ULL << 0, | |
69 | .rto_dcols = 8, | |
70 | .rto_dsize = 1<<19, | |
71 | .rto_v = 0, | |
72 | .rto_sweep = 0, | |
73 | .rto_benchmark = 0, | |
b2255edc BB |
74 | .rto_expand = 0, |
75 | .rto_expand_offset = -1ULL, | |
ab9f4b0b | 76 | .rto_sanity = 0, |
292d573e GN |
77 | .rto_gdb = 0, |
78 | .rto_should_stop = B_FALSE | |
ab9f4b0b GN |
79 | }; |
80 | ||
81 | extern raidz_test_opts_t rto_opts; | |
82 | ||
83 | static inline size_t ilog2(size_t a) | |
84 | { | |
85 | return (a > 1 ? 1 + ilog2(a >> 1) : 0); | |
86 | } | |
87 | ||
88 | ||
89 | #define D_ALL 0 | |
90 | #define D_INFO 1 | |
91 | #define D_DEBUG 2 | |
92 | ||
93 | #define LOG(lvl, a...) \ | |
94 | { \ | |
95 | if (rto_opts.rto_v >= lvl) \ | |
96 | (void) fprintf(stdout, a); \ | |
97 | } \ | |
98 | ||
99 | #define LOG_OPT(lvl, opt, a...) \ | |
100 | { \ | |
101 | if (opt->rto_v >= lvl) \ | |
102 | (void) fprintf(stdout, a); \ | |
103 | } \ | |
104 | ||
105 | #define ERR(a...) (void) fprintf(stderr, a) | |
106 | ||
107 | ||
108 | #define DBLSEP "================\n" | |
109 | #define SEP "----------------\n" | |
110 | ||
111 | ||
cbf484f8 GN |
112 | #define raidz_alloc(size) abd_alloc(size, B_FALSE) |
113 | #define raidz_free(p, size) abd_free(p) | |
ab9f4b0b GN |
114 | |
115 | ||
cbf484f8 | 116 | void init_zio_abd(zio_t *zio); |
ab9f4b0b GN |
117 | |
118 | void run_raidz_benchmark(void); | |
119 | ||
b2255edc BB |
120 | struct raidz_map *vdev_raidz_map_alloc_expanded(abd_t *, uint64_t, uint64_t, |
121 | uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); | |
122 | ||
ab9f4b0b | 123 | #endif /* RAIDZ_TEST_H */ |