]> git.proxmox.com Git - mirror_zfs-debian.git/blob - include/sys/zio_impl.h
Support custom build directories and move includes
[mirror_zfs-debian.git] / include / sys / zio_impl.h
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * 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.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _ZIO_IMPL_H
27 #define _ZIO_IMPL_H
28
29 #include <sys/zfs_context.h>
30 #include <sys/zio.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /*
37 * zio pipeline stage definitions
38 */
39 enum zio_stage {
40 ZIO_STAGE_OPEN = 1 << 0, /* RWFCI */
41
42 ZIO_STAGE_READ_BP_INIT = 1 << 1, /* R---- */
43 ZIO_STAGE_FREE_BP_INIT = 1 << 2, /* --F-- */
44 ZIO_STAGE_ISSUE_ASYNC = 1 << 3, /* RWF-- */
45 ZIO_STAGE_WRITE_BP_INIT = 1 << 4, /* -W--- */
46
47 ZIO_STAGE_CHECKSUM_GENERATE = 1 << 5, /* -W--- */
48
49 ZIO_STAGE_DDT_READ_START = 1 << 6, /* R---- */
50 ZIO_STAGE_DDT_READ_DONE = 1 << 7, /* R---- */
51 ZIO_STAGE_DDT_WRITE = 1 << 8, /* -W--- */
52 ZIO_STAGE_DDT_FREE = 1 << 9, /* --F-- */
53
54 ZIO_STAGE_GANG_ASSEMBLE = 1 << 10, /* RWFC- */
55 ZIO_STAGE_GANG_ISSUE = 1 << 11, /* RWFC- */
56
57 ZIO_STAGE_DVA_ALLOCATE = 1 << 12, /* -W--- */
58 ZIO_STAGE_DVA_FREE = 1 << 13, /* --F-- */
59 ZIO_STAGE_DVA_CLAIM = 1 << 14, /* ---C- */
60
61 ZIO_STAGE_READY = 1 << 15, /* RWFCI */
62
63 ZIO_STAGE_VDEV_IO_START = 1 << 16, /* RW--I */
64 ZIO_STAGE_VDEV_IO_DONE = 1 << 17, /* RW--I */
65 ZIO_STAGE_VDEV_IO_ASSESS = 1 << 18, /* RW--I */
66
67 ZIO_STAGE_CHECKSUM_VERIFY = 1 << 19, /* R---- */
68
69 ZIO_STAGE_DONE = 1 << 20 /* RWFCI */
70 };
71
72 #define ZIO_INTERLOCK_STAGES \
73 (ZIO_STAGE_READY | \
74 ZIO_STAGE_DONE)
75
76 #define ZIO_INTERLOCK_PIPELINE \
77 ZIO_INTERLOCK_STAGES
78
79 #define ZIO_VDEV_IO_STAGES \
80 (ZIO_STAGE_VDEV_IO_START | \
81 ZIO_STAGE_VDEV_IO_DONE | \
82 ZIO_STAGE_VDEV_IO_ASSESS)
83
84 #define ZIO_VDEV_CHILD_PIPELINE \
85 (ZIO_VDEV_IO_STAGES | \
86 ZIO_STAGE_DONE)
87
88 #define ZIO_READ_COMMON_STAGES \
89 (ZIO_INTERLOCK_STAGES | \
90 ZIO_VDEV_IO_STAGES | \
91 ZIO_STAGE_CHECKSUM_VERIFY)
92
93 #define ZIO_READ_PHYS_PIPELINE \
94 ZIO_READ_COMMON_STAGES
95
96 #define ZIO_READ_PIPELINE \
97 (ZIO_READ_COMMON_STAGES | \
98 ZIO_STAGE_READ_BP_INIT)
99
100 #define ZIO_DDT_CHILD_READ_PIPELINE \
101 ZIO_READ_COMMON_STAGES
102
103 #define ZIO_DDT_READ_PIPELINE \
104 (ZIO_INTERLOCK_STAGES | \
105 ZIO_STAGE_READ_BP_INIT | \
106 ZIO_STAGE_DDT_READ_START | \
107 ZIO_STAGE_DDT_READ_DONE)
108
109 #define ZIO_WRITE_COMMON_STAGES \
110 (ZIO_INTERLOCK_STAGES | \
111 ZIO_VDEV_IO_STAGES | \
112 ZIO_STAGE_ISSUE_ASYNC | \
113 ZIO_STAGE_CHECKSUM_GENERATE)
114
115 #define ZIO_WRITE_PHYS_PIPELINE \
116 ZIO_WRITE_COMMON_STAGES
117
118 #define ZIO_REWRITE_PIPELINE \
119 (ZIO_WRITE_COMMON_STAGES | \
120 ZIO_STAGE_WRITE_BP_INIT)
121
122 #define ZIO_WRITE_PIPELINE \
123 (ZIO_WRITE_COMMON_STAGES | \
124 ZIO_STAGE_WRITE_BP_INIT | \
125 ZIO_STAGE_DVA_ALLOCATE)
126
127 #define ZIO_DDT_CHILD_WRITE_PIPELINE \
128 (ZIO_INTERLOCK_STAGES | \
129 ZIO_VDEV_IO_STAGES | \
130 ZIO_STAGE_DVA_ALLOCATE)
131
132 #define ZIO_DDT_WRITE_PIPELINE \
133 (ZIO_INTERLOCK_STAGES | \
134 ZIO_STAGE_ISSUE_ASYNC | \
135 ZIO_STAGE_WRITE_BP_INIT | \
136 ZIO_STAGE_CHECKSUM_GENERATE | \
137 ZIO_STAGE_DDT_WRITE)
138
139 #define ZIO_GANG_STAGES \
140 (ZIO_STAGE_GANG_ASSEMBLE | \
141 ZIO_STAGE_GANG_ISSUE)
142
143 #define ZIO_FREE_PIPELINE \
144 (ZIO_INTERLOCK_STAGES | \
145 ZIO_STAGE_FREE_BP_INIT | \
146 ZIO_STAGE_DVA_FREE)
147
148 #define ZIO_DDT_FREE_PIPELINE \
149 (ZIO_INTERLOCK_STAGES | \
150 ZIO_STAGE_FREE_BP_INIT | \
151 ZIO_STAGE_ISSUE_ASYNC | \
152 ZIO_STAGE_DDT_FREE)
153
154 #define ZIO_CLAIM_PIPELINE \
155 (ZIO_INTERLOCK_STAGES | \
156 ZIO_STAGE_DVA_CLAIM)
157
158 #define ZIO_IOCTL_PIPELINE \
159 (ZIO_INTERLOCK_STAGES | \
160 ZIO_STAGE_VDEV_IO_START | \
161 ZIO_STAGE_VDEV_IO_ASSESS)
162
163 #define ZIO_BLOCKING_STAGES \
164 (ZIO_STAGE_DVA_ALLOCATE | \
165 ZIO_STAGE_DVA_CLAIM | \
166 ZIO_STAGE_VDEV_IO_START)
167
168 extern void zio_inject_init(void);
169 extern void zio_inject_fini(void);
170
171 #ifdef __cplusplus
172 }
173 #endif
174
175 #endif /* _ZIO_IMPL_H */