Print this page
Possibility to physically reserve space without writing leaf blocks
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/spa.h
+++ new/usr/src/uts/common/fs/zfs/sys/spa.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
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
24 24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 25 */
26 26
27 27 #ifndef _SYS_SPA_H
28 28 #define _SYS_SPA_H
29 29
30 30 #include <sys/avl.h>
31 31 #include <sys/zfs_context.h>
32 32 #include <sys/nvpair.h>
33 33 #include <sys/sysmacros.h>
34 34 #include <sys/types.h>
35 35 #include <sys/fs/zfs.h>
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
39 39 #endif
40 40
41 41 /*
42 42 * Forward references that lots of things need.
43 43 */
44 44 typedef struct spa spa_t;
45 45 typedef struct vdev vdev_t;
46 46 typedef struct metaslab metaslab_t;
47 47 typedef struct metaslab_group metaslab_group_t;
48 48 typedef struct metaslab_class metaslab_class_t;
49 49 typedef struct zio zio_t;
50 50 typedef struct zilog zilog_t;
51 51 typedef struct spa_aux_vdev spa_aux_vdev_t;
52 52 typedef struct ddt ddt_t;
53 53 typedef struct ddt_entry ddt_entry_t;
54 54 struct dsl_pool;
55 55 struct dsl_dataset;
56 56
57 57 /*
58 58 * General-purpose 32-bit and 64-bit bitfield encodings.
59 59 */
60 60 #define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len))
61 61 #define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len))
62 62 #define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low))
63 63 #define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low))
64 64
65 65 #define BF32_GET(x, low, len) BF32_DECODE(x, low, len)
66 66 #define BF64_GET(x, low, len) BF64_DECODE(x, low, len)
67 67
68 68 #define BF32_SET(x, low, len, val) do { \
69 69 ASSERT3U(val, <, 1U << (len)); \
70 70 ASSERT3U(low + len, <=, 32); \
71 71 (x) ^= BF32_ENCODE((x >> low) ^ (val), low, len); \
72 72 _NOTE(CONSTCOND) } while (0)
73 73
74 74 #define BF64_SET(x, low, len, val) do { \
75 75 ASSERT3U(val, <, 1ULL << (len)); \
76 76 ASSERT3U(low + len, <=, 64); \
77 77 ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)); \
78 78 _NOTE(CONSTCOND) } while (0)
79 79
80 80 #define BF32_GET_SB(x, low, len, shift, bias) \
81 81 ((BF32_GET(x, low, len) + (bias)) << (shift))
82 82 #define BF64_GET_SB(x, low, len, shift, bias) \
83 83 ((BF64_GET(x, low, len) + (bias)) << (shift))
84 84
85 85 #define BF32_SET_SB(x, low, len, shift, bias, val) do { \
86 86 ASSERT(IS_P2ALIGNED(val, 1U << shift)); \
87 87 ASSERT3S((val) >> (shift), >=, bias); \
88 88 BF32_SET(x, low, len, ((val) >> (shift)) - (bias)); \
89 89 _NOTE(CONSTCOND) } while (0)
90 90 #define BF64_SET_SB(x, low, len, shift, bias, val) do { \
91 91 ASSERT(IS_P2ALIGNED(val, 1ULL << shift)); \
92 92 ASSERT3S((val) >> (shift), >=, bias); \
93 93 BF64_SET(x, low, len, ((val) >> (shift)) - (bias)); \
94 94 _NOTE(CONSTCOND) } while (0)
95 95
96 96 /*
97 97 * We currently support nine block sizes, from 512 bytes to 128K.
98 98 * We could go higher, but the benefits are near-zero and the cost
99 99 * of COWing a giant block to modify one byte would become excessive.
100 100 */
101 101 #define SPA_MINBLOCKSHIFT 9
102 102 #define SPA_MAXBLOCKSHIFT 17
103 103 #define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
104 104 #define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
105 105
106 106 #define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
107 107
108 108 /*
109 109 * Size of block to hold the configuration data (a packed nvlist)
110 110 */
111 111 #define SPA_CONFIG_BLOCKSIZE (1ULL << 14)
112 112
113 113 /*
114 114 * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
115 115 * The ASIZE encoding should be at least 64 times larger (6 more bits)
116 116 * to support up to 4-way RAID-Z mirror mode with worst-case gang block
117 117 * overhead, three DVAs per bp, plus one more bit in case we do anything
118 118 * else that expands the ASIZE.
119 119 */
120 120 #define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */
121 121 #define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */
122 122 #define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */
123 123
124 124 /*
125 125 * All SPA data is represented by 128-bit data virtual addresses (DVAs).
126 126 * The members of the dva_t should be considered opaque outside the SPA.
127 127 */
128 128 typedef struct dva {
129 129 uint64_t dva_word[2];
130 130 } dva_t;
131 131
132 132 /*
133 133 * Each block has a 256-bit checksum -- strong enough for cryptographic hashes.
134 134 */
135 135 typedef struct zio_cksum {
136 136 uint64_t zc_word[4];
137 137 } zio_cksum_t;
138 138
139 139 /*
140 140 * Each block is described by its DVAs, time of birth, checksum, etc.
141 141 * The word-by-word, bit-by-bit layout of the blkptr is as follows:
142 142 *
143 143 * 64 56 48 40 32 24 16 8 0
144 144 * +-------+-------+-------+-------+-------+-------+-------+-------+
145 145 * 0 | vdev1 | GRID | ASIZE |
146 146 * +-------+-------+-------+-------+-------+-------+-------+-------+
147 147 * 1 |G| offset1 |
148 148 * +-------+-------+-------+-------+-------+-------+-------+-------+
149 149 * 2 | vdev2 | GRID | ASIZE |
150 150 * +-------+-------+-------+-------+-------+-------+-------+-------+
151 151 * 3 |G| offset2 |
152 152 * +-------+-------+-------+-------+-------+-------+-------+-------+
153 153 * 4 | vdev3 | GRID | ASIZE |
154 154 * +-------+-------+-------+-------+-------+-------+-------+-------+
155 155 * 5 |G| offset3 |
156 156 * +-------+-------+-------+-------+-------+-------+-------+-------+
157 157 * 6 |BDX|lvl| type | cksum |E| comp| PSIZE | LSIZE |
158 158 * +-------+-------+-------+-------+-------+-------+-------+-------+
159 159 * 7 | padding |
160 160 * +-------+-------+-------+-------+-------+-------+-------+-------+
161 161 * 8 | padding |
162 162 * +-------+-------+-------+-------+-------+-------+-------+-------+
163 163 * 9 | physical birth txg |
164 164 * +-------+-------+-------+-------+-------+-------+-------+-------+
165 165 * a | logical birth txg |
166 166 * +-------+-------+-------+-------+-------+-------+-------+-------+
167 167 * b | fill count |
168 168 * +-------+-------+-------+-------+-------+-------+-------+-------+
169 169 * c | checksum[0] |
170 170 * +-------+-------+-------+-------+-------+-------+-------+-------+
171 171 * d | checksum[1] |
172 172 * +-------+-------+-------+-------+-------+-------+-------+-------+
173 173 * e | checksum[2] |
174 174 * +-------+-------+-------+-------+-------+-------+-------+-------+
175 175 * f | checksum[3] |
176 176 * +-------+-------+-------+-------+-------+-------+-------+-------+
177 177 *
178 178 * Legend:
179 179 *
180 180 * vdev virtual device ID
181 181 * offset offset into virtual device
182 182 * LSIZE logical size
183 183 * PSIZE physical size (after compression)
184 184 * ASIZE allocated size (including RAID-Z parity and gang block headers)
185 185 * GRID RAID-Z layout information (reserved for future use)
186 186 * cksum checksum function
187 187 * comp compression function
188 188 * G gang block indicator
189 189 * B byteorder (endianness)
190 190 * D dedup
191 191 * X encryption (on version 30, which is not supported)
192 192 * E blkptr_t contains embedded data (see below)
193 193 * lvl level of indirection
194 194 * type DMU object type
195 195 * phys birth txg of block allocation; zero if same as logical birth txg
196 196 * log. birth transaction group in which the block was logically born
197 197 * fill count number of non-zero blocks under this bp
198 198 * checksum[4] 256-bit checksum of the data this bp describes
199 199 */
200 200
201 201 /*
202 202 * "Embedded" blkptr_t's don't actually point to a block, instead they
203 203 * have a data payload embedded in the blkptr_t itself. See the comment
204 204 * in blkptr.c for more details.
205 205 *
206 206 * The blkptr_t is laid out as follows:
207 207 *
208 208 * 64 56 48 40 32 24 16 8 0
209 209 * +-------+-------+-------+-------+-------+-------+-------+-------+
210 210 * 0 | payload |
211 211 * 1 | payload |
212 212 * 2 | payload |
213 213 * 3 | payload |
214 214 * 4 | payload |
215 215 * 5 | payload |
216 216 * +-------+-------+-------+-------+-------+-------+-------+-------+
217 217 * 6 |BDX|lvl| type | etype |E| comp| PSIZE| LSIZE |
218 218 * +-------+-------+-------+-------+-------+-------+-------+-------+
219 219 * 7 | payload |
220 220 * 8 | payload |
221 221 * 9 | payload |
222 222 * +-------+-------+-------+-------+-------+-------+-------+-------+
223 223 * a | logical birth txg |
224 224 * +-------+-------+-------+-------+-------+-------+-------+-------+
225 225 * b | payload |
226 226 * c | payload |
227 227 * d | payload |
228 228 * e | payload |
229 229 * f | payload |
230 230 * +-------+-------+-------+-------+-------+-------+-------+-------+
231 231 *
232 232 * Legend:
233 233 *
234 234 * payload contains the embedded data
235 235 * B (byteorder) byteorder (endianness)
236 236 * D (dedup) padding (set to zero)
237 237 * X encryption (set to zero; see above)
238 238 * E (embedded) set to one
239 239 * lvl indirection level
240 240 * type DMU object type
241 241 * etype how to interpret embedded data (BP_EMBEDDED_TYPE_*)
242 242 * comp compression function of payload
243 243 * PSIZE size of payload after compression, in bytes
244 244 * LSIZE logical size of payload, in bytes
245 245 * note that 25 bits is enough to store the largest
246 246 * "normal" BP's LSIZE (2^16 * 2^9) in bytes
247 247 * log. birth transaction group in which the block was logically born
248 248 *
249 249 * Note that LSIZE and PSIZE are stored in bytes, whereas for non-embedded
250 250 * bp's they are stored in units of SPA_MINBLOCKSHIFT.
251 251 * Generally, the generic BP_GET_*() macros can be used on embedded BP's.
252 252 * The B, D, X, lvl, type, and comp fields are stored the same as with normal
253 253 * BP's so the BP_SET_* macros can be used with them. etype, PSIZE, LSIZE must
254 254 * be set with the BPE_SET_* macros. BP_SET_EMBEDDED() should be called before
255 255 * other macros, as they assert that they are only used on BP's of the correct
256 256 * "embedded-ness".
257 257 */
258 258
259 259 #define BPE_GET_ETYPE(bp) \
260 260 (ASSERT(BP_IS_EMBEDDED(bp)), \
261 261 BF64_GET((bp)->blk_prop, 40, 8))
262 262 #define BPE_SET_ETYPE(bp, t) do { \
263 263 ASSERT(BP_IS_EMBEDDED(bp)); \
264 264 BF64_SET((bp)->blk_prop, 40, 8, t); \
265 265 _NOTE(CONSTCOND) } while (0)
266 266
267 267 #define BPE_GET_LSIZE(bp) \
268 268 (ASSERT(BP_IS_EMBEDDED(bp)), \
269 269 BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1))
270 270 #define BPE_SET_LSIZE(bp, x) do { \
271 271 ASSERT(BP_IS_EMBEDDED(bp)); \
272 272 BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \
273 273 _NOTE(CONSTCOND) } while (0)
274 274
275 275 #define BPE_GET_PSIZE(bp) \
276 276 (ASSERT(BP_IS_EMBEDDED(bp)), \
277 277 BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1))
278 278 #define BPE_SET_PSIZE(bp, x) do { \
279 279 ASSERT(BP_IS_EMBEDDED(bp)); \
280 280 BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \
281 281 _NOTE(CONSTCOND) } while (0)
282 282
283 283 typedef enum bp_embedded_type {
284 284 BP_EMBEDDED_TYPE_DATA,
285 285 BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */
286 286 NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED
287 287 } bp_embedded_type_t;
288 288
289 289 #define BPE_NUM_WORDS 14
290 290 #define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t))
291 291 #define BPE_IS_PAYLOADWORD(bp, wp) \
292 292 ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
293 293
294 294 #define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */
295 295 #define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */
296 296
297 297 /*
298 298 * A block is a hole when it has either 1) never been written to, or
299 299 * 2) is zero-filled. In both cases, ZFS can return all zeroes for all reads
300 300 * without physically allocating disk space. Holes are represented in the
301 301 * blkptr_t structure by zeroed blk_dva. Correct checking for holes is
302 302 * done through the BP_IS_HOLE macro. For holes, the logical size, level,
303 303 * DMU object type, and birth times are all also stored for holes that
304 304 * were written to at some point (i.e. were punched after having been filled).
305 305 */
306 306 typedef struct blkptr {
307 307 dva_t blk_dva[SPA_DVAS_PER_BP]; /* Data Virtual Addresses */
308 308 uint64_t blk_prop; /* size, compression, type, etc */
309 309 uint64_t blk_pad[2]; /* Extra space for the future */
310 310 uint64_t blk_phys_birth; /* txg when block was allocated */
311 311 uint64_t blk_birth; /* transaction group at birth */
312 312 uint64_t blk_fill; /* fill count */
313 313 zio_cksum_t blk_cksum; /* 256-bit checksum */
314 314 } blkptr_t;
315 315
316 316 /*
317 317 * Macros to get and set fields in a bp or DVA.
318 318 */
319 319 #define DVA_GET_ASIZE(dva) \
320 320 BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0)
321 321 #define DVA_SET_ASIZE(dva, x) \
322 322 BF64_SET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, \
323 323 SPA_MINBLOCKSHIFT, 0, x)
324 324
325 325 #define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8)
326 326 #define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x)
327 327
328 328 #define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32)
329 329 #define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x)
330 330
331 331 #define DVA_GET_OFFSET(dva) \
332 332 BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0)
333 333 #define DVA_SET_OFFSET(dva, x) \
334 334 BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x)
335 335
336 336 #define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1)
337 337 #define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
338 338
339 339 #define BP_GET_LSIZE(bp) \
340 340 (BP_IS_EMBEDDED(bp) ? \
341 341 (BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \
342 342 BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1))
343 343 #define BP_SET_LSIZE(bp, x) do { \
344 344 ASSERT(!BP_IS_EMBEDDED(bp)); \
345 345 BF64_SET_SB((bp)->blk_prop, \
346 346 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \
347 347 _NOTE(CONSTCOND) } while (0)
348 348
349 349 #define BP_GET_PSIZE(bp) \
350 350 (BP_IS_EMBEDDED(bp) ? 0 : \
351 351 BF64_GET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1))
352 352 #define BP_SET_PSIZE(bp, x) do { \
353 353 ASSERT(!BP_IS_EMBEDDED(bp)); \
354 354 BF64_SET_SB((bp)->blk_prop, \
355 355 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \
356 356 _NOTE(CONSTCOND) } while (0)
357 357
358 358 #define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7)
359 359 #define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x)
360 360
361 361 #define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1)
362 362 #define BP_SET_EMBEDDED(bp, x) BF64_SET((bp)->blk_prop, 39, 1, x)
363 363
364 364 #define BP_GET_CHECKSUM(bp) \
365 365 (BP_IS_EMBEDDED(bp) ? ZIO_CHECKSUM_OFF : \
366 366 BF64_GET((bp)->blk_prop, 40, 8))
367 367 #define BP_SET_CHECKSUM(bp, x) do { \
↓ open down ↓ |
367 lines elided |
↑ open up ↑ |
368 368 ASSERT(!BP_IS_EMBEDDED(bp)); \
369 369 BF64_SET((bp)->blk_prop, 40, 8, x); \
370 370 _NOTE(CONSTCOND) } while (0)
371 371
372 372 #define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8)
373 373 #define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x)
374 374
375 375 #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5)
376 376 #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x)
377 377
378 +#define BP_GET_PROP_RESERVATION(bp) BF64_GET((bp)->blk_prop, 61, 1)
379 +#define BP_SET_PROP_RESERVATION(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x)
380 +
378 381 #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1)
379 382 #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x)
380 383
381 384 #define BP_GET_BYTEORDER(bp) BF64_GET((bp)->blk_prop, 63, 1)
382 385 #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
383 386
384 387 #define BP_PHYSICAL_BIRTH(bp) \
385 388 (BP_IS_EMBEDDED(bp) ? 0 : \
386 389 (bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
387 390
388 391 #define BP_SET_BIRTH(bp, logical, physical) \
389 392 { \
390 393 ASSERT(!BP_IS_EMBEDDED(bp)); \
391 394 (bp)->blk_birth = (logical); \
392 395 (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
393 396 }
394 397
395 398 #define BP_GET_FILL(bp) (BP_IS_EMBEDDED(bp) ? 1 : (bp)->blk_fill)
396 399
397 400 #define BP_GET_ASIZE(bp) \
398 401 (BP_IS_EMBEDDED(bp) ? 0 : \
399 402 DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
400 403 DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
401 404 DVA_GET_ASIZE(&(bp)->blk_dva[2]))
402 405
403 406 #define BP_GET_UCSIZE(bp) \
404 407 ((BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp))) ? \
405 408 BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp))
406 409
407 410 #define BP_GET_NDVAS(bp) \
408 411 (BP_IS_EMBEDDED(bp) ? 0 : \
409 412 !!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
410 413 !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
411 414 !!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
412 415
413 416 #define BP_COUNT_GANG(bp) \
414 417 (BP_IS_EMBEDDED(bp) ? 0 : \
415 418 (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
416 419 DVA_GET_GANG(&(bp)->blk_dva[1]) + \
417 420 DVA_GET_GANG(&(bp)->blk_dva[2])))
418 421
419 422 #define DVA_EQUAL(dva1, dva2) \
420 423 ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
421 424 (dva1)->dva_word[0] == (dva2)->dva_word[0])
422 425
423 426 #define BP_EQUAL(bp1, bp2) \
424 427 (BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) && \
425 428 (bp1)->blk_birth == (bp2)->blk_birth && \
426 429 DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) && \
427 430 DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) && \
428 431 DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
429 432
430 433 #define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
431 434 (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
432 435 ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
433 436 ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
434 437 ((zc1).zc_word[3] - (zc2).zc_word[3])))
435 438
436 439 #define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0)
437 440
438 441 #define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \
439 442 { \
440 443 (zcp)->zc_word[0] = w0; \
441 444 (zcp)->zc_word[1] = w1; \
442 445 (zcp)->zc_word[2] = w2; \
443 446 (zcp)->zc_word[3] = w3; \
444 447 }
445 448
446 449 #define BP_IDENTITY(bp) (ASSERT(!BP_IS_EMBEDDED(bp)), &(bp)->blk_dva[0])
447 450 #define BP_IS_GANG(bp) \
448 451 (BP_IS_EMBEDDED(bp) ? B_FALSE : DVA_GET_GANG(BP_IDENTITY(bp)))
449 452 #define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \
450 453 (dva)->dva_word[1] == 0ULL)
451 454 #define BP_IS_HOLE(bp) \
452 455 (!BP_IS_EMBEDDED(bp) && DVA_IS_EMPTY(BP_IDENTITY(bp)))
453 456
454 457 /* BP_IS_RAIDZ(bp) assumes no block compression */
455 458 #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
456 459 BP_GET_PSIZE(bp))
457 460
458 461 #define BP_ZERO(bp) \
459 462 { \
460 463 (bp)->blk_dva[0].dva_word[0] = 0; \
461 464 (bp)->blk_dva[0].dva_word[1] = 0; \
462 465 (bp)->blk_dva[1].dva_word[0] = 0; \
463 466 (bp)->blk_dva[1].dva_word[1] = 0; \
464 467 (bp)->blk_dva[2].dva_word[0] = 0; \
465 468 (bp)->blk_dva[2].dva_word[1] = 0; \
466 469 (bp)->blk_prop = 0; \
467 470 (bp)->blk_pad[0] = 0; \
468 471 (bp)->blk_pad[1] = 0; \
469 472 (bp)->blk_phys_birth = 0; \
470 473 (bp)->blk_birth = 0; \
471 474 (bp)->blk_fill = 0; \
472 475 ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
473 476 }
474 477
475 478 #ifdef _BIG_ENDIAN
476 479 #define ZFS_HOST_BYTEORDER (0ULL)
477 480 #else
478 481 #define ZFS_HOST_BYTEORDER (1ULL)
479 482 #endif
480 483
481 484 #define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER)
482 485
483 486 #define BP_SPRINTF_LEN 320
484 487
485 488 /*
486 489 * This macro allows code sharing between zfs, libzpool, and mdb.
487 490 * 'func' is either snprintf() or mdb_snprintf().
488 491 * 'ws' (whitespace) can be ' ' for single-line format, '\n' for multi-line.
489 492 */
490 493 #define SNPRINTF_BLKPTR(func, ws, buf, size, bp, type, checksum, compress) \
491 494 { \
492 495 static const char *copyname[] = \
493 496 { "zero", "single", "double", "triple" }; \
494 497 int len = 0; \
495 498 int copies = 0; \
496 499 \
497 500 if (bp == NULL) { \
498 501 len += func(buf + len, size - len, "<NULL>"); \
499 502 } else if (BP_IS_HOLE(bp)) { \
500 503 len += func(buf + len, size - len, "<hole>"); \
501 504 if (bp->blk_birth > 0) { \
502 505 len += func(buf + len, size - len, \
503 506 " birth=%lluL", \
504 507 (u_longlong_t)bp->blk_birth); \
505 508 } \
506 509 } else if (BP_IS_EMBEDDED(bp)) { \
507 510 len = func(buf + len, size - len, \
508 511 "EMBEDDED [L%llu %s] et=%u %s " \
509 512 "size=%llxL/%llxP birth=%lluL", \
510 513 (u_longlong_t)BP_GET_LEVEL(bp), \
511 514 type, \
512 515 (int)BPE_GET_ETYPE(bp), \
513 516 compress, \
514 517 (u_longlong_t)BPE_GET_LSIZE(bp), \
515 518 (u_longlong_t)BPE_GET_PSIZE(bp), \
516 519 (u_longlong_t)bp->blk_birth); \
517 520 } else { \
518 521 for (int d = 0; d < BP_GET_NDVAS(bp); d++) { \
519 522 const dva_t *dva = &bp->blk_dva[d]; \
520 523 if (DVA_IS_VALID(dva)) \
521 524 copies++; \
522 525 len += func(buf + len, size - len, \
523 526 "DVA[%d]=<%llu:%llx:%llx>%c", d, \
524 527 (u_longlong_t)DVA_GET_VDEV(dva), \
525 528 (u_longlong_t)DVA_GET_OFFSET(dva), \
526 529 (u_longlong_t)DVA_GET_ASIZE(dva), \
527 530 ws); \
528 531 } \
529 532 if (BP_IS_GANG(bp) && \
530 533 DVA_GET_ASIZE(&bp->blk_dva[2]) <= \
531 534 DVA_GET_ASIZE(&bp->blk_dva[1]) / 2) \
532 535 copies--; \
533 536 len += func(buf + len, size - len, \
534 537 "[L%llu %s] %s %s %s %s %s %s%c" \
535 538 "size=%llxL/%llxP birth=%lluL/%lluP fill=%llu%c" \
536 539 "cksum=%llx:%llx:%llx:%llx", \
537 540 (u_longlong_t)BP_GET_LEVEL(bp), \
538 541 type, \
539 542 checksum, \
540 543 compress, \
541 544 BP_GET_BYTEORDER(bp) == 0 ? "BE" : "LE", \
542 545 BP_IS_GANG(bp) ? "gang" : "contiguous", \
543 546 BP_GET_DEDUP(bp) ? "dedup" : "unique", \
544 547 copyname[copies], \
545 548 ws, \
546 549 (u_longlong_t)BP_GET_LSIZE(bp), \
547 550 (u_longlong_t)BP_GET_PSIZE(bp), \
548 551 (u_longlong_t)bp->blk_birth, \
549 552 (u_longlong_t)BP_PHYSICAL_BIRTH(bp), \
550 553 (u_longlong_t)BP_GET_FILL(bp), \
551 554 ws, \
552 555 (u_longlong_t)bp->blk_cksum.zc_word[0], \
553 556 (u_longlong_t)bp->blk_cksum.zc_word[1], \
554 557 (u_longlong_t)bp->blk_cksum.zc_word[2], \
555 558 (u_longlong_t)bp->blk_cksum.zc_word[3]); \
556 559 } \
557 560 ASSERT(len < size); \
558 561 }
559 562
560 563 #include <sys/dmu.h>
561 564
562 565 #define BP_GET_BUFC_TYPE(bp) \
563 566 (((BP_GET_LEVEL(bp) > 0) || (DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))) ? \
564 567 ARC_BUFC_METADATA : ARC_BUFC_DATA)
565 568
566 569 typedef enum spa_import_type {
567 570 SPA_IMPORT_EXISTING,
568 571 SPA_IMPORT_ASSEMBLE
569 572 } spa_import_type_t;
570 573
571 574 /* state manipulation functions */
572 575 extern int spa_open(const char *pool, spa_t **, void *tag);
573 576 extern int spa_open_rewind(const char *pool, spa_t **, void *tag,
574 577 nvlist_t *policy, nvlist_t **config);
575 578 extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
576 579 size_t buflen);
577 580 extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
578 581 nvlist_t *zplprops);
579 582 extern int spa_import_rootpool(char *devpath, char *devid);
580 583 extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props,
581 584 uint64_t flags);
582 585 extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
583 586 extern int spa_destroy(char *pool);
584 587 extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
585 588 boolean_t hardforce);
586 589 extern int spa_reset(char *pool);
587 590 extern void spa_async_request(spa_t *spa, int flag);
588 591 extern void spa_async_unrequest(spa_t *spa, int flag);
589 592 extern void spa_async_suspend(spa_t *spa);
590 593 extern void spa_async_resume(spa_t *spa);
591 594 extern spa_t *spa_inject_addref(char *pool);
592 595 extern void spa_inject_delref(spa_t *spa);
593 596 extern void spa_scan_stat_init(spa_t *spa);
594 597 extern int spa_scan_get_stats(spa_t *spa, pool_scan_stat_t *ps);
595 598
596 599 #define SPA_ASYNC_CONFIG_UPDATE 0x01
597 600 #define SPA_ASYNC_REMOVE 0x02
598 601 #define SPA_ASYNC_PROBE 0x04
599 602 #define SPA_ASYNC_RESILVER_DONE 0x08
600 603 #define SPA_ASYNC_RESILVER 0x10
601 604 #define SPA_ASYNC_AUTOEXPAND 0x20
602 605 #define SPA_ASYNC_REMOVE_DONE 0x40
603 606 #define SPA_ASYNC_REMOVE_STOP 0x80
604 607
605 608 /*
606 609 * Controls the behavior of spa_vdev_remove().
607 610 */
608 611 #define SPA_REMOVE_UNSPARE 0x01
609 612 #define SPA_REMOVE_DONE 0x02
610 613
611 614 /* device manipulation */
612 615 extern int spa_vdev_add(spa_t *spa, nvlist_t *nvroot);
613 616 extern int spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot,
614 617 int replacing);
615 618 extern int spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid,
616 619 int replace_done);
617 620 extern int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare);
618 621 extern boolean_t spa_vdev_remove_active(spa_t *spa);
619 622 extern int spa_vdev_setpath(spa_t *spa, uint64_t guid, const char *newpath);
620 623 extern int spa_vdev_setfru(spa_t *spa, uint64_t guid, const char *newfru);
621 624 extern int spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
622 625 nvlist_t *props, boolean_t exp);
623 626
624 627 /* spare state (which is global across all pools) */
625 628 extern void spa_spare_add(vdev_t *vd);
626 629 extern void spa_spare_remove(vdev_t *vd);
627 630 extern boolean_t spa_spare_exists(uint64_t guid, uint64_t *pool, int *refcnt);
628 631 extern void spa_spare_activate(vdev_t *vd);
629 632
630 633 /* L2ARC state (which is global across all pools) */
631 634 extern void spa_l2cache_add(vdev_t *vd);
632 635 extern void spa_l2cache_remove(vdev_t *vd);
633 636 extern boolean_t spa_l2cache_exists(uint64_t guid, uint64_t *pool);
634 637 extern void spa_l2cache_activate(vdev_t *vd);
635 638 extern void spa_l2cache_drop(spa_t *spa);
636 639
637 640 /* scanning */
638 641 extern int spa_scan(spa_t *spa, pool_scan_func_t func);
639 642 extern int spa_scan_stop(spa_t *spa);
640 643
641 644 /* spa syncing */
642 645 extern void spa_sync(spa_t *spa, uint64_t txg); /* only for DMU use */
643 646 extern void spa_sync_allpools(void);
644 647
645 648 /* spa namespace global mutex */
646 649 extern kmutex_t spa_namespace_lock;
647 650
648 651 /*
649 652 * SPA configuration functions in spa_config.c
650 653 */
651 654
652 655 #define SPA_CONFIG_UPDATE_POOL 0
653 656 #define SPA_CONFIG_UPDATE_VDEVS 1
654 657
655 658 extern void spa_config_sync(spa_t *, boolean_t, boolean_t);
656 659 extern void spa_config_load(void);
657 660 extern nvlist_t *spa_all_configs(uint64_t *);
658 661 extern void spa_config_set(spa_t *spa, nvlist_t *config);
659 662 extern nvlist_t *spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg,
660 663 int getstats);
661 664 extern void spa_config_update(spa_t *spa, int what);
662 665
663 666 /*
664 667 * Miscellaneous SPA routines in spa_misc.c
665 668 */
666 669
667 670 /* Namespace manipulation */
668 671 extern spa_t *spa_lookup(const char *name);
669 672 extern spa_t *spa_add(const char *name, nvlist_t *config, const char *altroot);
670 673 extern void spa_remove(spa_t *spa);
671 674 extern spa_t *spa_next(spa_t *prev);
672 675
673 676 /* Refcount functions */
674 677 extern void spa_open_ref(spa_t *spa, void *tag);
675 678 extern void spa_close(spa_t *spa, void *tag);
676 679 extern boolean_t spa_refcount_zero(spa_t *spa);
677 680
678 681 #define SCL_NONE 0x00
679 682 #define SCL_CONFIG 0x01
680 683 #define SCL_STATE 0x02
681 684 #define SCL_L2ARC 0x04 /* hack until L2ARC 2.0 */
682 685 #define SCL_ALLOC 0x08
683 686 #define SCL_ZIO 0x10
684 687 #define SCL_FREE 0x20
685 688 #define SCL_VDEV 0x40
686 689 #define SCL_LOCKS 7
687 690 #define SCL_ALL ((1 << SCL_LOCKS) - 1)
688 691 #define SCL_STATE_ALL (SCL_STATE | SCL_L2ARC | SCL_ZIO)
689 692
690 693 /* Pool configuration locks */
691 694 extern int spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw);
692 695 extern void spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw);
693 696 extern void spa_config_exit(spa_t *spa, int locks, void *tag);
694 697 extern int spa_config_held(spa_t *spa, int locks, krw_t rw);
695 698
696 699 /* Pool vdev add/remove lock */
697 700 extern uint64_t spa_vdev_enter(spa_t *spa);
698 701 extern uint64_t spa_vdev_config_enter(spa_t *spa);
699 702 extern void spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg,
700 703 int error, char *tag);
701 704 extern int spa_vdev_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error);
702 705
703 706 /* Pool vdev state change lock */
704 707 extern void spa_vdev_state_enter(spa_t *spa, int oplock);
705 708 extern int spa_vdev_state_exit(spa_t *spa, vdev_t *vd, int error);
706 709
707 710 /* Log state */
708 711 typedef enum spa_log_state {
709 712 SPA_LOG_UNKNOWN = 0, /* unknown log state */
710 713 SPA_LOG_MISSING, /* missing log(s) */
711 714 SPA_LOG_CLEAR, /* clear the log(s) */
712 715 SPA_LOG_GOOD, /* log(s) are good */
713 716 } spa_log_state_t;
714 717
715 718 extern spa_log_state_t spa_get_log_state(spa_t *spa);
716 719 extern void spa_set_log_state(spa_t *spa, spa_log_state_t state);
717 720 extern int spa_offline_log(spa_t *spa);
718 721
719 722 /* Log claim callback */
720 723 extern void spa_claim_notify(zio_t *zio);
721 724
722 725 /* Accessor functions */
723 726 extern boolean_t spa_shutting_down(spa_t *spa);
724 727 extern struct dsl_pool *spa_get_dsl(spa_t *spa);
725 728 extern boolean_t spa_is_initializing(spa_t *spa);
726 729 extern blkptr_t *spa_get_rootblkptr(spa_t *spa);
727 730 extern void spa_set_rootblkptr(spa_t *spa, const blkptr_t *bp);
728 731 extern void spa_altroot(spa_t *, char *, size_t);
729 732 extern int spa_sync_pass(spa_t *spa);
730 733 extern char *spa_name(spa_t *spa);
731 734 extern uint64_t spa_guid(spa_t *spa);
732 735 extern uint64_t spa_load_guid(spa_t *spa);
733 736 extern uint64_t spa_last_synced_txg(spa_t *spa);
734 737 extern uint64_t spa_first_txg(spa_t *spa);
735 738 extern uint64_t spa_syncing_txg(spa_t *spa);
736 739 extern uint64_t spa_version(spa_t *spa);
737 740 extern pool_state_t spa_state(spa_t *spa);
738 741 extern spa_load_state_t spa_load_state(spa_t *spa);
739 742 extern uint64_t spa_freeze_txg(spa_t *spa);
740 743 extern uint64_t spa_get_asize(spa_t *spa, uint64_t lsize);
741 744 extern uint64_t spa_get_dspace(spa_t *spa);
742 745 extern uint64_t spa_get_slop_space(spa_t *spa);
743 746 extern void spa_update_dspace(spa_t *spa);
744 747 extern uint64_t spa_version(spa_t *spa);
745 748 extern boolean_t spa_deflate(spa_t *spa);
746 749 extern metaslab_class_t *spa_normal_class(spa_t *spa);
747 750 extern metaslab_class_t *spa_log_class(spa_t *spa);
748 751 extern int spa_max_replication(spa_t *spa);
749 752 extern int spa_prev_software_version(spa_t *spa);
750 753 extern int spa_busy(void);
751 754 extern uint8_t spa_get_failmode(spa_t *spa);
752 755 extern boolean_t spa_suspended(spa_t *spa);
753 756 extern uint64_t spa_bootfs(spa_t *spa);
754 757 extern uint64_t spa_delegation(spa_t *spa);
755 758 extern objset_t *spa_meta_objset(spa_t *spa);
756 759 extern uint64_t spa_deadman_synctime(spa_t *spa);
757 760
758 761 /* Miscellaneous support routines */
759 762 extern void spa_activate_mos_feature(spa_t *spa, const char *feature,
760 763 dmu_tx_t *tx);
761 764 extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature);
762 765 extern int spa_rename(const char *oldname, const char *newname);
763 766 extern spa_t *spa_by_guid(uint64_t pool_guid, uint64_t device_guid);
764 767 extern boolean_t spa_guid_exists(uint64_t pool_guid, uint64_t device_guid);
765 768 extern char *spa_strdup(const char *);
766 769 extern void spa_strfree(char *);
767 770 extern uint64_t spa_get_random(uint64_t range);
768 771 extern uint64_t spa_generate_guid(spa_t *spa);
769 772 extern void snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp);
770 773 extern void spa_freeze(spa_t *spa);
771 774 extern int spa_change_guid(spa_t *spa);
772 775 extern void spa_upgrade(spa_t *spa, uint64_t version);
773 776 extern void spa_evict_all(void);
774 777 extern vdev_t *spa_lookup_by_guid(spa_t *spa, uint64_t guid,
775 778 boolean_t l2cache);
776 779 extern boolean_t spa_has_spare(spa_t *, uint64_t guid);
777 780 extern uint64_t dva_get_dsize_sync(spa_t *spa, const dva_t *dva);
778 781 extern uint64_t bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp);
779 782 extern uint64_t bp_get_dsize(spa_t *spa, const blkptr_t *bp);
780 783 extern boolean_t spa_has_slogs(spa_t *spa);
781 784 extern boolean_t spa_is_root(spa_t *spa);
782 785 extern boolean_t spa_writeable(spa_t *spa);
783 786 extern boolean_t spa_has_pending_synctask(spa_t *spa);
784 787
785 788 extern int spa_mode(spa_t *spa);
786 789 extern uint64_t strtonum(const char *str, char **nptr);
787 790
788 791 extern char *spa_his_ievent_table[];
789 792
790 793 extern void spa_history_create_obj(spa_t *spa, dmu_tx_t *tx);
791 794 extern int spa_history_get(spa_t *spa, uint64_t *offset, uint64_t *len_read,
792 795 char *his_buf);
793 796 extern int spa_history_log(spa_t *spa, const char *his_buf);
794 797 extern int spa_history_log_nvl(spa_t *spa, nvlist_t *nvl);
795 798 extern void spa_history_log_version(spa_t *spa, const char *operation);
796 799 extern void spa_history_log_internal(spa_t *spa, const char *operation,
797 800 dmu_tx_t *tx, const char *fmt, ...);
798 801 extern void spa_history_log_internal_ds(struct dsl_dataset *ds, const char *op,
799 802 dmu_tx_t *tx, const char *fmt, ...);
800 803 extern void spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation,
801 804 dmu_tx_t *tx, const char *fmt, ...);
802 805
803 806 /* error handling */
804 807 struct zbookmark_phys;
805 808 extern void spa_log_error(spa_t *spa, zio_t *zio);
806 809 extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd,
807 810 zio_t *zio, uint64_t stateoroffset, uint64_t length);
808 811 extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
809 812 extern void zfs_post_state_change(spa_t *spa, vdev_t *vd);
810 813 extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
811 814 extern uint64_t spa_get_errlog_size(spa_t *spa);
812 815 extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
813 816 extern void spa_errlog_rotate(spa_t *spa);
814 817 extern void spa_errlog_drain(spa_t *spa);
815 818 extern void spa_errlog_sync(spa_t *spa, uint64_t txg);
816 819 extern void spa_get_errlists(spa_t *spa, avl_tree_t *last, avl_tree_t *scrub);
817 820
818 821 /* vdev cache */
819 822 extern void vdev_cache_stat_init(void);
820 823 extern void vdev_cache_stat_fini(void);
821 824
822 825 /* Initialization and termination */
823 826 extern void spa_init(int flags);
824 827 extern void spa_fini(void);
825 828 extern void spa_boot_init();
826 829
827 830 /* properties */
828 831 extern int spa_prop_set(spa_t *spa, nvlist_t *nvp);
829 832 extern int spa_prop_get(spa_t *spa, nvlist_t **nvp);
830 833 extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
831 834 extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t);
832 835
833 836 /* asynchronous event notification */
834 837 extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
835 838
836 839 #ifdef ZFS_DEBUG
837 840 #define dprintf_bp(bp, fmt, ...) do { \
838 841 if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
839 842 char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
840 843 snprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, (bp)); \
841 844 dprintf(fmt " %s\n", __VA_ARGS__, __blkbuf); \
842 845 kmem_free(__blkbuf, BP_SPRINTF_LEN); \
843 846 } \
844 847 _NOTE(CONSTCOND) } while (0)
845 848 #else
846 849 #define dprintf_bp(bp, fmt, ...)
847 850 #endif
848 851
849 852 extern boolean_t spa_debug_enabled(spa_t *spa);
850 853 #define spa_dbgmsg(spa, ...) \
851 854 { \
852 855 if (spa_debug_enabled(spa)) \
853 856 zfs_dbgmsg(__VA_ARGS__); \
854 857 }
855 858
856 859 extern int spa_mode_global; /* mode, e.g. FREAD | FWRITE */
857 860
858 861 #ifdef __cplusplus
859 862 }
860 863 #endif
861 864
862 865 #endif /* _SYS_SPA_H */
↓ open down ↓ |
475 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX