3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
[unleashed.git] / usr / src / uts / common / fs / zfs / sys / zio_impl.h
blob2d062d0915a6c90ff91ff6fa210d6ce42532f9d9
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Copyright (c) 2012 by Delphix. All rights reserved.
30 #ifndef _ZIO_IMPL_H
31 #define _ZIO_IMPL_H
33 #include <sys/zfs_context.h>
34 #include <sys/zio.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
41 * zio pipeline stage definitions
43 enum zio_stage {
44 ZIO_STAGE_OPEN = 1 << 0, /* RWFCI */
46 ZIO_STAGE_READ_BP_INIT = 1 << 1, /* R---- */
47 ZIO_STAGE_FREE_BP_INIT = 1 << 2, /* --F-- */
48 ZIO_STAGE_ISSUE_ASYNC = 1 << 3, /* RWF-- */
49 ZIO_STAGE_WRITE_BP_INIT = 1 << 4, /* -W--- */
51 ZIO_STAGE_CHECKSUM_GENERATE = 1 << 5, /* -W--- */
53 ZIO_STAGE_DDT_READ_START = 1 << 6, /* R---- */
54 ZIO_STAGE_DDT_READ_DONE = 1 << 7, /* R---- */
55 ZIO_STAGE_DDT_WRITE = 1 << 8, /* -W--- */
56 ZIO_STAGE_DDT_FREE = 1 << 9, /* --F-- */
58 ZIO_STAGE_GANG_ASSEMBLE = 1 << 10, /* RWFC- */
59 ZIO_STAGE_GANG_ISSUE = 1 << 11, /* RWFC- */
61 ZIO_STAGE_DVA_ALLOCATE = 1 << 12, /* -W--- */
62 ZIO_STAGE_DVA_FREE = 1 << 13, /* --F-- */
63 ZIO_STAGE_DVA_CLAIM = 1 << 14, /* ---C- */
65 ZIO_STAGE_READY = 1 << 15, /* RWFCI */
67 ZIO_STAGE_VDEV_IO_START = 1 << 16, /* RW--I */
68 ZIO_STAGE_VDEV_IO_DONE = 1 << 17, /* RW--I */
69 ZIO_STAGE_VDEV_IO_ASSESS = 1 << 18, /* RW--I */
71 ZIO_STAGE_CHECKSUM_VERIFY = 1 << 19, /* R---- */
73 ZIO_STAGE_DONE = 1 << 20 /* RWFCI */
76 #define ZIO_INTERLOCK_STAGES \
77 (ZIO_STAGE_READY | \
78 ZIO_STAGE_DONE)
80 #define ZIO_INTERLOCK_PIPELINE \
81 ZIO_INTERLOCK_STAGES
83 #define ZIO_VDEV_IO_STAGES \
84 (ZIO_STAGE_VDEV_IO_START | \
85 ZIO_STAGE_VDEV_IO_DONE | \
86 ZIO_STAGE_VDEV_IO_ASSESS)
88 #define ZIO_VDEV_CHILD_PIPELINE \
89 (ZIO_VDEV_IO_STAGES | \
90 ZIO_STAGE_DONE)
92 #define ZIO_READ_COMMON_STAGES \
93 (ZIO_INTERLOCK_STAGES | \
94 ZIO_VDEV_IO_STAGES | \
95 ZIO_STAGE_CHECKSUM_VERIFY)
97 #define ZIO_READ_PHYS_PIPELINE \
98 ZIO_READ_COMMON_STAGES
100 #define ZIO_READ_PIPELINE \
101 (ZIO_READ_COMMON_STAGES | \
102 ZIO_STAGE_READ_BP_INIT)
104 #define ZIO_DDT_CHILD_READ_PIPELINE \
105 ZIO_READ_COMMON_STAGES
107 #define ZIO_DDT_READ_PIPELINE \
108 (ZIO_INTERLOCK_STAGES | \
109 ZIO_STAGE_READ_BP_INIT | \
110 ZIO_STAGE_DDT_READ_START | \
111 ZIO_STAGE_DDT_READ_DONE)
113 #define ZIO_WRITE_COMMON_STAGES \
114 (ZIO_INTERLOCK_STAGES | \
115 ZIO_VDEV_IO_STAGES | \
116 ZIO_STAGE_ISSUE_ASYNC | \
117 ZIO_STAGE_CHECKSUM_GENERATE)
119 #define ZIO_WRITE_PHYS_PIPELINE \
120 ZIO_WRITE_COMMON_STAGES
122 #define ZIO_REWRITE_PIPELINE \
123 (ZIO_WRITE_COMMON_STAGES | \
124 ZIO_STAGE_WRITE_BP_INIT)
126 #define ZIO_WRITE_PIPELINE \
127 (ZIO_WRITE_COMMON_STAGES | \
128 ZIO_STAGE_WRITE_BP_INIT | \
129 ZIO_STAGE_DVA_ALLOCATE)
131 #define ZIO_DDT_CHILD_WRITE_PIPELINE \
132 (ZIO_INTERLOCK_STAGES | \
133 ZIO_VDEV_IO_STAGES | \
134 ZIO_STAGE_DVA_ALLOCATE)
136 #define ZIO_DDT_WRITE_PIPELINE \
137 (ZIO_INTERLOCK_STAGES | \
138 ZIO_STAGE_ISSUE_ASYNC | \
139 ZIO_STAGE_WRITE_BP_INIT | \
140 ZIO_STAGE_CHECKSUM_GENERATE | \
141 ZIO_STAGE_DDT_WRITE)
143 #define ZIO_GANG_STAGES \
144 (ZIO_STAGE_GANG_ASSEMBLE | \
145 ZIO_STAGE_GANG_ISSUE)
147 #define ZIO_FREE_PIPELINE \
148 (ZIO_INTERLOCK_STAGES | \
149 ZIO_STAGE_FREE_BP_INIT | \
150 ZIO_STAGE_ISSUE_ASYNC | \
151 ZIO_STAGE_DVA_FREE)
153 #define ZIO_DDT_FREE_PIPELINE \
154 (ZIO_INTERLOCK_STAGES | \
155 ZIO_STAGE_FREE_BP_INIT | \
156 ZIO_STAGE_ISSUE_ASYNC | \
157 ZIO_STAGE_DDT_FREE)
159 #define ZIO_CLAIM_PIPELINE \
160 (ZIO_INTERLOCK_STAGES | \
161 ZIO_STAGE_DVA_CLAIM)
163 #define ZIO_IOCTL_PIPELINE \
164 (ZIO_INTERLOCK_STAGES | \
165 ZIO_STAGE_VDEV_IO_START | \
166 ZIO_STAGE_VDEV_IO_ASSESS)
168 #define ZIO_BLOCKING_STAGES \
169 (ZIO_STAGE_DVA_ALLOCATE | \
170 ZIO_STAGE_DVA_CLAIM | \
171 ZIO_STAGE_VDEV_IO_START)
173 extern void zio_inject_init(void);
174 extern void zio_inject_fini(void);
176 #ifdef __cplusplus
178 #endif
180 #endif /* _ZIO_IMPL_H */