xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/zio.h (revision e0f1c0afa46cc84d4b1e40124032a9a87310386e)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21c9431fa1Sahl 
22fa9e4066Sahrens /*
23c7cd2421SGeorge Wilson  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
245aeb9474SGarrett D'Amore  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
25f78cdc34SPaul Dagnelie  * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
26a6f561b4SSašo Kiselkov  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
27810e43b2SBill Pijewski  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
28c8811bd3SToomas Soome  * Copyright 2016 Toomas Soome <tsoome@me.com>
295aeb9474SGarrett D'Amore  */
30fa9e4066Sahrens 
31fa9e4066Sahrens #ifndef _ZIO_H
32fa9e4066Sahrens #define	_ZIO_H
33fa9e4066Sahrens 
34a2cdcdd2SPaul Dagnelie #include <sys/zio_priority.h>
35fa9e4066Sahrens #include <sys/zfs_context.h>
36fa9e4066Sahrens #include <sys/spa.h>
37fa9e4066Sahrens #include <sys/txg.h>
38fa9e4066Sahrens #include <sys/avl.h>
39fa9e4066Sahrens #include <sys/fs/zfs.h>
4044cd46caSbillm #include <sys/zio_impl.h>
41fa9e4066Sahrens 
42fa9e4066Sahrens #ifdef	__cplusplus
43fa9e4066Sahrens extern "C" {
44fa9e4066Sahrens #endif
45fa9e4066Sahrens 
466e1f5caaSNeil Perrin /*
476e1f5caaSNeil Perrin  * Embedded checksum
486e1f5caaSNeil Perrin  */
496e1f5caaSNeil Perrin #define	ZEC_MAGIC	0x210da7ab10c7a11ULL
50fa9e4066Sahrens 
516e1f5caaSNeil Perrin typedef struct zio_eck {
526e1f5caaSNeil Perrin 	uint64_t	zec_magic;	/* for validation, endianness	*/
536e1f5caaSNeil Perrin 	zio_cksum_t	zec_cksum;	/* 256-bit checksum		*/
546e1f5caaSNeil Perrin } zio_eck_t;
55fa9e4066Sahrens 
56fa9e4066Sahrens /*
57fa9e4066Sahrens  * Gang block headers are self-checksumming and contain an array
58fa9e4066Sahrens  * of block pointers.
59fa9e4066Sahrens  */
60fa9e4066Sahrens #define	SPA_GANGBLOCKSIZE	SPA_MINBLOCKSIZE
61fa9e4066Sahrens #define	SPA_GBH_NBLKPTRS	((SPA_GANGBLOCKSIZE - \
626e1f5caaSNeil Perrin 	sizeof (zio_eck_t)) / sizeof (blkptr_t))
63fa9e4066Sahrens #define	SPA_GBH_FILLER		((SPA_GANGBLOCKSIZE - \
646e1f5caaSNeil Perrin 	sizeof (zio_eck_t) - \
65fa9e4066Sahrens 	(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
66fa9e4066Sahrens 	sizeof (uint64_t))
67fa9e4066Sahrens 
68fa9e4066Sahrens typedef struct zio_gbh {
69fa9e4066Sahrens 	blkptr_t		zg_blkptr[SPA_GBH_NBLKPTRS];
70fa9e4066Sahrens 	uint64_t		zg_filler[SPA_GBH_FILLER];
716e1f5caaSNeil Perrin 	zio_eck_t		zg_tail;
72fa9e4066Sahrens } zio_gbh_phys_t;
73fa9e4066Sahrens 
74fa9e4066Sahrens enum zio_checksum {
75fa9e4066Sahrens 	ZIO_CHECKSUM_INHERIT = 0,
76fa9e4066Sahrens 	ZIO_CHECKSUM_ON,
77fa9e4066Sahrens 	ZIO_CHECKSUM_OFF,
78fa9e4066Sahrens 	ZIO_CHECKSUM_LABEL,
79fa9e4066Sahrens 	ZIO_CHECKSUM_GANG_HEADER,
80fa9e4066Sahrens 	ZIO_CHECKSUM_ZILOG,
81fa9e4066Sahrens 	ZIO_CHECKSUM_FLETCHER_2,
82fa9e4066Sahrens 	ZIO_CHECKSUM_FLETCHER_4,
83fa9e4066Sahrens 	ZIO_CHECKSUM_SHA256,
846e1f5caaSNeil Perrin 	ZIO_CHECKSUM_ZILOG2,
85810e43b2SBill Pijewski 	ZIO_CHECKSUM_NOPARITY,
8645818ee1SMatthew Ahrens 	ZIO_CHECKSUM_SHA512,
8745818ee1SMatthew Ahrens 	ZIO_CHECKSUM_SKEIN,
8845818ee1SMatthew Ahrens 	ZIO_CHECKSUM_EDONR,
89fa9e4066Sahrens 	ZIO_CHECKSUM_FUNCTIONS
90fa9e4066Sahrens };
91fa9e4066Sahrens 
925d7b4d43SMatthew Ahrens /*
935d7b4d43SMatthew Ahrens  * The number of "legacy" compression functions which can be set on individual
945d7b4d43SMatthew Ahrens  * objects.
955d7b4d43SMatthew Ahrens  */
965d7b4d43SMatthew Ahrens #define	ZIO_CHECKSUM_LEGACY_FUNCTIONS ZIO_CHECKSUM_ZILOG2
975d7b4d43SMatthew Ahrens 
987e322df5SJonathan Adams #define	ZIO_CHECKSUM_ON_VALUE	ZIO_CHECKSUM_FLETCHER_4
99fa9e4066Sahrens #define	ZIO_CHECKSUM_DEFAULT	ZIO_CHECKSUM_ON
100fa9e4066Sahrens 
101b24ab676SJeff Bonwick #define	ZIO_CHECKSUM_MASK	0xffULL
102b24ab676SJeff Bonwick #define	ZIO_CHECKSUM_VERIFY	(1 << 8)
103b24ab676SJeff Bonwick 
104b24ab676SJeff Bonwick #define	ZIO_DEDUPCHECKSUM	ZIO_CHECKSUM_SHA256
105b24ab676SJeff Bonwick #define	ZIO_DEDUPDITTO_MIN	100
106b24ab676SJeff Bonwick 
1075d7b4d43SMatthew Ahrens /*
1085d7b4d43SMatthew Ahrens  * The number of "legacy" compression functions which can be set on individual
1095d7b4d43SMatthew Ahrens  * objects.
1105d7b4d43SMatthew Ahrens  */
1115d7b4d43SMatthew Ahrens #define	ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4
1125d7b4d43SMatthew Ahrens 
113db1741f5SJustin T. Gibbs /*
114db1741f5SJustin T. Gibbs  * The meaning of "compress = on" selected by the compression features enabled
115db1741f5SJustin T. Gibbs  * on a given pool.
116db1741f5SJustin T. Gibbs  */
117db1741f5SJustin T. Gibbs #define	ZIO_COMPRESS_LEGACY_ON_VALUE	ZIO_COMPRESS_LZJB
118db1741f5SJustin T. Gibbs #define	ZIO_COMPRESS_LZ4_ON_VALUE	ZIO_COMPRESS_LZ4
119db1741f5SJustin T. Gibbs 
120db1741f5SJustin T. Gibbs #define	ZIO_COMPRESS_DEFAULT		ZIO_COMPRESS_OFF
121fa9e4066Sahrens 
122b24ab676SJeff Bonwick #define	BOOTFS_COMPRESS_VALID(compress)			\
123b24ab676SJeff Bonwick 	((compress) == ZIO_COMPRESS_LZJB ||		\
124a6f561b4SSašo Kiselkov 	(compress) == ZIO_COMPRESS_LZ4 ||		\
125c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_1 ||		\
126c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_2 ||		\
127c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_3 ||		\
128c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_4 ||		\
129c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_5 ||		\
130c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_6 ||		\
131c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_7 ||		\
132c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_8 ||		\
133c8811bd3SToomas Soome 	(compress) == ZIO_COMPRESS_GZIP_9 ||		\
134db1741f5SJustin T. Gibbs 	(compress) == ZIO_COMPRESS_ON ||		\
135b24ab676SJeff Bonwick 	(compress) == ZIO_COMPRESS_OFF)
136b24ab676SJeff Bonwick 
1370a4e9518Sgw #define	ZIO_FAILURE_MODE_WAIT		0
1380a4e9518Sgw #define	ZIO_FAILURE_MODE_CONTINUE	1
1390a4e9518Sgw #define	ZIO_FAILURE_MODE_PANIC		2
1400a4e9518Sgw 
141*e0f1c0afSOlaf Faaland typedef enum zio_suspend_reason {
142*e0f1c0afSOlaf Faaland 	ZIO_SUSPEND_NONE = 0,
143*e0f1c0afSOlaf Faaland 	ZIO_SUSPEND_IOERR,
144*e0f1c0afSOlaf Faaland 	ZIO_SUSPEND_MMP,
145*e0f1c0afSOlaf Faaland } zio_suspend_reason_t;
146*e0f1c0afSOlaf Faaland 
147b24ab676SJeff Bonwick enum zio_flag {
148b24ab676SJeff Bonwick 	/*
149b24ab676SJeff Bonwick 	 * Flags inherited by gang, ddt, and vdev children,
150b24ab676SJeff Bonwick 	 * and that must be equal for two zios to aggregate
151b24ab676SJeff Bonwick 	 */
152b24ab676SJeff Bonwick 	ZIO_FLAG_DONT_AGGREGATE	= 1 << 0,
153b24ab676SJeff Bonwick 	ZIO_FLAG_IO_REPAIR	= 1 << 1,
154b24ab676SJeff Bonwick 	ZIO_FLAG_SELF_HEAL	= 1 << 2,
155b24ab676SJeff Bonwick 	ZIO_FLAG_RESILVER	= 1 << 3,
156b24ab676SJeff Bonwick 	ZIO_FLAG_SCRUB		= 1 << 4,
15744ecc532SGeorge Wilson 	ZIO_FLAG_SCAN_THREAD	= 1 << 5,
1582a104a52SAlex Reece 	ZIO_FLAG_PHYSICAL	= 1 << 6,
159b24ab676SJeff Bonwick 
160b24ab676SJeff Bonwick #define	ZIO_FLAG_AGG_INHERIT	(ZIO_FLAG_CANFAIL - 1)
161b24ab676SJeff Bonwick 
162b24ab676SJeff Bonwick 	/*
163b24ab676SJeff Bonwick 	 * Flags inherited by ddt, gang, and vdev children.
164b24ab676SJeff Bonwick 	 */
1652a104a52SAlex Reece 	ZIO_FLAG_CANFAIL	= 1 << 7,	/* must be first for INHERIT */
1662a104a52SAlex Reece 	ZIO_FLAG_SPECULATIVE	= 1 << 8,
1672a104a52SAlex Reece 	ZIO_FLAG_CONFIG_WRITER	= 1 << 9,
1682a104a52SAlex Reece 	ZIO_FLAG_DONT_RETRY	= 1 << 10,
1692a104a52SAlex Reece 	ZIO_FLAG_DONT_CACHE	= 1 << 11,
1702a104a52SAlex Reece 	ZIO_FLAG_NODATA		= 1 << 12,
1712a104a52SAlex Reece 	ZIO_FLAG_INDUCE_DAMAGE	= 1 << 13,
1720f7643c7SGeorge Wilson 	ZIO_FLAG_IO_ALLOCATING	= 1 << 14,
173b24ab676SJeff Bonwick 
174b24ab676SJeff Bonwick #define	ZIO_FLAG_DDT_INHERIT	(ZIO_FLAG_IO_RETRY - 1)
175b24ab676SJeff Bonwick #define	ZIO_FLAG_GANG_INHERIT	(ZIO_FLAG_IO_RETRY - 1)
176b24ab676SJeff Bonwick 
177b24ab676SJeff Bonwick 	/*
178b24ab676SJeff Bonwick 	 * Flags inherited by vdev children.
179b24ab676SJeff Bonwick 	 */
1800f7643c7SGeorge Wilson 	ZIO_FLAG_IO_RETRY	= 1 << 15,	/* must be first for INHERIT */
1810f7643c7SGeorge Wilson 	ZIO_FLAG_PROBE		= 1 << 16,
1820f7643c7SGeorge Wilson 	ZIO_FLAG_TRYHARD	= 1 << 17,
1830f7643c7SGeorge Wilson 	ZIO_FLAG_OPTIONAL	= 1 << 18,
184b24ab676SJeff Bonwick 
185b24ab676SJeff Bonwick #define	ZIO_FLAG_VDEV_INHERIT	(ZIO_FLAG_DONT_QUEUE - 1)
186b24ab676SJeff Bonwick 
187b24ab676SJeff Bonwick 	/*
188b24ab676SJeff Bonwick 	 * Flags not inherited by any children.
189b24ab676SJeff Bonwick 	 */
1900f7643c7SGeorge Wilson 	ZIO_FLAG_DONT_QUEUE	= 1 << 19,	/* must be first for INHERIT */
1910f7643c7SGeorge Wilson 	ZIO_FLAG_DONT_PROPAGATE	= 1 << 20,
1920f7643c7SGeorge Wilson 	ZIO_FLAG_IO_BYPASS	= 1 << 21,
1930f7643c7SGeorge Wilson 	ZIO_FLAG_IO_REWRITE	= 1 << 22,
1940f7643c7SGeorge Wilson 	ZIO_FLAG_RAW		= 1 << 23,
1950f7643c7SGeorge Wilson 	ZIO_FLAG_GANG_CHILD	= 1 << 24,
1960f7643c7SGeorge Wilson 	ZIO_FLAG_DDT_CHILD	= 1 << 25,
1970f7643c7SGeorge Wilson 	ZIO_FLAG_GODFATHER	= 1 << 26,
1980f7643c7SGeorge Wilson 	ZIO_FLAG_NOPWRITE	= 1 << 27,
1990f7643c7SGeorge Wilson 	ZIO_FLAG_REEXECUTED	= 1 << 28,
2000f7643c7SGeorge Wilson 	ZIO_FLAG_DELEGATED	= 1 << 29,
201b24ab676SJeff Bonwick };
202b24ab676SJeff Bonwick 
203b24ab676SJeff Bonwick #define	ZIO_FLAG_MUSTSUCCEED		0
204b24ab676SJeff Bonwick 
205b24ab676SJeff Bonwick #define	ZIO_DDT_CHILD_FLAGS(zio)				\
206b24ab676SJeff Bonwick 	(((zio)->io_flags & ZIO_FLAG_DDT_INHERIT) |		\
207b24ab676SJeff Bonwick 	ZIO_FLAG_DDT_CHILD | ZIO_FLAG_CANFAIL)
208b24ab676SJeff Bonwick 
209e14bb325SJeff Bonwick #define	ZIO_GANG_CHILD_FLAGS(zio)				\
210e14bb325SJeff Bonwick 	(((zio)->io_flags & ZIO_FLAG_GANG_INHERIT) |		\
211e14bb325SJeff Bonwick 	ZIO_FLAG_GANG_CHILD | ZIO_FLAG_CANFAIL)
212e14bb325SJeff Bonwick 
213b24ab676SJeff Bonwick #define	ZIO_VDEV_CHILD_FLAGS(zio)				\
214b24ab676SJeff Bonwick 	(((zio)->io_flags & ZIO_FLAG_VDEV_INHERIT) |		\
2155cabbc6bSPrashanth Sreenivasa 	ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_CANFAIL)
216b24ab676SJeff Bonwick 
217d6e1c446SGeorge Wilson #define	ZIO_CHILD_BIT(x)		(1 << (x))
218d6e1c446SGeorge Wilson #define	ZIO_CHILD_BIT_IS_SET(val, x)	((val) & (1 << (x)))
219d6e1c446SGeorge Wilson 
220e14bb325SJeff Bonwick enum zio_child {
221e14bb325SJeff Bonwick 	ZIO_CHILD_VDEV = 0,
222e14bb325SJeff Bonwick 	ZIO_CHILD_GANG,
223b24ab676SJeff Bonwick 	ZIO_CHILD_DDT,
224e14bb325SJeff Bonwick 	ZIO_CHILD_LOGICAL,
225e14bb325SJeff Bonwick 	ZIO_CHILD_TYPES
226e14bb325SJeff Bonwick };
227e14bb325SJeff Bonwick 
228d6e1c446SGeorge Wilson #define	ZIO_CHILD_VDEV_BIT		ZIO_CHILD_BIT(ZIO_CHILD_VDEV)
229d6e1c446SGeorge Wilson #define	ZIO_CHILD_GANG_BIT		ZIO_CHILD_BIT(ZIO_CHILD_GANG)
230d6e1c446SGeorge Wilson #define	ZIO_CHILD_DDT_BIT		ZIO_CHILD_BIT(ZIO_CHILD_DDT)
231d6e1c446SGeorge Wilson #define	ZIO_CHILD_LOGICAL_BIT		ZIO_CHILD_BIT(ZIO_CHILD_LOGICAL)
232d6e1c446SGeorge Wilson #define	ZIO_CHILD_ALL_BITS					\
233*e0f1c0afSOlaf Faaland 	(ZIO_CHILD_VDEV_BIT | ZIO_CHILD_GANG_BIT |		\
234d6e1c446SGeorge Wilson 	ZIO_CHILD_DDT_BIT | ZIO_CHILD_LOGICAL_BIT)
235d6e1c446SGeorge Wilson 
236e14bb325SJeff Bonwick enum zio_wait_type {
237e14bb325SJeff Bonwick 	ZIO_WAIT_READY = 0,
238e14bb325SJeff Bonwick 	ZIO_WAIT_DONE,
239e14bb325SJeff Bonwick 	ZIO_WAIT_TYPES
240e14bb325SJeff Bonwick };
241e14bb325SJeff Bonwick 
242fa9e4066Sahrens /*
243e7cbe64fSgw  * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent
244e7cbe64fSgw  * graveyard) to indicate checksum errors and fragmentation.
245fa9e4066Sahrens  */
246fa9e4066Sahrens #define	ECKSUM	EBADE
247e7cbe64fSgw #define	EFRAGS	EBADR
248fa9e4066Sahrens 
249fa9e4066Sahrens typedef void zio_done_func_t(zio_t *zio);
250fa9e4066Sahrens 
2510f7643c7SGeorge Wilson extern boolean_t zio_dva_throttle_enabled;
25269962b56SMatthew Ahrens extern const char *zio_type_name[ZIO_TYPES];
253fa9e4066Sahrens 
254ea8dc4b6Seschrock /*
255ea8dc4b6Seschrock  * A bookmark is a four-tuple <objset, object, level, blkid> that uniquely
256ea8dc4b6Seschrock  * identifies any block in the pool.  By convention, the meta-objset (MOS)
257b24ab676SJeff Bonwick  * is objset 0, and the meta-dnode is object 0.  This covers all blocks
258b24ab676SJeff Bonwick  * except root blocks and ZIL blocks, which are defined as follows:
259ea8dc4b6Seschrock  *
260b24ab676SJeff Bonwick  * Root blocks (objset_phys_t) are object 0, level -1:  <objset, 0, -1, 0>.
261b24ab676SJeff Bonwick  * ZIL blocks are bookmarked <objset, 0, -2, blkid == ZIL sequence number>.
262b24ab676SJeff Bonwick  * dmu_sync()ed ZIL data blocks are bookmarked <objset, object, -2, blkid>.
263a2cdcdd2SPaul Dagnelie  * dnode visit bookmarks are <objset, object id of dnode, -3, 0>.
264ea8dc4b6Seschrock  *
265b24ab676SJeff Bonwick  * Note: this structure is called a bookmark because its original purpose
266b24ab676SJeff Bonwick  * was to remember where to resume a pool-wide traverse.
267ea8dc4b6Seschrock  *
2687802d7bfSMatthew Ahrens  * Note: this structure is passed between userland and the kernel, and is
2697802d7bfSMatthew Ahrens  * stored on disk (by virtue of being incorporated into other on-disk
2707802d7bfSMatthew Ahrens  * structures, e.g. dsl_scan_phys_t).
271ea8dc4b6Seschrock  */
2727802d7bfSMatthew Ahrens typedef struct zbookmark_phys {
273ea8dc4b6Seschrock 	uint64_t	zb_objset;
274ea8dc4b6Seschrock 	uint64_t	zb_object;
275ea8dc4b6Seschrock 	int64_t		zb_level;
276ea8dc4b6Seschrock 	uint64_t	zb_blkid;
2777802d7bfSMatthew Ahrens } zbookmark_phys_t;
278ea8dc4b6Seschrock 
279b24ab676SJeff Bonwick #define	SET_BOOKMARK(zb, objset, object, level, blkid)  \
280b24ab676SJeff Bonwick {                                                       \
281b24ab676SJeff Bonwick 	(zb)->zb_objset = objset;                       \
282b24ab676SJeff Bonwick 	(zb)->zb_object = object;                       \
283b24ab676SJeff Bonwick 	(zb)->zb_level = level;                         \
284b24ab676SJeff Bonwick 	(zb)->zb_blkid = blkid;                         \
285b24ab676SJeff Bonwick }
286b24ab676SJeff Bonwick 
287b24ab676SJeff Bonwick #define	ZB_DESTROYED_OBJSET	(-1ULL)
288b24ab676SJeff Bonwick 
289b24ab676SJeff Bonwick #define	ZB_ROOT_OBJECT		(0ULL)
290b24ab676SJeff Bonwick #define	ZB_ROOT_LEVEL		(-1LL)
291b24ab676SJeff Bonwick #define	ZB_ROOT_BLKID		(0ULL)
292b24ab676SJeff Bonwick 
293b24ab676SJeff Bonwick #define	ZB_ZIL_OBJECT		(0ULL)
294b24ab676SJeff Bonwick #define	ZB_ZIL_LEVEL		(-2LL)
295b24ab676SJeff Bonwick 
296a2cdcdd2SPaul Dagnelie #define	ZB_DNODE_LEVEL		(-3LL)
297a2cdcdd2SPaul Dagnelie #define	ZB_DNODE_BLKID		(0ULL)
298a2cdcdd2SPaul Dagnelie 
299ad135b5dSChristopher Siden #define	ZB_IS_ZERO(zb)						\
300ad135b5dSChristopher Siden 	((zb)->zb_objset == 0 && (zb)->zb_object == 0 &&	\
301ad135b5dSChristopher Siden 	(zb)->zb_level == 0 && (zb)->zb_blkid == 0)
302ad135b5dSChristopher Siden #define	ZB_IS_ROOT(zb)				\
303ad135b5dSChristopher Siden 	((zb)->zb_object == ZB_ROOT_OBJECT &&	\
304ad135b5dSChristopher Siden 	(zb)->zb_level == ZB_ROOT_LEVEL &&	\
305ad135b5dSChristopher Siden 	(zb)->zb_blkid == ZB_ROOT_BLKID)
306ad135b5dSChristopher Siden 
307e14bb325SJeff Bonwick typedef struct zio_prop {
308e14bb325SJeff Bonwick 	enum zio_checksum	zp_checksum;
309e14bb325SJeff Bonwick 	enum zio_compress	zp_compress;
310e14bb325SJeff Bonwick 	dmu_object_type_t	zp_type;
311e14bb325SJeff Bonwick 	uint8_t			zp_level;
312b24ab676SJeff Bonwick 	uint8_t			zp_copies;
31380901aeaSGeorge Wilson 	boolean_t		zp_dedup;
31480901aeaSGeorge Wilson 	boolean_t		zp_dedup_verify;
31580901aeaSGeorge Wilson 	boolean_t		zp_nopwrite;
316e14bb325SJeff Bonwick } zio_prop_t;
317e14bb325SJeff Bonwick 
31822fe2c88SJonathan Adams typedef struct zio_cksum_report zio_cksum_report_t;
31922fe2c88SJonathan Adams 
32022fe2c88SJonathan Adams typedef void zio_cksum_finish_f(zio_cksum_report_t *rep,
32122fe2c88SJonathan Adams     const void *good_data);
32222fe2c88SJonathan Adams typedef void zio_cksum_free_f(void *cbdata, size_t size);
32322fe2c88SJonathan Adams 
32422fe2c88SJonathan Adams struct zio_bad_cksum;				/* defined in zio_checksum.h */
325ad135b5dSChristopher Siden struct dnode_phys;
326770499e1SDan Kimmel struct abd;
32722fe2c88SJonathan Adams 
32822fe2c88SJonathan Adams struct zio_cksum_report {
32922fe2c88SJonathan Adams 	struct zio_cksum_report *zcr_next;
33022fe2c88SJonathan Adams 	nvlist_t		*zcr_ereport;
33122fe2c88SJonathan Adams 	nvlist_t		*zcr_detector;
33222fe2c88SJonathan Adams 	void			*zcr_cbdata;
33322fe2c88SJonathan Adams 	size_t			zcr_cbinfo;	/* passed to zcr_free() */
334b24ab676SJeff Bonwick 	uint64_t		zcr_align;
33522fe2c88SJonathan Adams 	uint64_t		zcr_length;
33622fe2c88SJonathan Adams 	zio_cksum_finish_f	*zcr_finish;
33722fe2c88SJonathan Adams 	zio_cksum_free_f	*zcr_free;
33822fe2c88SJonathan Adams 
33922fe2c88SJonathan Adams 	/* internal use only */
34022fe2c88SJonathan Adams 	struct zio_bad_cksum	*zcr_ckinfo;	/* information from failure */
34122fe2c88SJonathan Adams };
34222fe2c88SJonathan Adams 
34322fe2c88SJonathan Adams typedef void zio_vsd_cksum_report_f(zio_t *zio, zio_cksum_report_t *zcr,
34422fe2c88SJonathan Adams     void *arg);
34522fe2c88SJonathan Adams 
34622fe2c88SJonathan Adams zio_vsd_cksum_report_f	zio_vsd_default_cksum_report;
34722fe2c88SJonathan Adams 
34822fe2c88SJonathan Adams typedef struct zio_vsd_ops {
34922fe2c88SJonathan Adams 	zio_done_func_t		*vsd_free;
35022fe2c88SJonathan Adams 	zio_vsd_cksum_report_f	*vsd_cksum_report;
35122fe2c88SJonathan Adams } zio_vsd_ops_t;
35222fe2c88SJonathan Adams 
353e14bb325SJeff Bonwick typedef struct zio_gang_node {
354e14bb325SJeff Bonwick 	zio_gbh_phys_t		*gn_gbh;
355e14bb325SJeff Bonwick 	struct zio_gang_node	*gn_child[SPA_GBH_NBLKPTRS];
356e14bb325SJeff Bonwick } zio_gang_node_t;
357e14bb325SJeff Bonwick 
358e14bb325SJeff Bonwick typedef zio_t *zio_gang_issue_func_t(zio_t *zio, blkptr_t *bp,
359770499e1SDan Kimmel     zio_gang_node_t *gn, struct abd *data, uint64_t offset);
360e14bb325SJeff Bonwick 
361770499e1SDan Kimmel typedef void zio_transform_func_t(zio_t *zio, struct abd *data, uint64_t size);
362e14bb325SJeff Bonwick 
363e14bb325SJeff Bonwick typedef struct zio_transform {
364770499e1SDan Kimmel 	struct abd		*zt_orig_abd;
365e14bb325SJeff Bonwick 	uint64_t		zt_orig_size;
366e14bb325SJeff Bonwick 	uint64_t		zt_bufsize;
367e14bb325SJeff Bonwick 	zio_transform_func_t	*zt_transform;
368e14bb325SJeff Bonwick 	struct zio_transform	*zt_next;
369e14bb325SJeff Bonwick } zio_transform_t;
370e14bb325SJeff Bonwick 
371e14bb325SJeff Bonwick typedef int zio_pipe_stage_t(zio_t *zio);
372e14bb325SJeff Bonwick 
373e14bb325SJeff Bonwick /*
374e14bb325SJeff Bonwick  * The io_reexecute flags are distinct from io_flags because the child must
375e14bb325SJeff Bonwick  * be able to propagate them to the parent.  The normal io_flags are local
376e14bb325SJeff Bonwick  * to the zio, not protected by any lock, and not modifiable by children;
377e14bb325SJeff Bonwick  * the reexecute flags are protected by io_lock, modifiable by children,
378e14bb325SJeff Bonwick  * and always propagated -- even when ZIO_FLAG_DONT_PROPAGATE is set.
379e14bb325SJeff Bonwick  */
380e14bb325SJeff Bonwick #define	ZIO_REEXECUTE_NOW	0x01
381e14bb325SJeff Bonwick #define	ZIO_REEXECUTE_SUSPEND	0x02
382e14bb325SJeff Bonwick 
3838363e80aSGeorge Wilson typedef struct zio_alloc_list {
3848363e80aSGeorge Wilson 	list_t  zal_list;
3858363e80aSGeorge Wilson 	uint64_t zal_size;
3868363e80aSGeorge Wilson } zio_alloc_list_t;
3878363e80aSGeorge Wilson 
388a3f829aeSBill Moore typedef struct zio_link {
389a3f829aeSBill Moore 	zio_t		*zl_parent;
390a3f829aeSBill Moore 	zio_t		*zl_child;
391a3f829aeSBill Moore 	list_node_t	zl_parent_node;
392a3f829aeSBill Moore 	list_node_t	zl_child_node;
393a3f829aeSBill Moore } zio_link_t;
394a3f829aeSBill Moore 
395fa9e4066Sahrens struct zio {
396fa9e4066Sahrens 	/* Core information about this I/O */
3977802d7bfSMatthew Ahrens 	zbookmark_phys_t	io_bookmark;
398e14bb325SJeff Bonwick 	zio_prop_t	io_prop;
399e14bb325SJeff Bonwick 	zio_type_t	io_type;
400e14bb325SJeff Bonwick 	enum zio_child	io_child_type;
401e14bb325SJeff Bonwick 	int		io_cmd;
40269962b56SMatthew Ahrens 	zio_priority_t	io_priority;
403e14bb325SJeff Bonwick 	uint8_t		io_reexecute;
404a3f829aeSBill Moore 	uint8_t		io_state[ZIO_WAIT_TYPES];
405fa9e4066Sahrens 	uint64_t	io_txg;
406e14bb325SJeff Bonwick 	spa_t		*io_spa;
407fa9e4066Sahrens 	blkptr_t	*io_bp;
408b24ab676SJeff Bonwick 	blkptr_t	*io_bp_override;
409fa9e4066Sahrens 	blkptr_t	io_bp_copy;
410a3f829aeSBill Moore 	list_t		io_parent_list;
411a3f829aeSBill Moore 	list_t		io_child_list;
412ea8dc4b6Seschrock 	zio_t		*io_logical;
413e14bb325SJeff Bonwick 	zio_transform_t *io_transform_stack;
414fa9e4066Sahrens 
415fa9e4066Sahrens 	/* Callback info */
416c717a561Smaybee 	zio_done_func_t	*io_ready;
4178df0bcf0SPaul Dagnelie 	zio_done_func_t	*io_children_ready;
41869962b56SMatthew Ahrens 	zio_done_func_t	*io_physdone;
419fa9e4066Sahrens 	zio_done_func_t	*io_done;
420fa9e4066Sahrens 	void		*io_private;
421b24ab676SJeff Bonwick 	int64_t		io_prev_space_delta;	/* DMU private */
422fa9e4066Sahrens 	blkptr_t	io_bp_orig;
423fa9e4066Sahrens 
424fa9e4066Sahrens 	/* Data represented by this I/O */
425770499e1SDan Kimmel 	struct abd	*io_abd;
426770499e1SDan Kimmel 	struct abd	*io_orig_abd;
427fa9e4066Sahrens 	uint64_t	io_size;
428b24ab676SJeff Bonwick 	uint64_t	io_orig_size;
4295602294fSDan Kimmel 	/* io_lsize != io_orig_size iff this is a raw write */
4305602294fSDan Kimmel 	uint64_t	io_lsize;
431fa9e4066Sahrens 
432fa9e4066Sahrens 	/* Stuff for the vdev stack */
433fa9e4066Sahrens 	vdev_t		*io_vd;
434fa9e4066Sahrens 	void		*io_vsd;
43522fe2c88SJonathan Adams 	const zio_vsd_ops_t *io_vsd_ops;
43622fe2c88SJonathan Adams 
437fa9e4066Sahrens 	uint64_t	io_offset;
438c55e05cbSMatthew Ahrens 	hrtime_t	io_timestamp;
4390f7643c7SGeorge Wilson 	hrtime_t	io_queued_timestamp;
44097e81309SPrakash Surya 	hrtime_t	io_target_timestamp;
44169962b56SMatthew Ahrens 	avl_node_t	io_queue_node;
442fe319232SJustin T. Gibbs 	avl_node_t	io_offset_node;
4430f7643c7SGeorge Wilson 	avl_node_t	io_alloc_node;
444*e0f1c0afSOlaf Faaland 	zio_alloc_list_t	io_alloc_list;
445fa9e4066Sahrens 
446fa9e4066Sahrens 	/* Internal pipeline state */
447b24ab676SJeff Bonwick 	enum zio_flag	io_flags;
448b24ab676SJeff Bonwick 	enum zio_stage	io_stage;
449b24ab676SJeff Bonwick 	enum zio_stage	io_pipeline;
450b24ab676SJeff Bonwick 	enum zio_flag	io_orig_flags;
451b24ab676SJeff Bonwick 	enum zio_stage	io_orig_stage;
452b24ab676SJeff Bonwick 	enum zio_stage	io_orig_pipeline;
4530f7643c7SGeorge Wilson 	enum zio_stage	io_pipeline_trace;
454e14bb325SJeff Bonwick 	int		io_error;
455e14bb325SJeff Bonwick 	int		io_child_error[ZIO_CHILD_TYPES];
456e14bb325SJeff Bonwick 	uint64_t	io_children[ZIO_CHILD_TYPES][ZIO_WAIT_TYPES];
457b24ab676SJeff Bonwick 	uint64_t	io_child_count;
45869962b56SMatthew Ahrens 	uint64_t	io_phys_children;
459b24ab676SJeff Bonwick 	uint64_t	io_parent_count;
460e14bb325SJeff Bonwick 	uint64_t	*io_stall;
461f5383399SBill Moore 	zio_t		*io_gang_leader;
462e14bb325SJeff Bonwick 	zio_gang_node_t	*io_gang_tree;
463e14bb325SJeff Bonwick 	void		*io_executor;
464fa9e4066Sahrens 	void		*io_waiter;
465fa9e4066Sahrens 	kmutex_t	io_lock;
466fa9e4066Sahrens 	kcondvar_t	io_cv;
467f78cdc34SPaul Dagnelie 	int		io_allocator;
468ea8dc4b6Seschrock 
469ea8dc4b6Seschrock 	/* FMA state */
47022fe2c88SJonathan Adams 	zio_cksum_report_t *io_cksum_report;
471ea8dc4b6Seschrock 	uint64_t	io_ena;
4725aeb9474SGarrett D'Amore 
4735aeb9474SGarrett D'Amore 	/* Taskq dispatching state */
4745aeb9474SGarrett D'Amore 	taskq_ent_t	io_tqent;
475fa9e4066Sahrens };
476fa9e4066Sahrens 
47794c2d0ebSMatthew Ahrens extern int zio_bookmark_compare(const void *, const void *);
4780f7643c7SGeorge Wilson 
479a3f829aeSBill Moore extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd,
480b24ab676SJeff Bonwick     zio_done_func_t *done, void *private, enum zio_flag flags);
481fa9e4066Sahrens 
482fa9e4066Sahrens extern zio_t *zio_root(spa_t *spa,
483b24ab676SJeff Bonwick     zio_done_func_t *done, void *private, enum zio_flag flags);
484fa9e4066Sahrens 
485770499e1SDan Kimmel extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
486770499e1SDan Kimmel     struct abd *data, uint64_t lsize, zio_done_func_t *done, void *private,
4877802d7bfSMatthew Ahrens     zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb);
488fa9e4066Sahrens 
489e14bb325SJeff Bonwick extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
490770499e1SDan Kimmel     struct abd *data, uint64_t size, uint64_t psize, const zio_prop_t *zp,
4918df0bcf0SPaul Dagnelie     zio_done_func_t *ready, zio_done_func_t *children_ready,
4928df0bcf0SPaul Dagnelie     zio_done_func_t *physdone, zio_done_func_t *done,
4938df0bcf0SPaul Dagnelie     void *private, zio_priority_t priority, enum zio_flag flags,
4948df0bcf0SPaul Dagnelie     const zbookmark_phys_t *zb);
495fa9e4066Sahrens 
496e14bb325SJeff Bonwick extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
497770499e1SDan Kimmel     struct abd *data, uint64_t size, zio_done_func_t *done, void *private,
4987802d7bfSMatthew Ahrens     zio_priority_t priority, enum zio_flag flags, zbookmark_phys_t *zb);
499fa9e4066Sahrens 
50080901aeaSGeorge Wilson extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies,
50180901aeaSGeorge Wilson     boolean_t nopwrite);
50282c9918fSTim Haley 
503b24ab676SJeff Bonwick extern void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp);
504fa9e4066Sahrens 
505b24ab676SJeff Bonwick extern zio_t *zio_claim(zio_t *pio, spa_t *spa, uint64_t txg,
506b24ab676SJeff Bonwick     const blkptr_t *bp,
507b24ab676SJeff Bonwick     zio_done_func_t *done, void *private, enum zio_flag flags);
508fa9e4066Sahrens 
509fa9e4066Sahrens extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd,
51069962b56SMatthew Ahrens     zio_done_func_t *done, void *private, enum zio_flag flags);
511fa9e4066Sahrens 
512fa9e4066Sahrens extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset,
513770499e1SDan Kimmel     uint64_t size, struct abd *data, int checksum,
51469962b56SMatthew Ahrens     zio_done_func_t *done, void *private, zio_priority_t priority,
51569962b56SMatthew Ahrens     enum zio_flag flags, boolean_t labels);
516fa9e4066Sahrens 
517fa9e4066Sahrens extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset,
518770499e1SDan Kimmel     uint64_t size, struct abd *data, int checksum,
51969962b56SMatthew Ahrens     zio_done_func_t *done, void *private, zio_priority_t priority,
52069962b56SMatthew Ahrens     enum zio_flag flags, boolean_t labels);
521fa9e4066Sahrens 
522b24ab676SJeff Bonwick extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg,
523b24ab676SJeff Bonwick     const blkptr_t *bp, enum zio_flag flags);
524b24ab676SJeff Bonwick 
525f78cdc34SPaul Dagnelie extern int zio_alloc_zil(spa_t *spa, uint64_t objset, uint64_t txg,
526f78cdc34SPaul Dagnelie     blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t *slog);
52717f17c2dSbonwick extern void zio_flush(zio_t *zio, vdev_t *vd);
5286e1f5caaSNeil Perrin extern void zio_shrink(zio_t *zio, uint64_t size);
529fa9e4066Sahrens 
530fa9e4066Sahrens extern int zio_wait(zio_t *zio);
531fa9e4066Sahrens extern void zio_nowait(zio_t *zio);
532e05725b1Sbonwick extern void zio_execute(zio_t *zio);
533e05725b1Sbonwick extern void zio_interrupt(zio_t *zio);
53497e81309SPrakash Surya extern void zio_delay_init(zio_t *zio);
53597e81309SPrakash Surya extern void zio_delay_interrupt(zio_t *zio);
536e05725b1Sbonwick 
5370f7643c7SGeorge Wilson extern zio_t *zio_walk_parents(zio_t *cio, zio_link_t **);
5380f7643c7SGeorge Wilson extern zio_t *zio_walk_children(zio_t *pio, zio_link_t **);
539a3f829aeSBill Moore extern zio_t *zio_unique_parent(zio_t *cio);
540a3f829aeSBill Moore extern void zio_add_child(zio_t *pio, zio_t *cio);
541a3f829aeSBill Moore 
542fa9e4066Sahrens extern void *zio_buf_alloc(size_t size);
543fa9e4066Sahrens extern void zio_buf_free(void *buf, size_t size);
544ad23a2dbSjohansen extern void *zio_data_buf_alloc(size_t size);
545ad23a2dbSjohansen extern void zio_data_buf_free(void *buf, size_t size);
546fa9e4066Sahrens 
547770499e1SDan Kimmel extern void zio_push_transform(zio_t *zio, struct abd *abd, uint64_t size,
548dcbf3bd6SGeorge Wilson     uint64_t bufsize, zio_transform_func_t *transform);
549dcbf3bd6SGeorge Wilson extern void zio_pop_transforms(zio_t *zio);
550dcbf3bd6SGeorge Wilson 
5510a4e9518Sgw extern void zio_resubmit_stage_async(void *);
552fa9e4066Sahrens 
553fa9e4066Sahrens extern zio_t *zio_vdev_child_io(zio_t *zio, blkptr_t *bp, vdev_t *vd,
554770499e1SDan Kimmel     uint64_t offset, struct abd *data, uint64_t size, int type,
55569962b56SMatthew Ahrens     zio_priority_t priority, enum zio_flag flags,
55669962b56SMatthew Ahrens     zio_done_func_t *done, void *private);
557fa9e4066Sahrens 
558e14bb325SJeff Bonwick extern zio_t *zio_vdev_delegated_io(vdev_t *vd, uint64_t offset,
5593a4b1be9SMatthew Ahrens     struct abd *data, uint64_t size, zio_type_t type, zio_priority_t priority,
560b24ab676SJeff Bonwick     enum zio_flag flags, zio_done_func_t *done, void *private);
561e14bb325SJeff Bonwick 
562fa9e4066Sahrens extern void zio_vdev_io_bypass(zio_t *zio);
563fa9e4066Sahrens extern void zio_vdev_io_reissue(zio_t *zio);
564fa9e4066Sahrens extern void zio_vdev_io_redone(zio_t *zio);
565fa9e4066Sahrens 
566fa9e4066Sahrens extern void zio_checksum_verified(zio_t *zio);
567e14bb325SJeff Bonwick extern int zio_worst_error(int e1, int e2);
568fa9e4066Sahrens 
569b24ab676SJeff Bonwick extern enum zio_checksum zio_checksum_select(enum zio_checksum child,
570b24ab676SJeff Bonwick     enum zio_checksum parent);
571b24ab676SJeff Bonwick extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa,
572b24ab676SJeff Bonwick     enum zio_checksum child, enum zio_checksum parent);
573db1741f5SJustin T. Gibbs extern enum zio_compress zio_compress_select(spa_t *spa,
574db1741f5SJustin T. Gibbs     enum zio_compress child, enum zio_compress parent);
575fa9e4066Sahrens 
576*e0f1c0afSOlaf Faaland extern void zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t);
57754d692b7SGeorge Wilson extern int zio_resume(spa_t *spa);
578e14bb325SJeff Bonwick extern void zio_resume_wait(spa_t *spa);
579ea8dc4b6Seschrock 
580fa9e4066Sahrens /*
581fa9e4066Sahrens  * Initial setup and teardown.
582fa9e4066Sahrens  */
583fa9e4066Sahrens extern void zio_init(void);
584fa9e4066Sahrens extern void zio_fini(void);
585fa9e4066Sahrens 
586ea8dc4b6Seschrock /*
587ea8dc4b6Seschrock  * Fault injection
588ea8dc4b6Seschrock  */
589ea8dc4b6Seschrock struct zinject_record;
590ea8dc4b6Seschrock extern uint32_t zio_injection_enabled;
591ea8dc4b6Seschrock extern int zio_inject_fault(char *name, int flags, int *id,
592ea8dc4b6Seschrock     struct zinject_record *record);
593ea8dc4b6Seschrock extern int zio_inject_list_next(int *id, char *name, size_t buflen,
594ea8dc4b6Seschrock     struct zinject_record *record);
595ea8dc4b6Seschrock extern int zio_clear_fault(int id);
5961195e687SMark J Musante extern void zio_handle_panic_injection(spa_t *spa, char *tag, uint64_t type);
597ea8dc4b6Seschrock extern int zio_handle_fault_injection(zio_t *zio, int error);
5988956713aSEric Schrock extern int zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error);
59921bf64a7Sgw extern int zio_handle_label_injection(zio_t *zio, int error);
600468c413aSTim Haley extern void zio_handle_ignored_writes(zio_t *zio);
60197e81309SPrakash Surya extern hrtime_t zio_handle_io_delay(zio_t *zio);
602ea8dc4b6Seschrock 
60322fe2c88SJonathan Adams /*
60422fe2c88SJonathan Adams  * Checksum ereport functions
60522fe2c88SJonathan Adams  */
60622fe2c88SJonathan Adams extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, struct zio *zio,
60722fe2c88SJonathan Adams     uint64_t offset, uint64_t length, void *arg, struct zio_bad_cksum *info);
60822fe2c88SJonathan Adams extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report,
60922fe2c88SJonathan Adams     const void *good_data, const void *bad_data, boolean_t drop_if_identical);
61022fe2c88SJonathan Adams 
61122fe2c88SJonathan Adams extern void zfs_ereport_send_interim_checksum(zio_cksum_report_t *report);
61222fe2c88SJonathan Adams extern void zfs_ereport_free_checksum(zio_cksum_report_t *report);
61322fe2c88SJonathan Adams 
61422fe2c88SJonathan Adams /* If we have the good data in hand, this function can be used */
61522fe2c88SJonathan Adams extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
61622fe2c88SJonathan Adams     struct zio *zio, uint64_t offset, uint64_t length,
61722fe2c88SJonathan Adams     const void *good_data, const void *bad_data, struct zio_bad_cksum *info);
61822fe2c88SJonathan Adams 
619468c413aSTim Haley /* Called from spa_sync(), but primarily an injection handler */
620468c413aSTim Haley extern void spa_handle_ignored_writes(spa_t *spa);
621468c413aSTim Haley 
6227802d7bfSMatthew Ahrens /* zbookmark_phys functions */
623a2cdcdd2SPaul Dagnelie boolean_t zbookmark_subtree_completed(const struct dnode_phys *dnp,
624a2cdcdd2SPaul Dagnelie     const zbookmark_phys_t *subtree_root, const zbookmark_phys_t *last_block);
625a2cdcdd2SPaul Dagnelie int zbookmark_compare(uint16_t dbss1, uint8_t ibs1, uint16_t dbss2,
626a2cdcdd2SPaul Dagnelie     uint8_t ibs2, const zbookmark_phys_t *zb1, const zbookmark_phys_t *zb2);
627ad135b5dSChristopher Siden 
628fa9e4066Sahrens #ifdef	__cplusplus
629fa9e4066Sahrens }
630fa9e4066Sahrens #endif
631fa9e4066Sahrens 
632fa9e4066Sahrens #endif	/* _ZIO_H */
633