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