Print this page
NEX-3558 KRRP Integration
NEX-3508 CLONE - Port NEX-2946 Add UNMAP/TRIM functionality to ZFS and illumos
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Conflicts:
usr/src/uts/common/io/scsi/targets/sd.c
usr/src/uts/common/sys/scsi/targets/sddef.h
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/zio_impl.h
+++ new/usr/src/uts/common/fs/zfs/sys/zio_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
|
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 28 * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
28 29 */
29 30
30 31 #ifndef _ZIO_IMPL_H
31 32 #define _ZIO_IMPL_H
32 33
33 34 #include <sys/zfs_context.h>
34 35 #include <sys/zio.h>
35 36
36 37 #ifdef __cplusplus
37 38 extern "C" {
38 39 #endif
39 40
40 41 /*
41 42 * XXX -- Describe ZFS I/O pipeline here. Fill in as needed.
42 43 *
43 44 * The ZFS I/O pipeline is comprised of various stages which are defined
44 45 * in the zio_stage enum below. The individual stages are used to construct
45 46 * these basic I/O operations: Read, Write, Free, Claim, and Ioctl.
46 47 *
47 48 * I/O operations: (XXX - provide detail for each of the operations)
48 49 *
49 50 * Read:
50 51 * Write:
51 52 * Free:
52 53 * Claim:
53 54 * Ioctl:
54 55 *
55 56 * Although the most common pipeline are used by the basic I/O operations
56 57 * above, there are some helper pipelines (one could consider them
57 58 * sub-pipelines) which are used internally by the ZIO module and are
58 59 * explained below:
59 60 *
60 61 * Interlock Pipeline:
61 62 * The interlock pipeline is the most basic pipeline and is used by all
62 63 * of the I/O operations. The interlock pipeline does not perform any I/O
63 64 * and is used to coordinate the dependencies between I/Os that are being
64 65 * issued (i.e. the parent/child relationship).
65 66 *
66 67 * Vdev child Pipeline:
67 68 * The vdev child pipeline is responsible for performing the physical I/O.
68 69 * It is in this pipeline where the I/O are queued and possibly cached.
69 70 *
70 71 * In addition to performing I/O, the pipeline is also responsible for
71 72 * data transformations. The transformations performed are based on the
72 73 * specific properties that user may have selected and modify the
73 74 * behavior of the pipeline. Examples of supported transformations are
74 75 * compression, dedup, and nop writes. Transformations will either modify
75 76 * the data or the pipeline. This list below further describes each of
76 77 * the supported transformations:
77 78 *
78 79 * Compression:
79 80 * ZFS supports three different flavors of compression -- gzip, lzjb, and
80 81 * zle. Compression occurs as part of the write pipeline and is performed
81 82 * in the ZIO_STAGE_WRITE_BP_INIT stage.
82 83 *
83 84 * Dedup:
84 85 * Dedup reads are handled by the ZIO_STAGE_DDT_READ_START and
85 86 * ZIO_STAGE_DDT_READ_DONE stages. These stages are added to an existing
86 87 * read pipeline if the dedup bit is set on the block pointer.
87 88 * Writing a dedup block is performed by the ZIO_STAGE_DDT_WRITE stage
88 89 * and added to a write pipeline if a user has enabled dedup on that
89 90 * particular dataset.
90 91 *
91 92 * NOP Write:
92 93 * The NOP write feature is performed by the ZIO_STAGE_NOP_WRITE stage
93 94 * and is added to an existing write pipeline if a crypographically
94 95 * secure checksum (i.e. SHA256) is enabled and compression is turned on.
95 96 * The NOP write stage will compare the checksums of the current data
96 97 * on-disk (level-0 blocks only) and the data that is currently being written.
97 98 * If the checksum values are identical then the pipeline is converted to
98 99 * an interlock pipeline skipping block allocation and bypassing the
99 100 * physical I/O. The nop write feature can handle writes in either
100 101 * syncing or open context (i.e. zil writes) and as a result is mutually
101 102 * exclusive with dedup.
102 103 */
103 104
104 105 /*
105 106 * zio pipeline stage definitions
106 107 */
107 108 enum zio_stage {
108 109 ZIO_STAGE_OPEN = 1 << 0, /* RWFCI */
109 110
110 111 ZIO_STAGE_READ_BP_INIT = 1 << 1, /* R---- */
111 112 ZIO_STAGE_WRITE_BP_INIT = 1 << 2, /* -W--- */
112 113 ZIO_STAGE_FREE_BP_INIT = 1 << 3, /* --F-- */
113 114 ZIO_STAGE_ISSUE_ASYNC = 1 << 4, /* RWF-- */
114 115 ZIO_STAGE_WRITE_COMPRESS = 1 << 5, /* -W--- */
115 116
116 117 ZIO_STAGE_CHECKSUM_GENERATE = 1 << 6, /* -W--- */
117 118
118 119 ZIO_STAGE_NOP_WRITE = 1 << 7, /* -W--- */
119 120
120 121 ZIO_STAGE_DDT_READ_START = 1 << 8, /* R---- */
121 122 ZIO_STAGE_DDT_READ_DONE = 1 << 9, /* R---- */
122 123 ZIO_STAGE_DDT_WRITE = 1 << 10, /* -W--- */
123 124 ZIO_STAGE_DDT_FREE = 1 << 11, /* --F-- */
124 125
125 126 ZIO_STAGE_GANG_ASSEMBLE = 1 << 12, /* RWFC- */
126 127 ZIO_STAGE_GANG_ISSUE = 1 << 13, /* RWFC- */
127 128
128 129 ZIO_STAGE_DVA_THROTTLE = 1 << 14, /* -W--- */
129 130 ZIO_STAGE_DVA_ALLOCATE = 1 << 15, /* -W--- */
130 131 ZIO_STAGE_DVA_FREE = 1 << 16, /* --F-- */
131 132 ZIO_STAGE_DVA_CLAIM = 1 << 17, /* ---C- */
132 133
133 134 ZIO_STAGE_READY = 1 << 18, /* RWFCI */
134 135
135 136 ZIO_STAGE_VDEV_IO_START = 1 << 19, /* RW--I */
136 137 ZIO_STAGE_VDEV_IO_DONE = 1 << 20, /* RW--I */
137 138 ZIO_STAGE_VDEV_IO_ASSESS = 1 << 21, /* RW--I */
138 139
139 140 ZIO_STAGE_CHECKSUM_VERIFY = 1 << 22, /* R---- */
140 141
141 142 ZIO_STAGE_DONE = 1 << 23 /* RWFCI */
142 143 };
143 144
144 145 #define ZIO_INTERLOCK_STAGES \
145 146 (ZIO_STAGE_READY | \
146 147 ZIO_STAGE_DONE)
147 148
148 149 #define ZIO_INTERLOCK_PIPELINE \
149 150 ZIO_INTERLOCK_STAGES
150 151
151 152 #define ZIO_VDEV_IO_STAGES \
152 153 (ZIO_STAGE_VDEV_IO_START | \
153 154 ZIO_STAGE_VDEV_IO_DONE | \
154 155 ZIO_STAGE_VDEV_IO_ASSESS)
155 156
156 157 #define ZIO_VDEV_CHILD_PIPELINE \
157 158 (ZIO_VDEV_IO_STAGES | \
158 159 ZIO_STAGE_DONE)
159 160
160 161 #define ZIO_READ_COMMON_STAGES \
161 162 (ZIO_INTERLOCK_STAGES | \
162 163 ZIO_VDEV_IO_STAGES | \
163 164 ZIO_STAGE_CHECKSUM_VERIFY)
164 165
165 166 #define ZIO_READ_PHYS_PIPELINE \
166 167 ZIO_READ_COMMON_STAGES
167 168
168 169 #define ZIO_READ_PIPELINE \
169 170 (ZIO_READ_COMMON_STAGES | \
170 171 ZIO_STAGE_READ_BP_INIT)
|
↓ open down ↓ |
134 lines elided |
↑ open up ↑ |
171 172
172 173 #define ZIO_DDT_CHILD_READ_PIPELINE \
173 174 ZIO_READ_COMMON_STAGES
174 175
175 176 #define ZIO_DDT_READ_PIPELINE \
176 177 (ZIO_INTERLOCK_STAGES | \
177 178 ZIO_STAGE_READ_BP_INIT | \
178 179 ZIO_STAGE_DDT_READ_START | \
179 180 ZIO_STAGE_DDT_READ_DONE)
180 181
182 +#define ZIO_MOVE_PIPELINE \
183 + (ZIO_INTERLOCK_STAGES | \
184 + ZIO_VDEV_IO_STAGES | \
185 + ZIO_STAGE_ISSUE_ASYNC | \
186 + ZIO_STAGE_WRITE_BP_INIT | \
187 + ZIO_STAGE_DVA_ALLOCATE)
188 +
181 189 #define ZIO_WRITE_COMMON_STAGES \
182 190 (ZIO_INTERLOCK_STAGES | \
183 191 ZIO_VDEV_IO_STAGES | \
184 192 ZIO_STAGE_ISSUE_ASYNC | \
185 193 ZIO_STAGE_CHECKSUM_GENERATE)
186 194
187 195 #define ZIO_WRITE_PHYS_PIPELINE \
188 196 ZIO_WRITE_COMMON_STAGES
189 197
190 198 #define ZIO_REWRITE_PIPELINE \
191 199 (ZIO_WRITE_COMMON_STAGES | \
192 200 ZIO_STAGE_WRITE_COMPRESS | \
193 201 ZIO_STAGE_WRITE_BP_INIT)
194 202
195 203 #define ZIO_WRITE_PIPELINE \
196 204 (ZIO_WRITE_COMMON_STAGES | \
197 205 ZIO_STAGE_WRITE_BP_INIT | \
198 206 ZIO_STAGE_WRITE_COMPRESS | \
199 207 ZIO_STAGE_DVA_THROTTLE | \
200 208 ZIO_STAGE_DVA_ALLOCATE)
201 209
202 210 #define ZIO_DDT_CHILD_WRITE_PIPELINE \
203 211 (ZIO_INTERLOCK_STAGES | \
204 212 ZIO_VDEV_IO_STAGES | \
205 213 ZIO_STAGE_DVA_THROTTLE | \
206 214 ZIO_STAGE_DVA_ALLOCATE)
207 215
208 216 #define ZIO_DDT_WRITE_PIPELINE \
209 217 (ZIO_INTERLOCK_STAGES | \
210 218 ZIO_STAGE_WRITE_BP_INIT | \
211 219 ZIO_STAGE_ISSUE_ASYNC | \
212 220 ZIO_STAGE_WRITE_COMPRESS | \
213 221 ZIO_STAGE_CHECKSUM_GENERATE | \
214 222 ZIO_STAGE_DDT_WRITE)
215 223
216 224 #define ZIO_GANG_STAGES \
217 225 (ZIO_STAGE_GANG_ASSEMBLE | \
218 226 ZIO_STAGE_GANG_ISSUE)
219 227
220 228 #define ZIO_FREE_PIPELINE \
221 229 (ZIO_INTERLOCK_STAGES | \
222 230 ZIO_STAGE_FREE_BP_INIT | \
223 231 ZIO_STAGE_DVA_FREE)
224 232
225 233 #define ZIO_DDT_FREE_PIPELINE \
226 234 (ZIO_INTERLOCK_STAGES | \
227 235 ZIO_STAGE_FREE_BP_INIT | \
228 236 ZIO_STAGE_ISSUE_ASYNC | \
|
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
229 237 ZIO_STAGE_DDT_FREE)
230 238
231 239 #define ZIO_CLAIM_PIPELINE \
232 240 (ZIO_INTERLOCK_STAGES | \
233 241 ZIO_STAGE_DVA_CLAIM)
234 242
235 243 #define ZIO_IOCTL_PIPELINE \
236 244 (ZIO_INTERLOCK_STAGES | \
237 245 ZIO_STAGE_VDEV_IO_START | \
238 246 ZIO_STAGE_VDEV_IO_ASSESS)
247 +
248 +#define ZIO_TRIM_PIPELINE \
249 + (ZIO_INTERLOCK_STAGES | \
250 + ZIO_STAGE_ISSUE_ASYNC | \
251 + ZIO_STAGE_VDEV_IO_START | \
252 + ZIO_STAGE_VDEV_IO_ASSESS)
239 253
240 254 #define ZIO_BLOCKING_STAGES \
241 255 (ZIO_STAGE_DVA_ALLOCATE | \
242 256 ZIO_STAGE_DVA_CLAIM | \
243 257 ZIO_STAGE_VDEV_IO_START)
244 258
245 259 extern void zio_inject_init(void);
246 260 extern void zio_inject_fini(void);
247 261
248 262 #ifdef __cplusplus
249 263 }
250 264 #endif
251 265
252 266 #endif /* _ZIO_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX