zio.h revision fa9e4066f08beec538e775443c5be79dd423fcab
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 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>
#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 0x0000
#define ZIO_FLAG_CANFAIL 0x0001
#define ZIO_FLAG_FAILFAST 0x0002
#define ZIO_FLAG_CONFIG_HELD 0x0004
#define ZIO_FLAG_DONT_CACHE 0x0010
#define ZIO_FLAG_DONT_QUEUE 0x0020
#define ZIO_FLAG_DONT_PROPAGATE 0x0040
#define ZIO_FLAG_DONT_RETRY 0x0080
#define ZIO_FLAG_PHYSICAL 0x0100
#define ZIO_FLAG_IO_BYPASS 0x0200
#define ZIO_FLAG_IO_REPAIR 0x0400
#define ZIO_FLAG_SPECULATIVE 0x0800
#define ZIO_FLAG_RESILVER 0x1000
#define ZIO_FLAG_SCRUB 0x2000
#define ZIO_FLAG_GANG_INHERIT \
(ZIO_FLAG_CANFAIL | \
#define ZIO_FLAG_VDEV_INHERIT \
/*
* We'll take the unused errno 'EBADE' (from the Convergent graveyard)
* to indicate checksum errors.
*/
typedef struct zio_transform zio_transform_t;
extern char *zio_type_name[ZIO_TYPES];
struct zio {
/* Core information about this I/O */
int io_checksum;
int io_compress;
int io_dva_index;
/* 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;
};
/*
* 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);
#ifdef __cplusplus
}
#endif
#endif /* _ZIO_H */