]>
git.proxmox.com Git - mirror_zfs.git/blob - cmd/zpios/zpios.h
1 /*****************************************************************************\
2 * ZPIOS is a heavily modified version of the original PIOS test code.
3 * It is designed to have the test code running in the Linux kernel
4 * against ZFS while still being flexibly controled from user space.
6 * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC.
7 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
11 * Original PIOS Test Code
12 * Copyright (C) 2004 Cluster File Systems, Inc.
13 * Written by Peter Braam <braam@clusterfs.com>
14 * Atul Vidwansa <atul@clusterfs.com>
15 * Milind Dumbare <milind@clusterfs.com>
17 * This file is part of ZFS on Linux.
18 * For details, see <http://github.com/behlendorf/zfs/>.
20 * ZPIOS is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License as published by the
22 * Free Software Foundation; either version 2 of the License, or (at your
23 * option) any later version.
25 * ZPIOS is distributed in the hope that it will be useful, but WITHOUT
26 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
30 * You should have received a copy of the GNU General Public License along
31 * with ZPIOS. If not, see <http://www.gnu.org/licenses/>.
32 \*****************************************************************************/
37 #include <zpios-ctl.h>
39 #define VERSION_SIZE 64
41 /* Regular expressions */
42 #define REGEX_NUMBERS "^[0-9]*[0-9]$"
43 #define REGEX_NUMBERS_COMMA "^([0-9]+,)*[0-9]+$"
44 #define REGEX_SIZE "^[0-9][0-9]*[kmgt]$"
45 #define REGEX_SIZE_COMMA "^([0-9][0-9]*[kmgt]+,)*[0-9][0-9]*[kmgt]$"
47 /* Flags for low, high, incr */
50 #define FLAG_HIGH 0x04
51 #define FLAG_INCR 0x08
57 #define MB (KB * 1024)
58 #define GB (MB * 1024)
59 #define TB (GB * 1024)
63 /* All offsets, sizes and counts can be passed to the application in
65 * 1. a value (stored in val[0], val_count will be 1)
66 * 2. a comma separated list of values (stored in val[], using val_count)
67 * 3. a range and block sizes, low, high, factor (val_count must be 0)
69 typedef struct pios_range_repeat
{
70 uint64_t val
[32]; /* Comma sep array, or low, high, inc */
71 uint64_t val_count
; /* Num of values */
74 uint64_t val_inc_perc
;
75 uint64_t next_val
; /* Used for multiple runs in get_next() */
78 typedef struct cmd_args
{
79 range_repeat_t T
; /* Thread count */
80 range_repeat_t N
; /* Region count */
81 range_repeat_t O
; /* Offset count */
82 range_repeat_t C
; /* Chunksize */
83 range_repeat_t S
; /* Regionsize */
85 const char *pool
; /* Pool */
86 const char *name
; /* Name */
87 uint32_t flags
; /* Flags */
88 uint32_t io_type
; /* DMUIO only */
89 uint32_t verbose
; /* Verbose */
90 uint32_t human_readable
; /* Human readable output */
92 uint64_t regionnoise
; /* Region noise */
93 uint64_t chunknoise
; /* Chunk noise */
94 uint64_t thread_delay
; /* Thread delay */
96 char pre
[ZPIOS_PATH_SIZE
]; /* Pre-exec hook */
97 char post
[ZPIOS_PATH_SIZE
]; /* Post-exec hook */
98 char log
[ZPIOS_PATH_SIZE
]; /* Requested log dir */
111 int set_count(char *pattern1
, char *pattern2
, range_repeat_t
*range
,
112 char *optarg
, uint32_t *flags
, char *arg
);
113 int set_lhi(char *pattern
, range_repeat_t
*range
, char *optarg
,
114 int flag
, uint32_t *flag_thread
, char *arg
);
115 int set_noise(uint64_t *noise
, char *optarg
, char *arg
);
116 int set_load_params(cmd_args_t
*args
, char *optarg
);
117 int check_mutual_exclusive_command_lines(uint32_t flag
, char *arg
);
118 void print_stats_header(cmd_args_t
*args
);
119 void print_stats(cmd_args_t
*args
, zpios_cmd_t
*cmd
);
121 #endif /* _ZPIOS_H */