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 \*****************************************************************************/
34 #ifndef _ZPIOS_INTERNAL_H
35 #define _ZPIOS_INTERNAL_H
37 #include "zpios-ctl.h"
43 typedef struct dmu_obj {
48 /* thread doing the IO data */
49 typedef struct thread_data {
50 struct run_args *run_args;
57 /* region for IO data */
58 typedef struct zpios_region {
68 /* arguments for one run */
69 typedef struct run_args {
72 char pool[ZPIOS_NAME_SIZE];
82 char pre[ZPIOS_PATH_SIZE];
83 char post[ZPIOS_PATH_SIZE];
84 char log[ZPIOS_PATH_SIZE];
88 wait_queue_head_t waitq;
89 volatile uint64_t threads_done;
98 thread_data_t **threads;
99 zpios_region_t regions[0]; /* Must be last element */
102 #define ZPIOS_INFO_BUFFER_SIZE 65536
103 #define ZPIOS_INFO_BUFFER_REDZONE 1024
105 typedef struct zpios_info {
106 spinlock_t info_lock;
109 char *info_head; /* Internal kernel use only */
112 #define zpios_print(file, format, args...) \
113 ({ zpios_info_t *_info_ = (zpios_info_t *)file->private_data; \
117 ASSERT(_info_->info_buffer); \
119 spin_lock(&_info_->info_lock); \
121 /* Don't allow the kernel to start a write in the red zone */ \
122 if ((int)(_info_->info_head - _info_->info_buffer) > \
123 (_info_->info_size - ZPIOS_INFO_BUFFER_REDZONE)) { \
126 _rc_ = sprintf(_info_->info_head, format, args); \
128 _info_->info_head += _rc_; \
131 spin_unlock(&_info_->info_lock); \
135 #define zpios_vprint(file, test, format, args...) \
136 zpios_print(file, "%*s: " format, ZPIOS_NAME_SIZE, test, args)
138 #endif /* _ZPIOS_INTERNAL_H */