zio.h revision 67bd71c6cc629bab3aa0d595c624a667f1574254
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ZIO_H
#define _ZIO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#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))
#define ZIO_GET_IOSIZE(zio) \
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_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_FAILFAST 0x00002
#define ZIO_FLAG_CONFIG_HELD 0x00004
#define ZIO_FLAG_DONT_CACHE 0x00010
#define ZIO_FLAG_DONT_QUEUE 0x00020
#define ZIO_FLAG_DONT_PROPAGATE 0x00040
#define ZIO_FLAG_DONT_RETRY 0x00080
#define ZIO_FLAG_PHYSICAL 0x00100
#define ZIO_FLAG_IO_BYPASS 0x00200
#define ZIO_FLAG_IO_REPAIR 0x00400
#define ZIO_FLAG_SPECULATIVE 0x00800
#define ZIO_FLAG_RESILVER 0x01000
#define ZIO_FLAG_SCRUB 0x02000
#define ZIO_FLAG_SCRUB_THREAD 0x04000
#define ZIO_FLAG_SUBBLOCK 0x08000
#define ZIO_FLAG_NOBOOKMARK 0x10000
#define ZIO_FLAG_USER 0x20000
#define ZIO_FLAG_GANG_INHERIT \
(ZIO_FLAG_CANFAIL | \
ZIO_FLAG_SCRUB | \
#define ZIO_FLAG_VDEV_INHERIT \
/*
* We'll take the unused errno 'EBADE' (from the Convergent graveyard)
* to indicate checksum errors.
*/
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;
struct zio {
/* Core information about this I/O */
enum zio_checksum io_checksum;
enum zio_compress io_compress;
int io_ndvas;
/* 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;
struct dk_callback io_dk_callback;
int io_cmd;
int io_retries;
int io_error;
void *io_waiter;
/* FMA state */
};
zbookmark_t *zb);
zbookmark_t *zb);
/*
* Move an I/O to the next stage of the pipeline and execute that stage.
* There's no locking on io_stage because there's no legitimate way for
* multiple threads to be attempting to process the same I/O.
*/
/*
* Delegate I/O to a child vdev.
*/
/*
* 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 */