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. 27084fd14fSBrian Behlendorf * Copyright 2019, Joyent, Inc. 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 107eb633035STom Caputi #define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_CCM 108eb633035STom Caputi #define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF 109eb633035STom Caputi 110eb633035STom Caputi /* macros defining encryption lengths */ 111eb633035STom Caputi #define ZIO_OBJSET_MAC_LEN 32 112eb633035STom Caputi #define ZIO_DATA_IV_LEN 12 113eb633035STom Caputi #define ZIO_DATA_SALT_LEN 8 114eb633035STom Caputi #define ZIO_DATA_MAC_LEN 16 115eb633035STom Caputi 1165d7b4d43SMatthew Ahrens /* 1175d7b4d43SMatthew Ahrens * The number of "legacy" compression functions which can be set on individual 1185d7b4d43SMatthew Ahrens * objects. 1195d7b4d43SMatthew Ahrens */ 1205d7b4d43SMatthew Ahrens #define ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4 1215d7b4d43SMatthew Ahrens 122db1741f5SJustin T. Gibbs /* 123db1741f5SJustin T. Gibbs * The meaning of "compress = on" selected by the compression features enabled 124db1741f5SJustin T. Gibbs * on a given pool. 125db1741f5SJustin T. Gibbs */ 126db1741f5SJustin T. Gibbs #define ZIO_COMPRESS_LEGACY_ON_VALUE ZIO_COMPRESS_LZJB 127db1741f5SJustin T. Gibbs #define ZIO_COMPRESS_LZ4_ON_VALUE ZIO_COMPRESS_LZ4 128db1741f5SJustin T. Gibbs 129db1741f5SJustin T. Gibbs #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF 130fa9e4066Sahrens 131b24ab676SJeff Bonwick #define BOOTFS_COMPRESS_VALID(compress) \ 132b24ab676SJeff Bonwick ((compress) == ZIO_COMPRESS_LZJB || \ 133a6f561b4SSašo Kiselkov (compress) == ZIO_COMPRESS_LZ4 || \ 134c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_1 || \ 135c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_2 || \ 136c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_3 || \ 137c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_4 || \ 138c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_5 || \ 139c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_6 || \ 140c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_7 || \ 141c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_8 || \ 142c8811bd3SToomas Soome (compress) == ZIO_COMPRESS_GZIP_9 || \ 143db1741f5SJustin T. Gibbs (compress) == ZIO_COMPRESS_ON || \ 144b24ab676SJeff Bonwick (compress) == ZIO_COMPRESS_OFF) 145b24ab676SJeff Bonwick 1460a4e9518Sgw #define ZIO_FAILURE_MODE_WAIT 0 1470a4e9518Sgw #define ZIO_FAILURE_MODE_CONTINUE 1 1480a4e9518Sgw #define ZIO_FAILURE_MODE_PANIC 2 1490a4e9518Sgw 150e0f1c0afSOlaf Faaland typedef enum zio_suspend_reason { 151e0f1c0afSOlaf Faaland ZIO_SUSPEND_NONE = 0, 152e0f1c0afSOlaf Faaland ZIO_SUSPEND_IOERR, 153e0f1c0afSOlaf Faaland ZIO_SUSPEND_MMP, 154e0f1c0afSOlaf Faaland } zio_suspend_reason_t; 155e0f1c0afSOlaf Faaland 156b24ab676SJeff Bonwick enum zio_flag { 157b24ab676SJeff Bonwick /* 158b24ab676SJeff Bonwick * Flags inherited by gang, ddt, and vdev children, 159b24ab676SJeff Bonwick * and that must be equal for two zios to aggregate 160b24ab676SJeff Bonwick */ 161b24ab676SJeff Bonwick ZIO_FLAG_DONT_AGGREGATE = 1 << 0, 162b24ab676SJeff Bonwick ZIO_FLAG_IO_REPAIR = 1 << 1, 163b24ab676SJeff Bonwick ZIO_FLAG_SELF_HEAL = 1 << 2, 164b24ab676SJeff Bonwick ZIO_FLAG_RESILVER = 1 << 3, 165b24ab676SJeff Bonwick ZIO_FLAG_SCRUB = 1 << 4, 16644ecc532SGeorge Wilson ZIO_FLAG_SCAN_THREAD = 1 << 5, 1672a104a52SAlex Reece ZIO_FLAG_PHYSICAL = 1 << 6, 168b24ab676SJeff Bonwick 169b24ab676SJeff Bonwick #define ZIO_FLAG_AGG_INHERIT (ZIO_FLAG_CANFAIL - 1) 170b24ab676SJeff Bonwick 171b24ab676SJeff Bonwick /* 172b24ab676SJeff Bonwick * Flags inherited by ddt, gang, and vdev children. 173b24ab676SJeff Bonwick */ 1742a104a52SAlex Reece ZIO_FLAG_CANFAIL = 1 << 7, /* must be first for INHERIT */ 1752a104a52SAlex Reece ZIO_FLAG_SPECULATIVE = 1 << 8, 1762a104a52SAlex Reece ZIO_FLAG_CONFIG_WRITER = 1 << 9, 1772a104a52SAlex Reece ZIO_FLAG_DONT_RETRY = 1 << 10, 1782a104a52SAlex Reece ZIO_FLAG_DONT_CACHE = 1 << 11, 1792a104a52SAlex Reece ZIO_FLAG_NODATA = 1 << 12, 1802a104a52SAlex Reece ZIO_FLAG_INDUCE_DAMAGE = 1 << 13, 1810f7643c7SGeorge Wilson ZIO_FLAG_IO_ALLOCATING = 1 << 14, 182b24ab676SJeff Bonwick 183b24ab676SJeff Bonwick #define ZIO_FLAG_DDT_INHERIT (ZIO_FLAG_IO_RETRY - 1) 184b24ab676SJeff Bonwick #define ZIO_FLAG_GANG_INHERIT (ZIO_FLAG_IO_RETRY - 1) 185b24ab676SJeff Bonwick 186b24ab676SJeff Bonwick /* 187b24ab676SJeff Bonwick * Flags inherited by vdev children. 188b24ab676SJeff Bonwick */ 1890f7643c7SGeorge Wilson ZIO_FLAG_IO_RETRY = 1 << 15, /* must be first for INHERIT */ 1900f7643c7SGeorge Wilson ZIO_FLAG_PROBE = 1 << 16, 1910f7643c7SGeorge Wilson ZIO_FLAG_TRYHARD = 1 << 17, 1920f7643c7SGeorge Wilson ZIO_FLAG_OPTIONAL = 1 << 18, 193b24ab676SJeff Bonwick 194b24ab676SJeff Bonwick #define ZIO_FLAG_VDEV_INHERIT (ZIO_FLAG_DONT_QUEUE - 1) 195b24ab676SJeff Bonwick 196b24ab676SJeff Bonwick /* 197b24ab676SJeff Bonwick * Flags not inherited by any children. 198b24ab676SJeff Bonwick */ 1990f7643c7SGeorge Wilson ZIO_FLAG_DONT_QUEUE = 1 << 19, /* must be first for INHERIT */ 2000f7643c7SGeorge Wilson ZIO_FLAG_DONT_PROPAGATE = 1 << 20, 2010f7643c7SGeorge Wilson ZIO_FLAG_IO_BYPASS = 1 << 21, 2020f7643c7SGeorge Wilson ZIO_FLAG_IO_REWRITE = 1 << 22, 203eb633035STom Caputi ZIO_FLAG_RAW_COMPRESS = 1 << 23, 204eb633035STom Caputi ZIO_FLAG_RAW_ENCRYPT = 1 << 24, 205eb633035STom Caputi ZIO_FLAG_GANG_CHILD = 1 << 25, 206eb633035STom Caputi ZIO_FLAG_DDT_CHILD = 1 << 26, 207eb633035STom Caputi ZIO_FLAG_GODFATHER = 1 << 27, 208eb633035STom Caputi ZIO_FLAG_NOPWRITE = 1 << 28, 209eb633035STom Caputi ZIO_FLAG_REEXECUTED = 1 << 29, 210eb633035STom Caputi ZIO_FLAG_DELEGATED = 1 << 30, 211b24ab676SJeff Bonwick }; 212b24ab676SJeff Bonwick 213b24ab676SJeff Bonwick #define ZIO_FLAG_MUSTSUCCEED 0 214eb633035STom Caputi #define ZIO_FLAG_RAW (ZIO_FLAG_RAW_COMPRESS | ZIO_FLAG_RAW_ENCRYPT) 215b24ab676SJeff Bonwick 216b24ab676SJeff Bonwick #define ZIO_DDT_CHILD_FLAGS(zio) \ 217b24ab676SJeff Bonwick (((zio)->io_flags & ZIO_FLAG_DDT_INHERIT) | \ 218b24ab676SJeff Bonwick ZIO_FLAG_DDT_CHILD | ZIO_FLAG_CANFAIL) 219b24ab676SJeff Bonwick 220e14bb325SJeff Bonwick #define ZIO_GANG_CHILD_FLAGS(zio) \ 221e14bb325SJeff Bonwick (((zio)->io_flags & ZIO_FLAG_GANG_INHERIT) | \ 222e14bb325SJeff Bonwick ZIO_FLAG_GANG_CHILD | ZIO_FLAG_CANFAIL) 223e14bb325SJeff Bonwick 224b24ab676SJeff Bonwick #define ZIO_VDEV_CHILD_FLAGS(zio) \ 225b24ab676SJeff Bonwick (((zio)->io_flags & ZIO_FLAG_VDEV_INHERIT) | \ 2265cabbc6bSPrashanth Sreenivasa ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_CANFAIL) 227b24ab676SJeff Bonwick 228d6e1c446SGeorge Wilson #define ZIO_CHILD_BIT(x) (1 << (x)) 229d6e1c446SGeorge Wilson #define ZIO_CHILD_BIT_IS_SET(val, x) ((val) & (1 << (x))) 230d6e1c446SGeorge Wilson 231e14bb325SJeff Bonwick enum zio_child { 232e14bb325SJeff Bonwick ZIO_CHILD_VDEV = 0, 233e14bb325SJeff Bonwick ZIO_CHILD_GANG, 234b24ab676SJeff Bonwick ZIO_CHILD_DDT, 235e14bb325SJeff Bonwick ZIO_CHILD_LOGICAL, 236e14bb325SJeff Bonwick ZIO_CHILD_TYPES 237e14bb325SJeff Bonwick }; 238e14bb325SJeff Bonwick 239d6e1c446SGeorge Wilson #define ZIO_CHILD_VDEV_BIT ZIO_CHILD_BIT(ZIO_CHILD_VDEV) 240d6e1c446SGeorge Wilson #define ZIO_CHILD_GANG_BIT ZIO_CHILD_BIT(ZIO_CHILD_GANG) 241d6e1c446SGeorge Wilson #define ZIO_CHILD_DDT_BIT ZIO_CHILD_BIT(ZIO_CHILD_DDT) 242d6e1c446SGeorge Wilson #define ZIO_CHILD_LOGICAL_BIT ZIO_CHILD_BIT(ZIO_CHILD_LOGICAL) 243d6e1c446SGeorge Wilson #define ZIO_CHILD_ALL_BITS \ 244e0f1c0afSOlaf Faaland (ZIO_CHILD_VDEV_BIT | ZIO_CHILD_GANG_BIT | \ 245d6e1c446SGeorge Wilson ZIO_CHILD_DDT_BIT | ZIO_CHILD_LOGICAL_BIT) 246d6e1c446SGeorge Wilson 247e14bb325SJeff Bonwick enum zio_wait_type { 248e14bb325SJeff Bonwick ZIO_WAIT_READY = 0, 249e14bb325SJeff Bonwick ZIO_WAIT_DONE, 250e14bb325SJeff Bonwick ZIO_WAIT_TYPES 251e14bb325SJeff Bonwick }; 252e14bb325SJeff Bonwick 253fa9e4066Sahrens /* 254e7cbe64fSgw * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent 255e7cbe64fSgw * graveyard) to indicate checksum errors and fragmentation. 256fa9e4066Sahrens */ 257fa9e4066Sahrens #define ECKSUM EBADE 258e7cbe64fSgw #define EFRAGS EBADR 259fa9e4066Sahrens 260fa9e4066Sahrens typedef void zio_done_func_t(zio_t *zio); 261fa9e4066Sahrens 2620f7643c7SGeorge Wilson extern boolean_t zio_dva_throttle_enabled; 26369962b56SMatthew Ahrens extern const char *zio_type_name[ZIO_TYPES]; 264fa9e4066Sahrens 265ea8dc4b6Seschrock /* 266ea8dc4b6Seschrock * A bookmark is a four-tuple <objset, object, level, blkid> that uniquely 267ea8dc4b6Seschrock * identifies any block in the pool. By convention, the meta-objset (MOS) 268b24ab676SJeff Bonwick * is objset 0, and the meta-dnode is object 0. This covers all blocks 269b24ab676SJeff Bonwick * except root blocks and ZIL blocks, which are defined as follows: 270ea8dc4b6Seschrock * 271b24ab676SJeff Bonwick * Root blocks (objset_phys_t) are object 0, level -1: <objset, 0, -1, 0>. 272b24ab676SJeff Bonwick * ZIL blocks are bookmarked <objset, 0, -2, blkid == ZIL sequence number>. 273b24ab676SJeff Bonwick * dmu_sync()ed ZIL data blocks are bookmarked <objset, object, -2, blkid>. 274a2cdcdd2SPaul Dagnelie * dnode visit bookmarks are <objset, object id of dnode, -3, 0>. 275ea8dc4b6Seschrock * 276b24ab676SJeff Bonwick * Note: this structure is called a bookmark because its original purpose 277b24ab676SJeff Bonwick * was to remember where to resume a pool-wide traverse. 278ea8dc4b6Seschrock * 2797802d7bfSMatthew Ahrens * Note: this structure is passed between userland and the kernel, and is 2807802d7bfSMatthew Ahrens * stored on disk (by virtue of being incorporated into other on-disk 2817802d7bfSMatthew Ahrens * structures, e.g. dsl_scan_phys_t). 282ea8dc4b6Seschrock */ 2837802d7bfSMatthew Ahrens typedef struct zbookmark_phys { 284ea8dc4b6Seschrock uint64_t zb_objset; 285ea8dc4b6Seschrock uint64_t zb_object; 286ea8dc4b6Seschrock int64_t zb_level; 287ea8dc4b6Seschrock uint64_t zb_blkid; 2887802d7bfSMatthew Ahrens } zbookmark_phys_t; 289ea8dc4b6Seschrock 290b24ab676SJeff Bonwick #define SET_BOOKMARK(zb, objset, object, level, blkid) \ 291b24ab676SJeff Bonwick { \ 292b24ab676SJeff Bonwick (zb)->zb_objset = objset; \ 293b24ab676SJeff Bonwick (zb)->zb_object = object; \ 294b24ab676SJeff Bonwick (zb)->zb_level = level; \ 295b24ab676SJeff Bonwick (zb)->zb_blkid = blkid; \ 296b24ab676SJeff Bonwick } 297b24ab676SJeff Bonwick 298b24ab676SJeff Bonwick #define ZB_DESTROYED_OBJSET (-1ULL) 299b24ab676SJeff Bonwick 300b24ab676SJeff Bonwick #define ZB_ROOT_OBJECT (0ULL) 301b24ab676SJeff Bonwick #define ZB_ROOT_LEVEL (-1LL) 302b24ab676SJeff Bonwick #define ZB_ROOT_BLKID (0ULL) 303b24ab676SJeff Bonwick 304b24ab676SJeff Bonwick #define ZB_ZIL_OBJECT (0ULL) 305b24ab676SJeff Bonwick #define ZB_ZIL_LEVEL (-2LL) 306b24ab676SJeff Bonwick 307a2cdcdd2SPaul Dagnelie #define ZB_DNODE_LEVEL (-3LL) 308a2cdcdd2SPaul Dagnelie #define ZB_DNODE_BLKID (0ULL) 309a2cdcdd2SPaul Dagnelie 310ad135b5dSChristopher Siden #define ZB_IS_ZERO(zb) \ 311ad135b5dSChristopher Siden ((zb)->zb_objset == 0 && (zb)->zb_object == 0 && \ 312ad135b5dSChristopher Siden (zb)->zb_level == 0 && (zb)->zb_blkid == 0) 313ad135b5dSChristopher Siden #define ZB_IS_ROOT(zb) \ 314ad135b5dSChristopher Siden ((zb)->zb_object == ZB_ROOT_OBJECT && \ 315ad135b5dSChristopher Siden (zb)->zb_level == ZB_ROOT_LEVEL && \ 316ad135b5dSChristopher Siden (zb)->zb_blkid == ZB_ROOT_BLKID) 317ad135b5dSChristopher Siden 318e14bb325SJeff Bonwick typedef struct zio_prop { 319e14bb325SJeff Bonwick enum zio_checksum zp_checksum; 320e14bb325SJeff Bonwick enum zio_compress zp_compress; 321e14bb325SJeff Bonwick dmu_object_type_t zp_type; 322e14bb325SJeff Bonwick uint8_t zp_level; 323b24ab676SJeff Bonwick uint8_t zp_copies; 32480901aeaSGeorge Wilson boolean_t zp_dedup; 32580901aeaSGeorge Wilson boolean_t zp_dedup_verify; 32680901aeaSGeorge Wilson boolean_t zp_nopwrite; 327663207adSDon Brady uint32_t zp_zpl_smallblk; 328eb633035STom Caputi boolean_t zp_encrypt; 329eb633035STom Caputi boolean_t zp_byteorder; 330eb633035STom Caputi uint8_t zp_salt[ZIO_DATA_SALT_LEN]; 331eb633035STom Caputi uint8_t zp_iv[ZIO_DATA_IV_LEN]; 332eb633035STom Caputi uint8_t zp_mac[ZIO_DATA_MAC_LEN]; 333e14bb325SJeff Bonwick } zio_prop_t; 334e14bb325SJeff Bonwick 33522fe2c88SJonathan Adams typedef struct zio_cksum_report zio_cksum_report_t; 33622fe2c88SJonathan Adams 33722fe2c88SJonathan Adams typedef void zio_cksum_finish_f(zio_cksum_report_t *rep, 338eb633035STom Caputi const abd_t *good_data); 33922fe2c88SJonathan Adams typedef void zio_cksum_free_f(void *cbdata, size_t size); 34022fe2c88SJonathan Adams 34122fe2c88SJonathan Adams struct zio_bad_cksum; /* defined in zio_checksum.h */ 342ad135b5dSChristopher Siden struct dnode_phys; 343770499e1SDan Kimmel struct abd; 34422fe2c88SJonathan Adams 34522fe2c88SJonathan Adams struct zio_cksum_report { 34622fe2c88SJonathan Adams struct zio_cksum_report *zcr_next; 34722fe2c88SJonathan Adams nvlist_t *zcr_ereport; 34822fe2c88SJonathan Adams nvlist_t *zcr_detector; 34922fe2c88SJonathan Adams void *zcr_cbdata; 35022fe2c88SJonathan Adams size_t zcr_cbinfo; /* passed to zcr_free() */ 351b24ab676SJeff Bonwick uint64_t zcr_align; 35222fe2c88SJonathan Adams uint64_t zcr_length; 35322fe2c88SJonathan Adams zio_cksum_finish_f *zcr_finish; 35422fe2c88SJonathan Adams zio_cksum_free_f *zcr_free; 35522fe2c88SJonathan Adams 35622fe2c88SJonathan Adams /* internal use only */ 35722fe2c88SJonathan Adams struct zio_bad_cksum *zcr_ckinfo; /* information from failure */ 35822fe2c88SJonathan Adams }; 35922fe2c88SJonathan Adams 36022fe2c88SJonathan Adams typedef void zio_vsd_cksum_report_f(zio_t *zio, zio_cksum_report_t *zcr, 36122fe2c88SJonathan Adams void *arg); 36222fe2c88SJonathan Adams 36322fe2c88SJonathan Adams zio_vsd_cksum_report_f zio_vsd_default_cksum_report; 36422fe2c88SJonathan Adams 36522fe2c88SJonathan Adams typedef struct zio_vsd_ops { 36622fe2c88SJonathan Adams zio_done_func_t *vsd_free; 36722fe2c88SJonathan Adams zio_vsd_cksum_report_f *vsd_cksum_report; 36822fe2c88SJonathan Adams } zio_vsd_ops_t; 36922fe2c88SJonathan Adams 370e14bb325SJeff Bonwick typedef struct zio_gang_node { 371e14bb325SJeff Bonwick zio_gbh_phys_t *gn_gbh; 372e14bb325SJeff Bonwick struct zio_gang_node *gn_child[SPA_GBH_NBLKPTRS]; 373e14bb325SJeff Bonwick } zio_gang_node_t; 374e14bb325SJeff Bonwick 375e14bb325SJeff Bonwick typedef zio_t *zio_gang_issue_func_t(zio_t *zio, blkptr_t *bp, 376770499e1SDan Kimmel zio_gang_node_t *gn, struct abd *data, uint64_t offset); 377e14bb325SJeff Bonwick 378770499e1SDan Kimmel typedef void zio_transform_func_t(zio_t *zio, struct abd *data, uint64_t size); 379e14bb325SJeff Bonwick 380e14bb325SJeff Bonwick typedef struct zio_transform { 381770499e1SDan Kimmel struct abd *zt_orig_abd; 382e14bb325SJeff Bonwick uint64_t zt_orig_size; 383e14bb325SJeff Bonwick uint64_t zt_bufsize; 384e14bb325SJeff Bonwick zio_transform_func_t *zt_transform; 385e14bb325SJeff Bonwick struct zio_transform *zt_next; 386e14bb325SJeff Bonwick } zio_transform_t; 387e14bb325SJeff Bonwick 388e14bb325SJeff Bonwick typedef int zio_pipe_stage_t(zio_t *zio); 389e14bb325SJeff Bonwick 390e14bb325SJeff Bonwick /* 391e14bb325SJeff Bonwick * The io_reexecute flags are distinct from io_flags because the child must 392e14bb325SJeff Bonwick * be able to propagate them to the parent. The normal io_flags are local 393e14bb325SJeff Bonwick * to the zio, not protected by any lock, and not modifiable by children; 394e14bb325SJeff Bonwick * the reexecute flags are protected by io_lock, modifiable by children, 395e14bb325SJeff Bonwick * and always propagated -- even when ZIO_FLAG_DONT_PROPAGATE is set. 396e14bb325SJeff Bonwick */ 397e14bb325SJeff Bonwick #define ZIO_REEXECUTE_NOW 0x01 398e14bb325SJeff Bonwick #define ZIO_REEXECUTE_SUSPEND 0x02 399e14bb325SJeff Bonwick 400084fd14fSBrian Behlendorf /* 401084fd14fSBrian Behlendorf * The io_trim flags are used to specify the type of TRIM to perform. They 402084fd14fSBrian Behlendorf * only apply to ZIO_TYPE_TRIM zios and are distinct from io_flags. 403084fd14fSBrian Behlendorf */ 404084fd14fSBrian Behlendorf enum trim_flag { 405084fd14fSBrian Behlendorf ZIO_TRIM_SECURE = 1 << 0, 406084fd14fSBrian Behlendorf }; 407084fd14fSBrian Behlendorf 4088363e80aSGeorge Wilson typedef struct zio_alloc_list { 4098363e80aSGeorge Wilson list_t zal_list; 4108363e80aSGeorge Wilson uint64_t zal_size; 4118363e80aSGeorge Wilson } zio_alloc_list_t; 4128363e80aSGeorge Wilson 413a3f829aeSBill Moore typedef struct zio_link { 414a3f829aeSBill Moore zio_t *zl_parent; 415a3f829aeSBill Moore zio_t *zl_child; 416a3f829aeSBill Moore list_node_t zl_parent_node; 417a3f829aeSBill Moore list_node_t zl_child_node; 418a3f829aeSBill Moore } zio_link_t; 419a3f829aeSBill Moore 420fa9e4066Sahrens struct zio { 421fa9e4066Sahrens /* Core information about this I/O */ 4227802d7bfSMatthew Ahrens zbookmark_phys_t io_bookmark; 423e14bb325SJeff Bonwick zio_prop_t io_prop; 424e14bb325SJeff Bonwick zio_type_t io_type; 425e14bb325SJeff Bonwick enum zio_child io_child_type; 426084fd14fSBrian Behlendorf enum trim_flag io_trim_flags; 427e14bb325SJeff Bonwick int io_cmd; 42869962b56SMatthew Ahrens zio_priority_t io_priority; 429e14bb325SJeff Bonwick uint8_t io_reexecute; 430a3f829aeSBill Moore uint8_t io_state[ZIO_WAIT_TYPES]; 431fa9e4066Sahrens uint64_t io_txg; 432e14bb325SJeff Bonwick spa_t *io_spa; 433fa9e4066Sahrens blkptr_t *io_bp; 434b24ab676SJeff Bonwick blkptr_t *io_bp_override; 435fa9e4066Sahrens blkptr_t io_bp_copy; 436a3f829aeSBill Moore list_t io_parent_list; 437a3f829aeSBill Moore list_t io_child_list; 438ea8dc4b6Seschrock zio_t *io_logical; 439e14bb325SJeff Bonwick zio_transform_t *io_transform_stack; 440fa9e4066Sahrens 441fa9e4066Sahrens /* Callback info */ 442c717a561Smaybee zio_done_func_t *io_ready; 4438df0bcf0SPaul Dagnelie zio_done_func_t *io_children_ready; 44469962b56SMatthew Ahrens zio_done_func_t *io_physdone; 445fa9e4066Sahrens zio_done_func_t *io_done; 446fa9e4066Sahrens void *io_private; 447b24ab676SJeff Bonwick int64_t io_prev_space_delta; /* DMU private */ 448fa9e4066Sahrens blkptr_t io_bp_orig; 449fa9e4066Sahrens 450fa9e4066Sahrens /* Data represented by this I/O */ 451770499e1SDan Kimmel struct abd *io_abd; 452770499e1SDan Kimmel struct abd *io_orig_abd; 453fa9e4066Sahrens uint64_t io_size; 454b24ab676SJeff Bonwick uint64_t io_orig_size; 4555602294fSDan Kimmel /* io_lsize != io_orig_size iff this is a raw write */ 4565602294fSDan Kimmel uint64_t io_lsize; 457fa9e4066Sahrens 458fa9e4066Sahrens /* Stuff for the vdev stack */ 459fa9e4066Sahrens vdev_t *io_vd; 460fa9e4066Sahrens void *io_vsd; 46122fe2c88SJonathan Adams const zio_vsd_ops_t *io_vsd_ops; 462663207adSDon Brady metaslab_class_t *io_metaslab_class; /* dva throttle class */ 46322fe2c88SJonathan Adams 464fa9e4066Sahrens uint64_t io_offset; 465c55e05cbSMatthew Ahrens hrtime_t io_timestamp; 4660f7643c7SGeorge Wilson hrtime_t io_queued_timestamp; 46797e81309SPrakash Surya hrtime_t io_target_timestamp; 468*dd50e0ccSTony Hutter hrtime_t io_delta; /* vdev queue service delta */ 469*dd50e0ccSTony Hutter hrtime_t io_delay; /* Device access time (disk or */ 470*dd50e0ccSTony Hutter /* file). */ 47169962b56SMatthew Ahrens avl_node_t io_queue_node; 472fe319232SJustin T. Gibbs avl_node_t io_offset_node; 4730f7643c7SGeorge Wilson avl_node_t io_alloc_node; 474e0f1c0afSOlaf Faaland zio_alloc_list_t io_alloc_list; 475fa9e4066Sahrens 476fa9e4066Sahrens /* Internal pipeline state */ 477b24ab676SJeff Bonwick enum zio_flag io_flags; 478b24ab676SJeff Bonwick enum zio_stage io_stage; 479b24ab676SJeff Bonwick enum zio_stage io_pipeline; 480b24ab676SJeff Bonwick enum zio_flag io_orig_flags; 481b24ab676SJeff Bonwick enum zio_stage io_orig_stage; 482b24ab676SJeff Bonwick enum zio_stage io_orig_pipeline; 4830f7643c7SGeorge Wilson enum zio_stage io_pipeline_trace; 484e14bb325SJeff Bonwick int io_error; 485e14bb325SJeff Bonwick int io_child_error[ZIO_CHILD_TYPES]; 486e14bb325SJeff Bonwick uint64_t io_children[ZIO_CHILD_TYPES][ZIO_WAIT_TYPES]; 487b24ab676SJeff Bonwick uint64_t io_child_count; 48869962b56SMatthew Ahrens uint64_t io_phys_children; 489b24ab676SJeff Bonwick uint64_t io_parent_count; 490e14bb325SJeff Bonwick uint64_t *io_stall; 491f5383399SBill Moore zio_t *io_gang_leader; 492e14bb325SJeff Bonwick zio_gang_node_t *io_gang_tree; 493e14bb325SJeff Bonwick void *io_executor; 494fa9e4066Sahrens void *io_waiter; 495fa9e4066Sahrens kmutex_t io_lock; 496fa9e4066Sahrens kcondvar_t io_cv; 497f78cdc34SPaul Dagnelie int io_allocator; 498ea8dc4b6Seschrock 499ea8dc4b6Seschrock /* FMA state */ 50022fe2c88SJonathan Adams zio_cksum_report_t *io_cksum_report; 501ea8dc4b6Seschrock uint64_t io_ena; 5025aeb9474SGarrett D'Amore 5035aeb9474SGarrett D'Amore /* Taskq dispatching state */ 5045aeb9474SGarrett D'Amore taskq_ent_t io_tqent; 505fa9e4066Sahrens }; 506fa9e4066Sahrens 50794c2d0ebSMatthew Ahrens extern int zio_bookmark_compare(const void *, const void *); 5080f7643c7SGeorge Wilson 509a3f829aeSBill Moore extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, 510b24ab676SJeff Bonwick zio_done_func_t *done, void *private, enum zio_flag flags); 511fa9e4066Sahrens 512fa9e4066Sahrens extern zio_t *zio_root(spa_t *spa, 513b24ab676SJeff Bonwick zio_done_func_t *done, void *private, enum zio_flag flags); 514fa9e4066Sahrens 515770499e1SDan Kimmel extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, 516770499e1SDan Kimmel struct abd *data, uint64_t lsize, zio_done_func_t *done, void *private, 5177802d7bfSMatthew Ahrens zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); 518fa9e4066Sahrens 519e14bb325SJeff Bonwick extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, 520770499e1SDan Kimmel struct abd *data, uint64_t size, uint64_t psize, const zio_prop_t *zp, 5218df0bcf0SPaul Dagnelie zio_done_func_t *ready, zio_done_func_t *children_ready, 5228df0bcf0SPaul Dagnelie zio_done_func_t *physdone, zio_done_func_t *done, 5238df0bcf0SPaul Dagnelie void *private, zio_priority_t priority, enum zio_flag flags, 5248df0bcf0SPaul Dagnelie const zbookmark_phys_t *zb); 525fa9e4066Sahrens 526e14bb325SJeff Bonwick extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, 527770499e1SDan Kimmel struct abd *data, uint64_t size, zio_done_func_t *done, void *private, 5287802d7bfSMatthew Ahrens zio_priority_t priority, enum zio_flag flags, zbookmark_phys_t *zb); 529fa9e4066Sahrens 53080901aeaSGeorge Wilson extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies, 53180901aeaSGeorge Wilson boolean_t nopwrite); 53282c9918fSTim Haley 533b24ab676SJeff Bonwick extern void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp); 534fa9e4066Sahrens 535b24ab676SJeff Bonwick extern zio_t *zio_claim(zio_t *pio, spa_t *spa, uint64_t txg, 536b24ab676SJeff Bonwick const blkptr_t *bp, 537b24ab676SJeff Bonwick zio_done_func_t *done, void *private, enum zio_flag flags); 538fa9e4066Sahrens 539fa9e4066Sahrens extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, 54069962b56SMatthew Ahrens zio_done_func_t *done, void *private, enum zio_flag flags); 541fa9e4066Sahrens 542084fd14fSBrian Behlendorf extern zio_t *zio_trim(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, 543084fd14fSBrian Behlendorf zio_done_func_t *done, void *private, zio_priority_t priority, 544084fd14fSBrian Behlendorf enum zio_flag flags, enum trim_flag trim_flags); 545084fd14fSBrian Behlendorf 546fa9e4066Sahrens extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, 547770499e1SDan Kimmel uint64_t size, struct abd *data, int checksum, 54869962b56SMatthew Ahrens zio_done_func_t *done, void *private, zio_priority_t priority, 54969962b56SMatthew Ahrens enum zio_flag flags, boolean_t labels); 550fa9e4066Sahrens 551fa9e4066Sahrens extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset, 552770499e1SDan Kimmel uint64_t size, struct abd *data, int checksum, 55369962b56SMatthew Ahrens zio_done_func_t *done, void *private, zio_priority_t priority, 55469962b56SMatthew Ahrens enum zio_flag flags, boolean_t labels); 555fa9e4066Sahrens 556b24ab676SJeff Bonwick extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, 557b24ab676SJeff Bonwick const blkptr_t *bp, enum zio_flag flags); 558b24ab676SJeff Bonwick 559eb633035STom Caputi extern int zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, 560f78cdc34SPaul Dagnelie blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t *slog); 561eb633035STom Caputi extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); 56217f17c2dSbonwick extern void zio_flush(zio_t *zio, vdev_t *vd); 5636e1f5caaSNeil Perrin extern void zio_shrink(zio_t *zio, uint64_t size); 564fa9e4066Sahrens 565fa9e4066Sahrens extern int zio_wait(zio_t *zio); 566fa9e4066Sahrens extern void zio_nowait(zio_t *zio); 567e05725b1Sbonwick extern void zio_execute(zio_t *zio); 568e05725b1Sbonwick extern void zio_interrupt(zio_t *zio); 56997e81309SPrakash Surya extern void zio_delay_init(zio_t *zio); 57097e81309SPrakash Surya extern void zio_delay_interrupt(zio_t *zio); 571e05725b1Sbonwick 5720f7643c7SGeorge Wilson extern zio_t *zio_walk_parents(zio_t *cio, zio_link_t **); 5730f7643c7SGeorge Wilson extern zio_t *zio_walk_children(zio_t *pio, zio_link_t **); 574a3f829aeSBill Moore extern zio_t *zio_unique_parent(zio_t *cio); 575a3f829aeSBill Moore extern void zio_add_child(zio_t *pio, zio_t *cio); 576a3f829aeSBill Moore 577fa9e4066Sahrens extern void *zio_buf_alloc(size_t size); 578fa9e4066Sahrens extern void zio_buf_free(void *buf, size_t size); 579ad23a2dbSjohansen extern void *zio_data_buf_alloc(size_t size); 580ad23a2dbSjohansen extern void zio_data_buf_free(void *buf, size_t size); 581fa9e4066Sahrens 582770499e1SDan Kimmel extern void zio_push_transform(zio_t *zio, struct abd *abd, uint64_t size, 583dcbf3bd6SGeorge Wilson uint64_t bufsize, zio_transform_func_t *transform); 584dcbf3bd6SGeorge Wilson extern void zio_pop_transforms(zio_t *zio); 585dcbf3bd6SGeorge Wilson 5860a4e9518Sgw extern void zio_resubmit_stage_async(void *); 587fa9e4066Sahrens 588fa9e4066Sahrens extern zio_t *zio_vdev_child_io(zio_t *zio, blkptr_t *bp, vdev_t *vd, 589770499e1SDan Kimmel uint64_t offset, struct abd *data, uint64_t size, int type, 59069962b56SMatthew Ahrens zio_priority_t priority, enum zio_flag flags, 59169962b56SMatthew Ahrens zio_done_func_t *done, void *private); 592fa9e4066Sahrens 593e14bb325SJeff Bonwick extern zio_t *zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, 5943a4b1be9SMatthew Ahrens struct abd *data, uint64_t size, zio_type_t type, zio_priority_t priority, 595b24ab676SJeff Bonwick enum zio_flag flags, zio_done_func_t *done, void *private); 596e14bb325SJeff Bonwick 597fa9e4066Sahrens extern void zio_vdev_io_bypass(zio_t *zio); 598fa9e4066Sahrens extern void zio_vdev_io_reissue(zio_t *zio); 599fa9e4066Sahrens extern void zio_vdev_io_redone(zio_t *zio); 600fa9e4066Sahrens 601a3874b8bSToomas Soome extern void zio_change_priority(zio_t *pio, zio_priority_t priority); 602a3874b8bSToomas Soome 603fa9e4066Sahrens extern void zio_checksum_verified(zio_t *zio); 604e14bb325SJeff Bonwick extern int zio_worst_error(int e1, int e2); 605fa9e4066Sahrens 606b24ab676SJeff Bonwick extern enum zio_checksum zio_checksum_select(enum zio_checksum child, 607b24ab676SJeff Bonwick enum zio_checksum parent); 608b24ab676SJeff Bonwick extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa, 609b24ab676SJeff Bonwick enum zio_checksum child, enum zio_checksum parent); 610db1741f5SJustin T. Gibbs extern enum zio_compress zio_compress_select(spa_t *spa, 611db1741f5SJustin T. Gibbs enum zio_compress child, enum zio_compress parent); 612fa9e4066Sahrens 613e0f1c0afSOlaf Faaland extern void zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t); 61454d692b7SGeorge Wilson extern int zio_resume(spa_t *spa); 615e14bb325SJeff Bonwick extern void zio_resume_wait(spa_t *spa); 616ea8dc4b6Seschrock 617fa9e4066Sahrens /* 618fa9e4066Sahrens * Initial setup and teardown. 619fa9e4066Sahrens */ 620fa9e4066Sahrens extern void zio_init(void); 621fa9e4066Sahrens extern void zio_fini(void); 622fa9e4066Sahrens 623ea8dc4b6Seschrock /* 624ea8dc4b6Seschrock * Fault injection 625ea8dc4b6Seschrock */ 626ea8dc4b6Seschrock struct zinject_record; 627ea8dc4b6Seschrock extern uint32_t zio_injection_enabled; 628ea8dc4b6Seschrock extern int zio_inject_fault(char *name, int flags, int *id, 629ea8dc4b6Seschrock struct zinject_record *record); 630ea8dc4b6Seschrock extern int zio_inject_list_next(int *id, char *name, size_t buflen, 631ea8dc4b6Seschrock struct zinject_record *record); 632ea8dc4b6Seschrock extern int zio_clear_fault(int id); 6331195e687SMark J Musante extern void zio_handle_panic_injection(spa_t *spa, char *tag, uint64_t type); 634eb633035STom Caputi extern int zio_handle_decrypt_injection(spa_t *spa, const zbookmark_phys_t *zb, 635eb633035STom Caputi uint64_t type, int error); 636ea8dc4b6Seschrock extern int zio_handle_fault_injection(zio_t *zio, int error); 6378956713aSEric Schrock extern int zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error); 63821bf64a7Sgw extern int zio_handle_label_injection(zio_t *zio, int error); 639468c413aSTim Haley extern void zio_handle_ignored_writes(zio_t *zio); 64097e81309SPrakash Surya extern hrtime_t zio_handle_io_delay(zio_t *zio); 641ea8dc4b6Seschrock 64222fe2c88SJonathan Adams /* 64322fe2c88SJonathan Adams * Checksum ereport functions 64422fe2c88SJonathan Adams */ 645eb633035STom Caputi extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, 646eb633035STom Caputi const zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, 647eb633035STom Caputi uint64_t length, void *arg, struct zio_bad_cksum *info); 64822fe2c88SJonathan Adams extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report, 649eb633035STom Caputi const abd_t *good_data, const abd_t *bad_data, boolean_t drop_if_identical); 65022fe2c88SJonathan Adams 65122fe2c88SJonathan Adams extern void zfs_ereport_send_interim_checksum(zio_cksum_report_t *report); 65222fe2c88SJonathan Adams extern void zfs_ereport_free_checksum(zio_cksum_report_t *report); 65322fe2c88SJonathan Adams 65422fe2c88SJonathan Adams /* If we have the good data in hand, this function can be used */ 655*dd50e0ccSTony Hutter extern int zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd, 656eb633035STom Caputi const zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, 657eb633035STom Caputi uint64_t length, const abd_t *good_data, const abd_t *bad_data, 658eb633035STom Caputi struct zio_bad_cksum *info); 65922fe2c88SJonathan Adams 660468c413aSTim Haley /* Called from spa_sync(), but primarily an injection handler */ 661468c413aSTim Haley extern void spa_handle_ignored_writes(spa_t *spa); 662468c413aSTim Haley 6637802d7bfSMatthew Ahrens /* zbookmark_phys functions */ 664a2cdcdd2SPaul Dagnelie boolean_t zbookmark_subtree_completed(const struct dnode_phys *dnp, 665a2cdcdd2SPaul Dagnelie const zbookmark_phys_t *subtree_root, const zbookmark_phys_t *last_block); 666a2cdcdd2SPaul Dagnelie int zbookmark_compare(uint16_t dbss1, uint8_t ibs1, uint16_t dbss2, 667a2cdcdd2SPaul Dagnelie uint8_t ibs2, const zbookmark_phys_t *zb1, const zbookmark_phys_t *zb2); 668ad135b5dSChristopher Siden 669fa9e4066Sahrens #ifdef __cplusplus 670fa9e4066Sahrens } 671fa9e4066Sahrens #endif 672fa9e4066Sahrens 673fa9e4066Sahrens #endif /* _ZIO_H */ 674