zio.h revision a3f829ae41ece20e7f5f63604e177aeeb8b24628
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ZIO_H
#define _ZIO_H
#include <sys/zfs_context.h>
#include <sys/zio_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct zio_block_tail {
/*
* Gang block headers are self-checksumming and contain an array
* of block pointers.
*/
#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
sizeof (zio_block_tail_t)) / sizeof (blkptr_t))
#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
sizeof (zio_block_tail_t) - \
(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
sizeof (uint64_t))
typedef struct zio_gbh {
enum zio_checksum {
ZIO_CHECKSUM_INHERIT = 0,
};
#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON
enum zio_compress {
ZIO_COMPRESS_INHERIT = 0,
};
#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
#define ZIO_FAILURE_MODE_WAIT 0
#define ZIO_FAILURE_MODE_CONTINUE 1
#define ZIO_FAILURE_MODE_PANIC 2
#define ZIO_PRIORITY_NOW (zio_priority_table[0])
#define ZIO_PRIORITY_TABLE_SIZE 10
#define ZIO_FLAG_MUSTSUCCEED 0x00000
#define ZIO_FLAG_CANFAIL 0x00001
#define ZIO_FLAG_SPECULATIVE 0x00002
#define ZIO_FLAG_CONFIG_WRITER 0x00004
#define ZIO_FLAG_DONT_RETRY 0x00008
#define ZIO_FLAG_DONT_CACHE 0x00010
#define ZIO_FLAG_DONT_QUEUE 0x00020
#define ZIO_FLAG_DONT_AGGREGATE 0x00040
#define ZIO_FLAG_DONT_PROPAGATE 0x00080
#define ZIO_FLAG_IO_BYPASS 0x00100
#define ZIO_FLAG_IO_REPAIR 0x00200
#define ZIO_FLAG_IO_RETRY 0x00400
#define ZIO_FLAG_IO_REWRITE 0x00800
#define ZIO_FLAG_SELF_HEAL 0x01000
#define ZIO_FLAG_RESILVER 0x02000
#define ZIO_FLAG_SCRUB 0x04000
#define ZIO_FLAG_SCRUB_THREAD 0x08000
#define ZIO_FLAG_PROBE 0x10000
#define ZIO_FLAG_GANG_CHILD 0x20000
#define ZIO_FLAG_RAW 0x40000
#define ZIO_FLAG_GANG_INHERIT \
(ZIO_FLAG_CANFAIL | \
ZIO_FLAG_SCRUB | \
#define ZIO_FLAG_VDEV_INHERIT \
#define ZIO_FLAG_AGG_INHERIT \
ZIO_FLAG_SCRUB | \
#define ZIO_PIPELINE_CONTINUE 0x100
#define ZIO_PIPELINE_STOP 0x101
#define ZIO_GANG_CHILD_FLAGS(zio) \
enum zio_child {
ZIO_CHILD_VDEV = 0,
};
enum zio_wait_type {
ZIO_WAIT_READY = 0,
};
/*
* We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent
* graveyard) to indicate checksum errors and fragmentation.
*/
extern char *zio_type_name[ZIO_TYPES];
/*
* A bookmark is a four-tuple <objset, object, level, blkid> that uniquely
* identifies any block in the pool. By convention, the meta-objset (MOS)
* is objset 0, the meta-dnode is object 0, the root block (osphys_t) is
* level -1 of the meta-dnode, and intent log blocks (which are chained
* off the root block) have blkid == sequence number. In summary:
*
* mos is objset 0
* meta-dnode is object 0
* root block is <objset, 0, -1, 0>
* intent log is <objset, 0, -1, ZIL sequence number>
*
* Note: this structure is called a bookmark because its first purpose was
* to remember where to resume a pool-wide traverse. The absolute ordering
* for block visitation during traversal is defined in compare_bookmark().
*
* Note: this structure is passed between userland and the kernel.
* Therefore it must not change size or alignment between 32/64 bit
* compilation options.
*/
typedef struct zbookmark {
} zbookmark_t;
typedef struct zio_prop {
enum zio_checksum zp_checksum;
enum zio_compress zp_compress;
} zio_prop_t;
typedef struct zio_gang_node {
typedef struct zio_transform {
void *zt_orig_data;
struct zio_transform *zt_next;
/*
* The io_reexecute flags are distinct from io_flags because the child must
* be able to propagate them to the parent. The normal io_flags are local
* to the zio, not protected by any lock, and not modifiable by children;
* the reexecute flags are protected by io_lock, modifiable by children,
* and always propagated -- even when ZIO_FLAG_DONT_PROPAGATE is set.
*/
#define ZIO_REEXECUTE_NOW 0x01
#define ZIO_REEXECUTE_SUSPEND 0x02
typedef struct zio_link {
} zio_link_t;
struct zio {
/* Core information about this I/O */
enum zio_child io_child_type;
int io_cmd;
/* Callback info */
void *io_private;
/* Data represented by this I/O */
void *io_data;
/* Stuff for the vdev stack */
void *io_vsd;
/* Internal pipeline state */
int io_flags;
int io_orig_flags;
int io_error;
void *io_executor;
void *io_waiter;
/* FMA state */
};
extern void zio_resubmit_stage_async(void *);
/*
* Initial setup and teardown.
*/
extern void zio_init(void);
extern void zio_fini(void);
/*
* Fault injection
*/
struct zinject_record;
extern uint32_t zio_injection_enabled;
struct zinject_record *record);
struct zinject_record *record);
extern int zio_clear_fault(int id);
#ifdef __cplusplus
}
#endif
#endif /* _ZIO_H */