FreeBSD ZFS
The Zettabyte File System

sys/zio.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 
00022 /*
00023  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
00024  * Copyright (c) 2012 by Delphix. All rights reserved.
00025  */
00026 
00027 #ifndef _ZIO_H
00028 #define _ZIO_H
00029 
00030 #include <sys/zfs_context.h>
00031 #include <sys/spa.h>
00032 #include <sys/txg.h>
00033 #include <sys/avl.h>
00034 #include <sys/kstat.h>
00035 #include <sys/fs/zfs.h>
00036 #include <sys/zio_impl.h>
00037 
00038 #ifdef  __cplusplus
00039 extern "C" {
00040 #endif
00041 
00045 #define ZEC_MAGIC       0x210da7ab10c7a11ULL
00046 
00047 typedef struct zio_eck {
00048         uint64_t        zec_magic;      
00049         zio_cksum_t     zec_cksum;      
00050 } zio_eck_t;
00051 
00052 /*
00053  * Gang block headers are self-checksumming and contain an array
00054  * of block pointers.
00055  */
00056 #define SPA_GANGBLOCKSIZE       SPA_MINBLOCKSIZE
00057 #define SPA_GBH_NBLKPTRS        ((SPA_GANGBLOCKSIZE - \
00058         sizeof (zio_eck_t)) / sizeof (blkptr_t))
00059 #define SPA_GBH_FILLER          ((SPA_GANGBLOCKSIZE - \
00060         sizeof (zio_eck_t) - \
00061         (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
00062         sizeof (uint64_t))
00063 
00064 typedef struct zio_gbh {
00065         blkptr_t                zg_blkptr[SPA_GBH_NBLKPTRS];
00066         uint64_t                zg_filler[SPA_GBH_FILLER];
00067         zio_eck_t               zg_tail;
00068 } zio_gbh_phys_t;
00069 
00070 enum zio_checksum {
00071         ZIO_CHECKSUM_INHERIT = 0,
00072         ZIO_CHECKSUM_ON,
00073         ZIO_CHECKSUM_OFF,
00074         ZIO_CHECKSUM_LABEL,
00075         ZIO_CHECKSUM_GANG_HEADER,
00076         ZIO_CHECKSUM_ZILOG,
00077         ZIO_CHECKSUM_FLETCHER_2,
00078         ZIO_CHECKSUM_FLETCHER_4,
00079         ZIO_CHECKSUM_SHA256,
00080         ZIO_CHECKSUM_ZILOG2,
00081         ZIO_CHECKSUM_FUNCTIONS
00082 };
00083 
00084 #define ZIO_CHECKSUM_ON_VALUE   ZIO_CHECKSUM_FLETCHER_4
00085 #define ZIO_CHECKSUM_DEFAULT    ZIO_CHECKSUM_ON
00086 
00087 #define ZIO_CHECKSUM_MASK       0xffULL
00088 #define ZIO_CHECKSUM_VERIFY     (1 << 8)
00089 
00090 #define ZIO_DEDUPCHECKSUM       ZIO_CHECKSUM_SHA256
00091 #define ZIO_DEDUPDITTO_MIN      100
00092 
00093 enum zio_compress {
00094         ZIO_COMPRESS_INHERIT = 0,
00095         ZIO_COMPRESS_ON,
00096         ZIO_COMPRESS_OFF,
00097         ZIO_COMPRESS_LZJB,
00098         ZIO_COMPRESS_EMPTY,
00099         ZIO_COMPRESS_GZIP_1,
00100         ZIO_COMPRESS_GZIP_2,
00101         ZIO_COMPRESS_GZIP_3,
00102         ZIO_COMPRESS_GZIP_4,
00103         ZIO_COMPRESS_GZIP_5,
00104         ZIO_COMPRESS_GZIP_6,
00105         ZIO_COMPRESS_GZIP_7,
00106         ZIO_COMPRESS_GZIP_8,
00107         ZIO_COMPRESS_GZIP_9,
00108         ZIO_COMPRESS_ZLE,
00109         ZIO_COMPRESS_FUNCTIONS
00110 };
00111 
00112 #define ZIO_COMPRESS_ON_VALUE   ZIO_COMPRESS_LZJB
00113 #define ZIO_COMPRESS_DEFAULT    ZIO_COMPRESS_OFF
00114 
00115 #define BOOTFS_COMPRESS_VALID(compress)                 \
00116         ((compress) == ZIO_COMPRESS_LZJB ||             \
00117         ((compress) == ZIO_COMPRESS_ON &&               \
00118         ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) ||  \
00119         (compress) == ZIO_COMPRESS_OFF)
00120 
00121 #define ZIO_FAILURE_MODE_WAIT           0
00122 #define ZIO_FAILURE_MODE_CONTINUE       1
00123 #define ZIO_FAILURE_MODE_PANIC          2
00124 
00125 #define ZIO_PRIORITY_NOW                (zio_priority_table[0])
00126 #define ZIO_PRIORITY_SYNC_READ          (zio_priority_table[1])
00127 #define ZIO_PRIORITY_SYNC_WRITE         (zio_priority_table[2])
00128 #define ZIO_PRIORITY_LOG_WRITE          (zio_priority_table[3])
00129 #define ZIO_PRIORITY_CACHE_FILL         (zio_priority_table[4])
00130 #define ZIO_PRIORITY_AGG                (zio_priority_table[5])
00131 #define ZIO_PRIORITY_FREE               (zio_priority_table[6])
00132 #define ZIO_PRIORITY_ASYNC_WRITE        (zio_priority_table[7])
00133 #define ZIO_PRIORITY_ASYNC_READ         (zio_priority_table[8])
00134 #define ZIO_PRIORITY_RESILVER           (zio_priority_table[9])
00135 #define ZIO_PRIORITY_SCRUB              (zio_priority_table[10])
00136 #define ZIO_PRIORITY_DDT_PREFETCH       (zio_priority_table[11])
00137 #define ZIO_PRIORITY_TRIM               (zio_priority_table[12])
00138 #define ZIO_PRIORITY_TABLE_SIZE         13
00139 
00140 #define ZIO_PIPELINE_CONTINUE           0x100
00141 #define ZIO_PIPELINE_STOP               0x101
00142 
00143 enum zio_flag {
00144         /*
00145          * Flags inherited by gang, ddt, and vdev children,
00146          * and that must be equal for two zios to aggregate
00147          */
00148         ZIO_FLAG_DONT_AGGREGATE = 1 << 0,
00149         ZIO_FLAG_IO_REPAIR      = 1 << 1,
00150         ZIO_FLAG_SELF_HEAL      = 1 << 2,
00151         ZIO_FLAG_RESILVER       = 1 << 3,
00152         ZIO_FLAG_SCRUB          = 1 << 4,
00153         ZIO_FLAG_SCAN_THREAD    = 1 << 5,
00154 
00155 #define ZIO_FLAG_AGG_INHERIT    (ZIO_FLAG_CANFAIL - 1)
00156 
00157         /*
00158          * Flags inherited by ddt, gang, and vdev children.
00159          */
00160         ZIO_FLAG_CANFAIL        = 1 << 6,       /* must be first for INHERIT */
00161         ZIO_FLAG_SPECULATIVE    = 1 << 7,
00162         ZIO_FLAG_CONFIG_WRITER  = 1 << 8,
00163         ZIO_FLAG_DONT_RETRY     = 1 << 9,
00164         ZIO_FLAG_DONT_CACHE     = 1 << 10,
00165         ZIO_FLAG_NODATA         = 1 << 11,
00166         ZIO_FLAG_INDUCE_DAMAGE  = 1 << 12,
00167 
00168 #define ZIO_FLAG_DDT_INHERIT    (ZIO_FLAG_IO_RETRY - 1)
00169 #define ZIO_FLAG_GANG_INHERIT   (ZIO_FLAG_IO_RETRY - 1)
00170 
00171         /*
00172          * Flags inherited by vdev children.
00173          */
00174         ZIO_FLAG_IO_RETRY       = 1 << 13,      /* must be first for INHERIT */
00175         ZIO_FLAG_PROBE          = 1 << 14,
00176         ZIO_FLAG_TRYHARD        = 1 << 15,
00177         ZIO_FLAG_OPTIONAL       = 1 << 16,
00178 
00179 #define ZIO_FLAG_VDEV_INHERIT   (ZIO_FLAG_DONT_QUEUE - 1)
00180 
00181         /*
00182          * Flags not inherited by any children.
00183          */
00184         ZIO_FLAG_DONT_QUEUE     = 1 << 17,      /* must be first for INHERIT */
00185         ZIO_FLAG_DONT_PROPAGATE = 1 << 18,
00186         ZIO_FLAG_IO_BYPASS      = 1 << 19,
00187         ZIO_FLAG_IO_REWRITE     = 1 << 20,
00188         ZIO_FLAG_RAW            = 1 << 21,
00189         ZIO_FLAG_GANG_CHILD     = 1 << 22,
00190         ZIO_FLAG_DDT_CHILD      = 1 << 23,
00191         ZIO_FLAG_GODFATHER      = 1 << 24
00192 };
00193 
00194 #define ZIO_FLAG_MUSTSUCCEED            0
00195 
00196 #define ZIO_DDT_CHILD_FLAGS(zio)                                \
00197         (((zio)->io_flags & ZIO_FLAG_DDT_INHERIT) |             \
00198         ZIO_FLAG_DDT_CHILD | ZIO_FLAG_CANFAIL)
00199 
00200 #define ZIO_GANG_CHILD_FLAGS(zio)                               \
00201         (((zio)->io_flags & ZIO_FLAG_GANG_INHERIT) |            \
00202         ZIO_FLAG_GANG_CHILD | ZIO_FLAG_CANFAIL)
00203 
00204 #define ZIO_VDEV_CHILD_FLAGS(zio)                               \
00205         (((zio)->io_flags & ZIO_FLAG_VDEV_INHERIT) |            \
00206         ZIO_FLAG_CANFAIL)
00207 
00208 enum zio_child {
00209         ZIO_CHILD_VDEV = 0,
00210         ZIO_CHILD_GANG,
00211         ZIO_CHILD_DDT,
00212         ZIO_CHILD_LOGICAL,
00213         ZIO_CHILD_TYPES
00214 };
00215 
00216 enum zio_wait_type {
00217         ZIO_WAIT_READY = 0,
00218         ZIO_WAIT_DONE,
00219         ZIO_WAIT_TYPES
00220 };
00221 
00222 /*
00223  * We'll take the number 122 and 123 to indicate checksum errors and
00224  * fragmentation. Those doesn't collide with any errno values as they
00225  * are greater than ELAST.
00226  */
00227 #define ECKSUM  122
00228 #define EFRAGS  123
00229 
00230 typedef void zio_done_func_t(zio_t *zio);
00231 
00232 extern uint8_t zio_priority_table[ZIO_PRIORITY_TABLE_SIZE];
00233 extern char *zio_type_name[ZIO_TYPES];
00234 
00252 typedef struct zbookmark {
00253         uint64_t        zb_objset;
00254         uint64_t        zb_object;
00255         int64_t         zb_level;
00256         uint64_t        zb_blkid;
00257 } zbookmark_t;
00258 
00259 #define SET_BOOKMARK(zb, objset, object, level, blkid)  \
00260 {                                                       \
00261         (zb)->zb_objset = objset;                       \
00262         (zb)->zb_object = object;                       \
00263         (zb)->zb_level = level;                         \
00264         (zb)->zb_blkid = blkid;                         \
00265 }
00266 
00267 #define ZB_DESTROYED_OBJSET     (-1ULL)
00268 
00269 #define ZB_ROOT_OBJECT          (0ULL)
00270 #define ZB_ROOT_LEVEL           (-1LL)
00271 #define ZB_ROOT_BLKID           (0ULL)
00272 
00273 #define ZB_ZIL_OBJECT           (0ULL)
00274 #define ZB_ZIL_LEVEL            (-2LL)
00275 
00276 #define ZB_IS_ZERO(zb)                                          \
00277         ((zb)->zb_objset == 0 && (zb)->zb_object == 0 &&        \
00278         (zb)->zb_level == 0 && (zb)->zb_blkid == 0)
00279 #define ZB_IS_ROOT(zb)                          \
00280         ((zb)->zb_object == ZB_ROOT_OBJECT &&   \
00281         (zb)->zb_level == ZB_ROOT_LEVEL &&      \
00282         (zb)->zb_blkid == ZB_ROOT_BLKID)
00283 
00284 typedef struct zio_prop {
00285         enum zio_checksum       zp_checksum;
00286         enum zio_compress       zp_compress;
00287         dmu_object_type_t       zp_type;
00288         uint8_t                 zp_level;
00289         uint8_t                 zp_copies;
00290         uint8_t                 zp_dedup;
00291         uint8_t                 zp_dedup_verify;
00292 } zio_prop_t;
00293 
00294 typedef struct zio_cksum_report zio_cksum_report_t;
00295 
00296 typedef void zio_cksum_finish_f(zio_cksum_report_t *rep,
00297     const void *good_data);
00298 typedef void zio_cksum_free_f(void *cbdata, size_t size);
00299 
00300 struct zio_bad_cksum;                           /* defined in zio_checksum.h */
00301 struct dnode_phys;
00302 
00303 struct zio_cksum_report {
00304         struct zio_cksum_report *zcr_next;
00305         nvlist_t                *zcr_ereport;
00306         nvlist_t                *zcr_detector;
00307         void                    *zcr_cbdata;
00308         size_t                  zcr_cbinfo;     
00309         uint64_t                zcr_align;
00310         uint64_t                zcr_length;
00311         zio_cksum_finish_f      *zcr_finish;
00312         zio_cksum_free_f        *zcr_free;
00313 
00314         /* internal use only */
00315         struct zio_bad_cksum    *zcr_ckinfo;    
00316 };
00317 
00318 typedef void zio_vsd_cksum_report_f(zio_t *zio, zio_cksum_report_t *zcr,
00319     void *arg);
00320 
00321 zio_vsd_cksum_report_f  zio_vsd_default_cksum_report;
00322 
00323 typedef struct zio_vsd_ops {
00324         zio_done_func_t         *vsd_free;
00325         zio_vsd_cksum_report_f  *vsd_cksum_report;
00326 } zio_vsd_ops_t;
00327 
00328 typedef struct zio_gang_node {
00329         zio_gbh_phys_t          *gn_gbh;
00330         struct zio_gang_node    *gn_child[SPA_GBH_NBLKPTRS];
00331 } zio_gang_node_t;
00332 
00333 typedef zio_t *zio_gang_issue_func_t(zio_t *zio, blkptr_t *bp,
00334     zio_gang_node_t *gn, void *data);
00335 
00336 typedef void zio_transform_func_t(zio_t *zio, void *data, uint64_t size);
00337 
00338 typedef struct zio_transform {
00339         void                    *zt_orig_data;
00340         uint64_t                zt_orig_size;
00341         uint64_t                zt_bufsize;
00342         zio_transform_func_t    *zt_transform;
00343         struct zio_transform    *zt_next;
00344 } zio_transform_t;
00345 
00346 typedef int zio_pipe_stage_t(zio_t *zio);
00347 
00355 #define ZIO_REEXECUTE_NOW       0x01
00356 #define ZIO_REEXECUTE_SUSPEND   0x02
00357 
00358 typedef struct zio_link {
00359         zio_t           *zl_parent;
00360         zio_t           *zl_child;
00361         list_node_t     zl_parent_node;
00362         list_node_t     zl_child_node;
00363 } zio_link_t;
00364 
00365 /*
00366  * Used for TRIM kstat.
00367  */
00368 typedef struct zio_trim_stats {
00369         /*
00370          * Number of bytes successfully TRIMmed.
00371          */
00372         kstat_named_t zio_trim_bytes;
00373 
00374         /*
00375          * Number of successful TRIM requests.
00376          */
00377         kstat_named_t zio_trim_success;
00378 
00379         /*
00380          * Number of TRIM requests that failed because TRIM is not
00381          * supported.
00382          */
00383         kstat_named_t zio_trim_unsupported;
00384 
00385         /*
00386          * Number of TRIM requests that failed for other reasons.
00387          */
00388         kstat_named_t zio_trim_failed;
00389 } zio_trim_stats_t;
00390 
00391 extern zio_trim_stats_t zio_trim_stats;
00392 
00393 #define ZIO_TRIM_STAT_INCR(stat, val) \
00394         atomic_add_64(&zio_trim_stats.stat.value.ui64, (val));
00395 #define ZIO_TRIM_STAT_BUMP(stat) \
00396         ZIO_TRIM_STAT_INCR(stat, 1);
00397 
00398 struct zio {
00404         zbookmark_t     io_bookmark;
00405         zio_prop_t      io_prop;
00406         zio_type_t      io_type;
00407         enum zio_child  io_child_type;
00408         int             io_cmd;
00409         uint8_t         io_priority;
00410         uint8_t         io_reexecute;
00411         uint8_t         io_state[ZIO_WAIT_TYPES];
00412         uint64_t        io_txg;
00413         spa_t           *io_spa;
00414         blkptr_t        *io_bp;
00415         blkptr_t        *io_bp_override;
00416         blkptr_t        io_bp_copy;
00417         list_t          io_parent_list;
00418         list_t          io_child_list;
00419         zio_link_t      *io_walk_link;
00420         zio_t           *io_logical;
00421         zio_transform_t *io_transform_stack;
00422 
00428         zio_done_func_t *io_ready;
00429         zio_done_func_t *io_done;
00430         void            *io_private;
00431         int64_t         io_prev_space_delta;    
00432         blkptr_t        io_bp_orig;
00433 
00439         void            *io_data;
00440         void            *io_orig_data;
00441         uint64_t        io_size;
00442         uint64_t        io_orig_size;
00443 
00449         vdev_t          *io_vd;
00450         void            *io_vsd;
00451         const zio_vsd_ops_t *io_vsd_ops;
00452 
00453         uint64_t        io_offset;
00454         uint64_t        io_deadline;
00455         avl_node_t      io_offset_node;
00456         avl_node_t      io_deadline_node;
00457         avl_tree_t      *io_vdev_tree;
00458 
00464         enum zio_flag   io_flags;
00465         enum zio_stage  io_stage;
00466         enum zio_stage  io_pipeline;
00467         enum zio_flag   io_orig_flags;
00468         enum zio_stage  io_orig_stage;
00469         enum zio_stage  io_orig_pipeline;
00470         int             io_error;
00471         int             io_child_error[ZIO_CHILD_TYPES];
00472         uint64_t        io_children[ZIO_CHILD_TYPES][ZIO_WAIT_TYPES];
00473         uint64_t        io_child_count;
00474         uint64_t        io_parent_count;
00475         uint64_t        *io_stall;
00476         zio_t           *io_gang_leader;
00477         zio_gang_node_t *io_gang_tree;
00478         void            *io_executor;
00479         void            *io_waiter;
00480         kmutex_t        io_lock;
00481         kcondvar_t      io_cv;
00482 
00488         zio_cksum_report_t *io_cksum_report;
00489         uint64_t        io_ena;
00493 #ifdef _KERNEL
00494 
00498         struct ostask   io_task;
00500 #endif
00501         avl_node_t      io_trim_node;
00502         list_node_t     io_trim_link;
00503 };
00504 
00505 extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd,
00506     zio_done_func_t *done, void *priv, enum zio_flag flags);
00507 
00508 extern zio_t *zio_root(spa_t *spa,
00509     zio_done_func_t *done, void *priv, enum zio_flag flags);
00510 
00511 extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data,
00512     uint64_t size, zio_done_func_t *done, void *priv,
00513     int priority, enum zio_flag flags, const zbookmark_t *zb);
00514 
00515 extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
00516     void *data, uint64_t size, const zio_prop_t *zp,
00517     zio_done_func_t *ready, zio_done_func_t *done, void *priv,
00518     int priority, enum zio_flag flags, const zbookmark_t *zb);
00519 
00520 extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
00521     void *data, uint64_t size, zio_done_func_t *done, void *priv,
00522     int priority, enum zio_flag flags, zbookmark_t *zb);
00523 
00524 extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies);
00525 
00526 extern void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp);
00527 
00528 extern zio_t *zio_claim(zio_t *pio, spa_t *spa, uint64_t txg,
00529     const blkptr_t *bp,
00530     zio_done_func_t *done, void *priv, enum zio_flag flags);
00531 
00532 extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd,
00533     uint64_t offset, uint64_t size, zio_done_func_t *done, void *priv,
00534     int priority, enum zio_flag flags);
00535 
00536 extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset,
00537     uint64_t size, void *data, int checksum,
00538     zio_done_func_t *done, void *priv, int priority, enum zio_flag flags,
00539     boolean_t labels);
00540 
00541 extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset,
00542     uint64_t size, void *data, int checksum,
00543     zio_done_func_t *done, void *priv, int priority, enum zio_flag flags,
00544     boolean_t labels);
00545 
00546 extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg,
00547     const blkptr_t *bp, uint64_t size, enum zio_flag flags);
00548 
00549 extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp,
00550     blkptr_t *old_bp, uint64_t size, boolean_t use_slog);
00551 extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp);
00552 extern void zio_flush(zio_t *zio, vdev_t *vd);
00553 extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset,
00554     uint64_t size);
00555 extern void zio_shrink(zio_t *zio, uint64_t size);
00556 
00557 extern int zio_wait(zio_t *zio);
00558 extern void zio_nowait(zio_t *zio);
00559 extern void zio_execute(zio_t *zio);
00560 extern void zio_interrupt(zio_t *zio);
00561 
00562 extern zio_t *zio_walk_parents(zio_t *cio);
00563 extern zio_t *zio_walk_children(zio_t *pio);
00564 extern zio_t *zio_unique_parent(zio_t *cio);
00565 extern void zio_add_child(zio_t *pio, zio_t *cio);
00566 
00567 extern void *zio_buf_alloc(size_t size);
00568 extern void zio_buf_free(void *buf, size_t size);
00569 extern void *zio_data_buf_alloc(size_t size);
00570 extern void zio_data_buf_free(void *buf, size_t size);
00571 
00572 extern void zio_resubmit_stage_async(void *);
00573 
00574 extern zio_t *zio_vdev_child_io(zio_t *zio, blkptr_t *bp, vdev_t *vd,
00575     uint64_t offset, void *data, uint64_t size, int type, int priority,
00576     enum zio_flag flags, zio_done_func_t *done, void *priv);
00577 
00578 extern zio_t *zio_vdev_delegated_io(vdev_t *vd, uint64_t offset,
00579     void *data, uint64_t size, int type, int priority,
00580     enum zio_flag flags, zio_done_func_t *done, void *priv);
00581 
00582 extern void zio_vdev_io_bypass(zio_t *zio);
00583 extern void zio_vdev_io_reissue(zio_t *zio);
00584 extern void zio_vdev_io_redone(zio_t *zio);
00585 
00586 extern void zio_checksum_verified(zio_t *zio);
00587 extern int zio_worst_error(int e1, int e2);
00588 
00589 extern enum zio_checksum zio_checksum_select(enum zio_checksum child,
00590     enum zio_checksum parent);
00591 extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa,
00592     enum zio_checksum child, enum zio_checksum parent);
00593 extern enum zio_compress zio_compress_select(enum zio_compress child,
00594     enum zio_compress parent);
00595 
00596 extern void zio_suspend(spa_t *spa, zio_t *zio);
00597 extern int zio_resume(spa_t *spa);
00598 extern void zio_resume_wait(spa_t *spa);
00599 
00600 /*
00601  * Initial setup and teardown.
00602  */
00603 extern void zio_init(void);
00604 extern void zio_fini(void);
00605 
00606 /*
00607  * Fault injection
00608  */
00609 struct zinject_record;
00610 extern uint32_t zio_injection_enabled;
00611 extern int zio_inject_fault(char *name, int flags, int *id,
00612     struct zinject_record *record);
00613 extern int zio_inject_list_next(int *id, char *name, size_t buflen,
00614     struct zinject_record *record);
00615 extern int zio_clear_fault(int id);
00616 extern void zio_handle_panic_injection(spa_t *spa, char *tag, uint64_t type);
00617 extern int zio_handle_fault_injection(zio_t *zio, int error);
00618 extern int zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error);
00619 extern int zio_handle_label_injection(zio_t *zio, int error);
00620 extern void zio_handle_ignored_writes(zio_t *zio);
00621 
00622 /*
00623  * Checksum ereport functions
00624  */
00625 extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, struct zio *zio,
00626     uint64_t offset, uint64_t length, void *arg, struct zio_bad_cksum *info);
00627 extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report,
00628     const void *good_data, const void *bad_data, boolean_t drop_if_identical);
00629 
00630 extern void zfs_ereport_send_interim_checksum(zio_cksum_report_t *report);
00631 extern void zfs_ereport_free_checksum(zio_cksum_report_t *report);
00632 
00634 extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
00635     struct zio *zio, uint64_t offset, uint64_t length,
00636     const void *good_data, const void *bad_data, struct zio_bad_cksum *info);
00637 
00639 extern void spa_handle_ignored_writes(spa_t *spa);
00640 
00641 /* zbookmark functions */
00642 boolean_t zbookmark_is_before(const struct dnode_phys *dnp,
00643     const zbookmark_t *zb1, const zbookmark_t *zb2);
00644 
00645 #ifdef  __cplusplus
00646 }
00647 #endif
00648 
00649 #endif  /* _ZIO_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines