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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 */
27
28 #ifndef _ZIO_H
29 #define _ZIO_H
30
31 #include <sys/zfs_context.h>
32 #include <sys/spa.h>
33 #include <sys/txg.h>
34 #include <sys/avl.h>
35 #include <sys/fs/zfs.h>
36 #include <sys/zio_impl.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*
43 * Embedded checksum
44 */
45 #define ZEC_MAGIC 0x210da7ab10c7a11ULL
89
90 #define ZIO_DEDUPCHECKSUM ZIO_CHECKSUM_SHA256
91 #define ZIO_DEDUPDITTO_MIN 100
92
93 enum zio_compress {
94 ZIO_COMPRESS_INHERIT = 0,
95 ZIO_COMPRESS_ON,
96 ZIO_COMPRESS_OFF,
97 ZIO_COMPRESS_LZJB,
98 ZIO_COMPRESS_EMPTY,
99 ZIO_COMPRESS_GZIP_1,
100 ZIO_COMPRESS_GZIP_2,
101 ZIO_COMPRESS_GZIP_3,
102 ZIO_COMPRESS_GZIP_4,
103 ZIO_COMPRESS_GZIP_5,
104 ZIO_COMPRESS_GZIP_6,
105 ZIO_COMPRESS_GZIP_7,
106 ZIO_COMPRESS_GZIP_8,
107 ZIO_COMPRESS_GZIP_9,
108 ZIO_COMPRESS_ZLE,
109 ZIO_COMPRESS_FUNCTIONS
110 };
111
112 #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB
113 #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
114
115 #define BOOTFS_COMPRESS_VALID(compress) \
116 ((compress) == ZIO_COMPRESS_LZJB || \
117 ((compress) == ZIO_COMPRESS_ON && \
118 ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \
119 (compress) == ZIO_COMPRESS_OFF)
120
121 #define ZIO_FAILURE_MODE_WAIT 0
122 #define ZIO_FAILURE_MODE_CONTINUE 1
123 #define ZIO_FAILURE_MODE_PANIC 2
124
125 #define ZIO_PRIORITY_NOW (zio_priority_table[0])
126 #define ZIO_PRIORITY_SYNC_READ (zio_priority_table[1])
127 #define ZIO_PRIORITY_SYNC_WRITE (zio_priority_table[2])
128 #define ZIO_PRIORITY_LOG_WRITE (zio_priority_table[3])
129 #define ZIO_PRIORITY_CACHE_FILL (zio_priority_table[4])
130 #define ZIO_PRIORITY_AGG (zio_priority_table[5])
131 #define ZIO_PRIORITY_FREE (zio_priority_table[6])
132 #define ZIO_PRIORITY_ASYNC_WRITE (zio_priority_table[7])
133 #define ZIO_PRIORITY_ASYNC_READ (zio_priority_table[8])
134 #define ZIO_PRIORITY_RESILVER (zio_priority_table[9])
135 #define ZIO_PRIORITY_SCRUB (zio_priority_table[10])
136 #define ZIO_PRIORITY_DDT_PREFETCH (zio_priority_table[11])
|
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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
27 */
28
29 #ifndef _ZIO_H
30 #define _ZIO_H
31
32 #include <sys/zfs_context.h>
33 #include <sys/spa.h>
34 #include <sys/txg.h>
35 #include <sys/avl.h>
36 #include <sys/fs/zfs.h>
37 #include <sys/zio_impl.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * Embedded checksum
45 */
46 #define ZEC_MAGIC 0x210da7ab10c7a11ULL
90
91 #define ZIO_DEDUPCHECKSUM ZIO_CHECKSUM_SHA256
92 #define ZIO_DEDUPDITTO_MIN 100
93
94 enum zio_compress {
95 ZIO_COMPRESS_INHERIT = 0,
96 ZIO_COMPRESS_ON,
97 ZIO_COMPRESS_OFF,
98 ZIO_COMPRESS_LZJB,
99 ZIO_COMPRESS_EMPTY,
100 ZIO_COMPRESS_GZIP_1,
101 ZIO_COMPRESS_GZIP_2,
102 ZIO_COMPRESS_GZIP_3,
103 ZIO_COMPRESS_GZIP_4,
104 ZIO_COMPRESS_GZIP_5,
105 ZIO_COMPRESS_GZIP_6,
106 ZIO_COMPRESS_GZIP_7,
107 ZIO_COMPRESS_GZIP_8,
108 ZIO_COMPRESS_GZIP_9,
109 ZIO_COMPRESS_ZLE,
110 ZIO_COMPRESS_LZ4,
111 ZIO_COMPRESS_LZ4HC,
112 ZIO_COMPRESS_FUNCTIONS
113 };
114
115 /* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */
116 #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB
117 #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
118
119 #define BOOTFS_COMPRESS_VALID(compress) \
120 ((compress) == ZIO_COMPRESS_LZJB || \
121 (compress) == ZIO_COMPRESS_LZ4HC || \
122 (compress) == ZIO_COMPRESS_LZ4 || \
123 ((compress) == ZIO_COMPRESS_ON && \
124 ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \
125 (compress) == ZIO_COMPRESS_OFF)
126
127 #define ZIO_FAILURE_MODE_WAIT 0
128 #define ZIO_FAILURE_MODE_CONTINUE 1
129 #define ZIO_FAILURE_MODE_PANIC 2
130
131 #define ZIO_PRIORITY_NOW (zio_priority_table[0])
132 #define ZIO_PRIORITY_SYNC_READ (zio_priority_table[1])
133 #define ZIO_PRIORITY_SYNC_WRITE (zio_priority_table[2])
134 #define ZIO_PRIORITY_LOG_WRITE (zio_priority_table[3])
135 #define ZIO_PRIORITY_CACHE_FILL (zio_priority_table[4])
136 #define ZIO_PRIORITY_AGG (zio_priority_table[5])
137 #define ZIO_PRIORITY_FREE (zio_priority_table[6])
138 #define ZIO_PRIORITY_ASYNC_WRITE (zio_priority_table[7])
139 #define ZIO_PRIORITY_ASYNC_READ (zio_priority_table[8])
140 #define ZIO_PRIORITY_RESILVER (zio_priority_table[9])
141 #define ZIO_PRIORITY_SCRUB (zio_priority_table[10])
142 #define ZIO_PRIORITY_DDT_PREFETCH (zio_priority_table[11])
|