Path: blob/main/sys/contrib/openzfs/cmd/raidz_test/raidz_test.h
48380 views
// SPDX-License-Identifier: CDDL-1.01/*2* CDDL HEADER START3*4* The contents of this file are subject to the terms of the5* 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.LICENSE9* or https://opensource.org/licenses/CDDL-1.0.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* Copyright (C) 2016 Gvozden Nešković. All rights reserved.24*/2526#ifndef RAIDZ_TEST_H27#define RAIDZ_TEST_H2829#include <sys/spa.h>3031static const char *const raidz_impl_names[] = {32"original",33"scalar",34"sse2",35"ssse3",36"avx2",37"avx512f",38"avx512bw",39"aarch64_neon",40"aarch64_neonx2",41"powerpc_altivec",42NULL43};4445enum raidz_verbosity {46D_ALL,47D_INFO,48D_DEBUG,49};5051typedef struct raidz_test_opts {52size_t rto_ashift;53uint64_t rto_offset;54size_t rto_dcols;55size_t rto_dsize;56enum raidz_verbosity rto_v;57size_t rto_sweep;58size_t rto_sweep_timeout;59size_t rto_benchmark;60size_t rto_expand;61uint64_t rto_expand_offset;62size_t rto_sanity;63size_t rto_gdb;6465/* non-user options */66boolean_t rto_should_stop;6768zio_t *zio_golden;69raidz_map_t *rm_golden;70} raidz_test_opts_t;7172static const raidz_test_opts_t rto_opts_defaults = {73.rto_ashift = 9,74.rto_offset = 1ULL << 0,75.rto_dcols = 8,76.rto_dsize = 1<<19,77.rto_v = D_ALL,78.rto_sweep = 0,79.rto_benchmark = 0,80.rto_expand = 0,81.rto_expand_offset = -1ULL,82.rto_sanity = 0,83.rto_gdb = 0,84.rto_should_stop = B_FALSE85};8687extern raidz_test_opts_t rto_opts;8889static inline size_t ilog2(size_t a)90{91return (a > 1 ? 1 + ilog2(a >> 1) : 0);92}939495#define LOG(lvl, ...) \96{ \97if (rto_opts.rto_v >= lvl) \98(void) fprintf(stdout, __VA_ARGS__); \99} \100101#define LOG_OPT(lvl, opt, ...) \102{ \103if (opt->rto_v >= lvl) \104(void) fprintf(stdout, __VA_ARGS__); \105} \106107#define ERR(...) (void) fprintf(stderr, __VA_ARGS__)108109110#define DBLSEP "================\n"111#define SEP "----------------\n"112113114#define raidz_alloc(size) abd_alloc(size, B_FALSE)115#define raidz_free(p, size) abd_free(p)116117118void init_zio_abd(zio_t *zio);119120void run_raidz_benchmark(void);121122#endif /* RAIDZ_TEST_H */123124125