]> git.proxmox.com Git - mirror_zfs-debian.git/blob - include/zpios-internal.h
Merge branch 'add_breaks_replaces_zfs_initramfs' into 'master'
[mirror_zfs-debian.git] / include / zpios-internal.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 controlled from user space.
5 *
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>.
9 * LLNL-CODE-403049
10 *
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>
16 *
17 * This file is part of ZFS on Linux.
18 * For details, see <http://zfsonlinux.org/>.
19 *
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.
24 *
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
28 * for more details.
29 *
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 *
33 * Copyright (c) 2015, Intel Corporation.
34 */
35
36 #ifndef _ZPIOS_INTERNAL_H
37 #define _ZPIOS_INTERNAL_H
38
39 #include "zpios-ctl.h"
40
41 #define OBJ_SIZE 64
42
43 struct run_args;
44
45 typedef struct dmu_obj {
46 objset_t *os;
47 uint64_t obj;
48 } dmu_obj_t;
49
50 /* thread doing the IO data */
51 typedef struct thread_data {
52 struct run_args *run_args;
53 int thread_no;
54 int rc;
55 zpios_stats_t stats;
56 kmutex_t lock;
57 } thread_data_t;
58
59 /* region for IO data */
60 typedef struct zpios_region {
61 __u64 wr_offset;
62 __u64 rd_offset;
63 __u64 init_offset;
64 __u64 max_offset;
65 dmu_obj_t obj;
66 zpios_stats_t stats;
67 kmutex_t lock;
68 } zpios_region_t;
69
70 /* arguments for one run */
71 typedef struct run_args {
72 /* Config args */
73 int id;
74 char pool[ZPIOS_NAME_SIZE];
75 __u64 chunk_size;
76 __u32 thread_count;
77 __u32 region_count;
78 __u64 region_size;
79 __u64 offset;
80 __u32 region_noise;
81 __u32 chunk_noise;
82 __u32 thread_delay;
83 __u32 flags;
84 __u32 block_size;
85 char pre[ZPIOS_PATH_SIZE];
86 char post[ZPIOS_PATH_SIZE];
87 char log[ZPIOS_PATH_SIZE];
88
89 /* Control data */
90 objset_t *os;
91 wait_queue_head_t waitq;
92 volatile uint64_t threads_done;
93 kmutex_t lock_work;
94 kmutex_t lock_ctl;
95 __u32 region_next;
96
97 /* Results data */
98 struct file *file;
99 zpios_stats_t stats;
100
101 thread_data_t **threads;
102 zpios_region_t regions[0]; /* Must be last element */
103 } run_args_t;
104
105 #define ZPIOS_INFO_BUFFER_SIZE 65536
106 #define ZPIOS_INFO_BUFFER_REDZONE 1024
107
108 typedef struct zpios_info {
109 spinlock_t info_lock;
110 int info_size;
111 char *info_buffer;
112 char *info_head; /* Internal kernel use only */
113 } zpios_info_t;
114
115 #endif /* _ZPIOS_INTERNAL_H */