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.
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.
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]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/zfs_context.h>
39 * I/O Groups: pipeline stage definitions.
42 typedef enum zio_stage {
43 ZIO_STAGE_OPEN = 0, /* RWFCI */
44 ZIO_STAGE_WAIT_CHILDREN_READY, /* RWFCI */
46 ZIO_STAGE_WRITE_COMPRESS, /* -W--- */
47 ZIO_STAGE_CHECKSUM_GENERATE, /* -W--- */
49 ZIO_STAGE_GANG_PIPELINE, /* -WFC- */
51 ZIO_STAGE_GET_GANG_HEADER, /* -WFC- */
52 ZIO_STAGE_REWRITE_GANG_MEMBERS, /* -W--- */
53 ZIO_STAGE_FREE_GANG_MEMBERS, /* --F-- */
54 ZIO_STAGE_CLAIM_GANG_MEMBERS, /* ---C- */
56 ZIO_STAGE_DVA_ALLOCATE, /* -W--- */
57 ZIO_STAGE_DVA_FREE, /* --F-- */
58 ZIO_STAGE_DVA_CLAIM, /* ---C- */
60 ZIO_STAGE_GANG_CHECKSUM_GENERATE, /* -W--- */
62 ZIO_STAGE_READY, /* RWFCI */
64 ZIO_STAGE_VDEV_IO_START, /* RW--I */
65 ZIO_STAGE_VDEV_IO_DONE, /* RW--I */
66 ZIO_STAGE_VDEV_IO_ASSESS, /* RW--I */
68 ZIO_STAGE_WAIT_CHILDREN_DONE, /* RWFCI */
70 ZIO_STAGE_CHECKSUM_VERIFY, /* R---- */
71 ZIO_STAGE_READ_GANG_MEMBERS, /* R---- */
72 ZIO_STAGE_READ_DECOMPRESS, /* R---- */
74 ZIO_STAGE_DONE /* RWFCI */
78 * The stages for which there's some performance value in going async.
79 * When compression is enabled, ZIO_STAGE_WRITE_COMPRESS is ORed in as well.
81 #define ZIO_ASYNC_PIPELINE_STAGES \
82 ((1U << ZIO_STAGE_CHECKSUM_GENERATE) | \
83 (1U << ZIO_STAGE_VDEV_IO_DONE) | \
84 (1U << ZIO_STAGE_CHECKSUM_VERIFY) | \
85 (1U << ZIO_STAGE_READ_DECOMPRESS))
87 #define ZIO_VDEV_IO_PIPELINE \
88 ((1U << ZIO_STAGE_VDEV_IO_START) | \
89 (1U << ZIO_STAGE_VDEV_IO_DONE) | \
90 (1U << ZIO_STAGE_VDEV_IO_ASSESS))
92 #define ZIO_READ_PHYS_PIPELINE \
93 ((1U << ZIO_STAGE_OPEN) | \
94 (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
95 (1U << ZIO_STAGE_READY) | \
96 ZIO_VDEV_IO_PIPELINE | \
97 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
98 (1U << ZIO_STAGE_CHECKSUM_VERIFY) | \
99 (1U << ZIO_STAGE_DONE))
101 #define ZIO_READ_PIPELINE \
102 ZIO_READ_PHYS_PIPELINE
104 #define ZIO_WRITE_PHYS_PIPELINE \
105 ((1U << ZIO_STAGE_OPEN) | \
106 (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
107 (1U << ZIO_STAGE_CHECKSUM_GENERATE) | \
108 (1U << ZIO_STAGE_READY) | \
109 ZIO_VDEV_IO_PIPELINE | \
110 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
111 (1U << ZIO_STAGE_DONE))
113 #define ZIO_WRITE_COMMON_PIPELINE \
114 ZIO_WRITE_PHYS_PIPELINE
116 #define ZIO_WRITE_PIPELINE \
117 ((1U << ZIO_STAGE_WRITE_COMPRESS) | \
118 ZIO_WRITE_COMMON_PIPELINE)
120 #define ZIO_GANG_STAGES \
121 ((1U << ZIO_STAGE_GET_GANG_HEADER) | \
122 (1U << ZIO_STAGE_REWRITE_GANG_MEMBERS) | \
123 (1U << ZIO_STAGE_FREE_GANG_MEMBERS) | \
124 (1U << ZIO_STAGE_CLAIM_GANG_MEMBERS) | \
125 (1U << ZIO_STAGE_GANG_CHECKSUM_GENERATE) | \
126 (1U << ZIO_STAGE_READ_GANG_MEMBERS))
128 #define ZIO_REWRITE_PIPELINE \
129 ((1U << ZIO_STAGE_GANG_PIPELINE) | \
130 (1U << ZIO_STAGE_GET_GANG_HEADER) | \
131 (1U << ZIO_STAGE_REWRITE_GANG_MEMBERS) | \
132 (1U << ZIO_STAGE_GANG_CHECKSUM_GENERATE) | \
133 ZIO_WRITE_COMMON_PIPELINE)
135 #define ZIO_WRITE_ALLOCATE_PIPELINE \
136 ((1U << ZIO_STAGE_DVA_ALLOCATE) | \
137 ZIO_WRITE_COMMON_PIPELINE)
139 #define ZIO_GANG_FREE_STAGES \
140 ((1U << ZIO_STAGE_GET_GANG_HEADER) | \
141 (1U << ZIO_STAGE_FREE_GANG_MEMBERS))
143 #define ZIO_FREE_PIPELINE \
144 ((1U << ZIO_STAGE_OPEN) | \
145 (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
146 (1U << ZIO_STAGE_GANG_PIPELINE) | \
147 (1U << ZIO_STAGE_GET_GANG_HEADER) | \
148 (1U << ZIO_STAGE_FREE_GANG_MEMBERS) | \
149 (1U << ZIO_STAGE_DVA_FREE) | \
150 (1U << ZIO_STAGE_READY) | \
151 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
152 (1U << ZIO_STAGE_DONE))
154 #define ZIO_CLAIM_PIPELINE \
155 ((1U << ZIO_STAGE_OPEN) | \
156 (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
157 (1U << ZIO_STAGE_GANG_PIPELINE) | \
158 (1U << ZIO_STAGE_GET_GANG_HEADER) | \
159 (1U << ZIO_STAGE_CLAIM_GANG_MEMBERS) | \
160 (1U << ZIO_STAGE_DVA_CLAIM) | \
161 (1U << ZIO_STAGE_READY) | \
162 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
163 (1U << ZIO_STAGE_DONE))
165 #define ZIO_IOCTL_PIPELINE \
166 ((1U << ZIO_STAGE_OPEN) | \
167 (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
168 (1U << ZIO_STAGE_READY) | \
169 ZIO_VDEV_IO_PIPELINE | \
170 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
171 (1U << ZIO_STAGE_DONE))
173 #define ZIO_WAIT_FOR_CHILDREN_PIPELINE \
174 ((1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \
175 (1U << ZIO_STAGE_READY) | \
176 (1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
177 (1U << ZIO_STAGE_DONE))
179 #define ZIO_WAIT_FOR_CHILDREN_DONE_PIPELINE \
180 ((1U << ZIO_STAGE_WAIT_CHILDREN_DONE) | \
181 (1U << ZIO_STAGE_DONE))
183 #define ZIO_VDEV_CHILD_PIPELINE \
184 (ZIO_WAIT_FOR_CHILDREN_DONE_PIPELINE | \
185 ZIO_VDEV_IO_PIPELINE)
187 #define ZIO_ERROR_PIPELINE_MASK \
188 ZIO_WAIT_FOR_CHILDREN_PIPELINE
190 typedef struct zio_transform zio_transform_t;
191 struct zio_transform {
195 zio_transform_t *zt_next;
198 extern void zio_inject_init(void);
199 extern void zio_inject_fini(void);
205 #endif /* _ZIO_IMPL_H */