]> git.proxmox.com Git - mirror_zfs.git/blob - zfs/lib/libzpool/include/sys/zio_impl.h
Rebase to OpenSolaris b103, in the process we are removing any code which did not...
[mirror_zfs.git] / zfs / lib / libzpool / 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 2008 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 * I/O Groups: pipeline stage definitions.
38 */
39 typedef enum zio_stage {
40 ZIO_STAGE_OPEN = 0, /* RWFCI */
41
42 ZIO_STAGE_ISSUE_ASYNC, /* -W--- */
43
44 ZIO_STAGE_READ_BP_INIT, /* R---- */
45 ZIO_STAGE_WRITE_BP_INIT, /* -W--- */
46
47 ZIO_STAGE_CHECKSUM_GENERATE, /* -W--- */
48
49 ZIO_STAGE_GANG_ASSEMBLE, /* RWFC- */
50 ZIO_STAGE_GANG_ISSUE, /* RWFC- */
51
52 ZIO_STAGE_DVA_ALLOCATE, /* -W--- */
53 ZIO_STAGE_DVA_FREE, /* --F-- */
54 ZIO_STAGE_DVA_CLAIM, /* ---C- */
55
56 ZIO_STAGE_READY, /* RWFCI */
57
58 ZIO_STAGE_VDEV_IO_START, /* RW--I */
59 ZIO_STAGE_VDEV_IO_DONE, /* RW--I */
60 ZIO_STAGE_VDEV_IO_ASSESS, /* RW--I */
61
62 ZIO_STAGE_CHECKSUM_VERIFY, /* R---- */
63
64 ZIO_STAGE_DONE, /* RWFCI */
65 ZIO_STAGES
66 } zio_stage_t;
67
68 #define ZIO_INTERLOCK_STAGES \
69 ((1U << ZIO_STAGE_READY) | \
70 (1U << ZIO_STAGE_DONE))
71
72 #define ZIO_INTERLOCK_PIPELINE \
73 ZIO_INTERLOCK_STAGES
74
75 #define ZIO_VDEV_IO_STAGES \
76 ((1U << ZIO_STAGE_VDEV_IO_START) | \
77 (1U << ZIO_STAGE_VDEV_IO_DONE) | \
78 (1U << ZIO_STAGE_VDEV_IO_ASSESS))
79
80 #define ZIO_VDEV_CHILD_PIPELINE \
81 (ZIO_VDEV_IO_STAGES | \
82 (1U << ZIO_STAGE_DONE))
83
84 #define ZIO_READ_COMMON_STAGES \
85 (ZIO_INTERLOCK_STAGES | \
86 ZIO_VDEV_IO_STAGES | \
87 (1U << ZIO_STAGE_CHECKSUM_VERIFY))
88
89 #define ZIO_READ_PHYS_PIPELINE \
90 ZIO_READ_COMMON_STAGES
91
92 #define ZIO_READ_PIPELINE \
93 (ZIO_READ_COMMON_STAGES | \
94 (1U << ZIO_STAGE_READ_BP_INIT))
95
96 #define ZIO_WRITE_COMMON_STAGES \
97 (ZIO_INTERLOCK_STAGES | \
98 ZIO_VDEV_IO_STAGES | \
99 (1U << ZIO_STAGE_ISSUE_ASYNC) | \
100 (1U << ZIO_STAGE_CHECKSUM_GENERATE))
101
102 #define ZIO_WRITE_PHYS_PIPELINE \
103 ZIO_WRITE_COMMON_STAGES
104
105 #define ZIO_REWRITE_PIPELINE \
106 (ZIO_WRITE_COMMON_STAGES | \
107 (1U << ZIO_STAGE_WRITE_BP_INIT))
108
109 #define ZIO_WRITE_PIPELINE \
110 (ZIO_WRITE_COMMON_STAGES | \
111 (1U << ZIO_STAGE_WRITE_BP_INIT) | \
112 (1U << ZIO_STAGE_DVA_ALLOCATE))
113
114 #define ZIO_GANG_STAGES \
115 ((1U << ZIO_STAGE_GANG_ASSEMBLE) | \
116 (1U << ZIO_STAGE_GANG_ISSUE))
117
118 #define ZIO_FREE_PIPELINE \
119 (ZIO_INTERLOCK_STAGES | \
120 (1U << ZIO_STAGE_DVA_FREE))
121
122 #define ZIO_CLAIM_PIPELINE \
123 (ZIO_INTERLOCK_STAGES | \
124 (1U << ZIO_STAGE_DVA_CLAIM))
125
126 #define ZIO_IOCTL_PIPELINE \
127 (ZIO_INTERLOCK_STAGES | \
128 (1U << ZIO_STAGE_VDEV_IO_START) | \
129 (1U << ZIO_STAGE_VDEV_IO_ASSESS))
130
131 #define ZIO_CONFIG_LOCK_BLOCKING_STAGES \
132 ((1U << ZIO_STAGE_VDEV_IO_START) | \
133 (1U << ZIO_STAGE_DVA_ALLOCATE) | \
134 (1U << ZIO_STAGE_DVA_CLAIM))
135
136 extern void zio_inject_init(void);
137 extern void zio_inject_fini(void);
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif /* _ZIO_IMPL_H */