FreeBSD ZFS
The Zettabyte File System
Defines | Functions | Variables

zio.c File Reference

#include <sys/zfs_context.h>
#include <sys/fm/fs/zfs.h>
#include <sys/spa.h>
#include <sys/txg.h>
#include <sys/spa_impl.h>
#include <sys/vdev_impl.h>
#include <sys/zio_impl.h>
#include <sys/zio_compress.h>
#include <sys/zio_checksum.h>
#include <sys/dmu_objset.h>
#include <sys/arc.h>
#include <sys/ddt.h>
#include <sys/trim_map.h>
Include dependency graph for zio.c:

Go to the source code of this file.

Defines

#define IO_IS_ALLOCATING(zio)   ((zio)->io_orig_pipeline & ZIO_STAGE_DVA_ALLOCATE)
 An allocating zio is one that either currently has the DVA allocate stage set or will have it later in its lifetime.

Functions

 SYSCTL_DECL (_vfs_zfs)
 SYSCTL_NODE (_vfs_zfs, OID_AUTO, zio, CTLFLAG_RW, 0,"ZFS ZIO")
 TUNABLE_INT ("vfs.zfs.zio.use_uma",&zio_use_uma)
 SYSCTL_INT (_vfs_zfs_zio, OID_AUTO, use_uma, CTLFLAG_RDTUN,&zio_use_uma, 0,"Use uma(9) for ZIO allocations")
 TUNABLE_INT ("vfs.zfs.zio.exclude_metadata",&zio_exclude_metadata)
 SYSCTL_INT (_vfs_zfs_zio, OID_AUTO, exclude_metadata, CTLFLAG_RDTUN,&zio_exclude_metadata, 0,"Exclude metadata buffers from dumps as well")
void zio_init (void)
void zio_fini (void)
void * zio_buf_alloc (size_t size)
 Use zio_buf_alloc to allocate ZFS metadata.
void * zio_data_buf_alloc (size_t size)
 Use zio_data_buf_alloc to allocate data.
void zio_buf_free (void *buf, size_t size)
void zio_data_buf_free (void *buf, size_t size)
static void zio_push_transform (zio_t *zio, void *data, uint64_t size, uint64_t bufsize, zio_transform_func_t *transform)
static void zio_pop_transforms (zio_t *zio)
static void zio_subblock (zio_t *zio, void *data, uint64_t size)
static void zio_decompress (zio_t *zio, void *data, uint64_t size)
zio_tzio_walk_parents (zio_t *cio)
zio_tzio_walk_children (zio_t *pio)
zio_tzio_unique_parent (zio_t *cio)
void zio_add_child (zio_t *pio, zio_t *cio)
static void zio_remove_child (zio_t *pio, zio_t *cio, zio_link_t *zl)
static boolean_t zio_wait_for_children (zio_t *zio, enum zio_child child, enum zio_wait_type wait)
static void zio_notify_parent (zio_t *pio, zio_t *zio, enum zio_wait_type wait)
static void zio_inherit_child_errors (zio_t *zio, enum zio_child c)
static zio_tzio_create (zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *private, zio_type_t type, int priority, enum zio_flag flags, vdev_t *vd, uint64_t offset, const zbookmark_t *zb, enum zio_stage stage, enum zio_stage pipeline)
 Create the various types of I/O (read, write, free, etc)
static void zio_destroy (zio_t *zio)
zio_tzio_null (zio_t *pio, spa_t *spa, vdev_t *vd, zio_done_func_t *done, void *private, enum zio_flag flags)
zio_tzio_root (spa_t *spa, zio_done_func_t *done, void *private, enum zio_flag flags)
zio_tzio_read (zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *private, int priority, enum zio_flag flags, const zbookmark_t *zb)
zio_tzio_write (zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, const zio_prop_t *zp, zio_done_func_t *ready, zio_done_func_t *done, void *private, int priority, enum zio_flag flags, const zbookmark_t *zb)
zio_tzio_rewrite (zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *private, int priority, enum zio_flag flags, zbookmark_t *zb)
void zio_write_override (zio_t *zio, blkptr_t *bp, int copies)
void zio_free (spa_t *spa, uint64_t txg, const blkptr_t *bp)
zio_tzio_free_sync (zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, uint64_t size, enum zio_flag flags)
zio_tzio_claim (zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, zio_done_func_t *done, void *private, enum zio_flag flags)
zio_tzio_ioctl (zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, uint64_t offset, uint64_t size, zio_done_func_t *done, void *private, int priority, enum zio_flag flags)
zio_tzio_read_phys (zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, zio_done_func_t *done, void *private, int priority, enum zio_flag flags, boolean_t labels)
zio_tzio_write_phys (zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, zio_done_func_t *done, void *private, int priority, enum zio_flag flags, boolean_t labels)
zio_tzio_vdev_child_io (zio_t *pio, blkptr_t *bp, vdev_t *vd, uint64_t offset, void *data, uint64_t size, int type, int priority, enum zio_flag flags, zio_done_func_t *done, void *private)
 Create a child I/O to do some work for us.
zio_tzio_vdev_delegated_io (vdev_t *vd, uint64_t offset, void *data, uint64_t size, int type, int priority, enum zio_flag flags, zio_done_func_t *done, void *private)
void zio_flush (zio_t *zio, vdev_t *vd)
zio_tzio_trim (zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, uint64_t size)
void zio_shrink (zio_t *zio, uint64_t size)
static int zio_read_bp_init (zio_t *zio)
 Prepare to read and write logical blocks.
static int zio_write_bp_init (zio_t *zio)
static int zio_free_bp_init (zio_t *zio)
static void zio_taskq_dispatch (zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
static boolean_t zio_taskq_member (zio_t *zio, enum zio_taskq_type q)
static int zio_issue_async (zio_t *zio)
void zio_interrupt (zio_t *zio)
void zio_execute (zio_t *zio)
 Execute the I/O pipeline until one of the following occurs:

  1. the I/O completes
  2. the pipeline stalls waiting for dependent child I/Os
  3. the I/O issues, so we're waiting for an I/O completion interrupt
  4. the I/O is delegated by vdev-level caching or aggregation
  5. the I/O is deferred due to vdev-level queueing
  6. the I/O is handed off to another thread.

int zio_wait (zio_t *zio)
 Initiate I/O, either sync or async.
void zio_nowait (zio_t *zio)
static void zio_reexecute (zio_t *pio)
 Reexecute or suspend/resume failed I/O.
void zio_suspend (spa_t *spa, zio_t *zio)
int zio_resume (spa_t *spa)
void zio_resume_wait (spa_t *spa)
static zio_tzio_read_gang (zio_t *pio, blkptr_t *bp, zio_gang_node_t *gn, void *data)
zio_tzio_rewrite_gang (zio_t *pio, blkptr_t *bp, zio_gang_node_t *gn, void *data)
zio_tzio_free_gang (zio_t *pio, blkptr_t *bp, zio_gang_node_t *gn, void *data)
zio_tzio_claim_gang (zio_t *pio, blkptr_t *bp, zio_gang_node_t *gn, void *data)
static void zio_gang_tree_assemble_done (zio_t *zio)
static zio_gang_node_tzio_gang_node_alloc (zio_gang_node_t **gnpp)
static void zio_gang_node_free (zio_gang_node_t **gnpp)
static void zio_gang_tree_free (zio_gang_node_t **gnpp)
static void zio_gang_tree_assemble (zio_t *gio, blkptr_t *bp, zio_gang_node_t **gnpp)
static void zio_gang_tree_issue (zio_t *pio, zio_gang_node_t *gn, blkptr_t *bp, void *data)
static int zio_gang_assemble (zio_t *zio)
static int zio_gang_issue (zio_t *zio)
static void zio_write_gang_member_ready (zio_t *zio)
static int zio_write_gang_block (zio_t *pio)
static void zio_ddt_child_read_done (zio_t *zio)
static int zio_ddt_read_start (zio_t *zio)
static int zio_ddt_read_done (zio_t *zio)
static boolean_t zio_ddt_collision (zio_t *zio, ddt_t *ddt, ddt_entry_t *dde)
static void zio_ddt_child_write_ready (zio_t *zio)
static void zio_ddt_child_write_done (zio_t *zio)
static void zio_ddt_ditto_write_done (zio_t *zio)
static int zio_ddt_write (zio_t *zio)
static int zio_ddt_free (zio_t *zio)
static int zio_dva_allocate (zio_t *zio)
static int zio_dva_free (zio_t *zio)
static int zio_dva_claim (zio_t *zio)
static void zio_dva_unallocate (zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp)
 Undo an allocation.
int zio_alloc_zil (spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t use_slog)
 Try to allocate an intent log block.
void zio_free_zil (spa_t *spa, uint64_t txg, blkptr_t *bp)
 Free an intent log block.
static int zio_vdev_io_start (zio_t *zio)
static int zio_vdev_io_done (zio_t *zio)
static void zio_vsd_default_cksum_finish (zio_cksum_report_t *zcr, const void *good_buf)
 For non-raidz ZIOs, we can just copy aside the bad data read from the disk, and use that to finish the checksum ereport later.
void zio_vsd_default_cksum_report (zio_t *zio, zio_cksum_report_t *zcr, void *ignored)
static int zio_vdev_io_assess (zio_t *zio)
void zio_vdev_io_reissue (zio_t *zio)
void zio_vdev_io_redone (zio_t *zio)
void zio_vdev_io_bypass (zio_t *zio)
static int zio_checksum_generate (zio_t *zio)
static int zio_checksum_verify (zio_t *zio)
void zio_checksum_verified (zio_t *zio)
 Called by RAID-Z to ensure we don't compute the checksum twice.
int zio_worst_error (int e1, int e2)
 Compare the severity of errors.
static int zio_ready (zio_t *zio)
static int zio_done (zio_t *zio)
boolean_t zbookmark_is_before (const dnode_phys_t *dnp, const zbookmark_t *zb1, const zbookmark_t *zb2)

Variables

int zio_use_uma = 0
static int zio_exclude_metadata = 0
zio_trim_stats_t zio_trim_stats
 See zio.h for more information about these fields.
static kstat_t * zio_trim_ksp
uint8_t zio_priority_table [ZIO_PRIORITY_TABLE_SIZE]
 I/O priority table.
char * zio_type_name [ZIO_TYPES]
 I/O type descriptions.
kmem_cache_t * zio_cache
kmem_cache_t * zio_link_cache
kmem_cache_t * zio_buf_cache [SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]
kmem_cache_t * zio_data_buf_cache [SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]
vmem_t * zio_alloc_arena
int zfs_mg_alloc_failures
 This value defines the number of allowed allocation failures per vdev.
boolean_t zio_requeue_io_start_cut_in_line = B_TRUE
int zio_buf_debug_limit = 0
static zio_pipe_stage_tzio_pipeline []
static zio_gang_issue_func_tzio_gang_issue_func [ZIO_TYPES]
ddt_entry_tfreedde

Detailed Description

Gang blocks

A gang block is a collection of small blocks that looks to the DMU like one large block. When zio_dva_allocate() cannot find a block of the requested size, due to either severe fragmentation or the pool being nearly full, it calls zio_write_gang_block() to construct the block from smaller fragments.

A gang block consists of a gang header (zio_gbh_phys_t) and up to three (SPA_GBH_NBLKPTRS) gang members. The gang header is just like an indirect block: it's an array of block pointers. It consumes only one sector and hence is allocatable regardless of fragmentation. The gang header's bps point to its gang members, which hold the data.

Gang blocks are self-checksumming, using the bp's <vdev, offset, txg> as the verifier to ensure uniqueness of the SHA256 checksum. Critically, the gang block bp's blk_cksum is the checksum of the data, not the gang header. This ensures that data block signatures (needed for deduplication) are independent of how the block is physically stored.

Gang blocks can be nested: a gang member may itself be a gang block. Thus every gang block is a tree in which root and all interior nodes are gang headers, and the leaves are normal blocks that contain user data. The root of the gang tree is called the gang leader.

To perform any operation (read, rewrite, free, claim) on a gang block, zio_gang_assemble() first assembles the gang tree (minus data leaves) in the io_gang_tree field of the original logical i/o by recursively reading the gang leader and all gang headers below it. This yields an in-core tree containing the contents of every gang header and the bps for every constituent of the gang block.

With the gang tree now assembled, zio_gang_issue() just walks the gang tree and invokes a callback on each bp. To free a gang block, zio_gang_issue() calls zio_free_gang() -- a trivial wrapper around zio_free() -- for each bp. zio_claim_gang() provides a similarly trivial wrapper for zio_claim(). zio_read_gang() is a wrapper around zio_read() that omits reading gang headers, since we already have those in io_gang_tree. zio_rewrite_gang() performs a zio_rewrite() of the data or, for gang headers, a zio_rewrite() of the gang header plus zio_checksum_compute() of the data to update the gang header's blk_cksum as described above.

The two-phase assemble/issue model solves the problem of partial failure -- what if you'd freed part of a gang block but then couldn't read the gang header for another part? Assembling the entire gang tree first ensures that all the necessary gang header I/O has succeeded before starting the actual work of free, claim, or write. Once the gang tree is assembled, free and claim are in-memory operations that cannot fail.

In the event that a gang write fails, zio_dva_unallocate() walks the gang tree to immediately free (i.e. insert back into the space map) everything we've allocated. This ensures that we don't get ENOSPC errors during repeated suspend/resume cycles due to a flaky device.

Gang rewrites only happen during sync-to-convergence. If we can't assemble the gang tree, we won't modify the block, so we can safely defer the free (knowing that the block is still intact). If we *can* assemble the gang tree, then even if some of the rewrites fail, zio_dva_unallocate() will free each constituent bp and we can allocate a new block on the next sync pass.

In all cases, the gang tree allows complete recovery from partial failure.

Definition in file zio.c.


Define Documentation

#define IO_IS_ALLOCATING (   zio)    ((zio)->io_orig_pipeline & ZIO_STAGE_DVA_ALLOCATE)

An allocating zio is one that either currently has the DVA allocate stage set or will have it later in its lifetime.

Definition at line 112 of file zio.c.


Function Documentation

SYSCTL_DECL ( _vfs_zfs  )
SYSCTL_INT ( _vfs_zfs_zio  ,
OID_AUTO  ,
use_uma  ,
CTLFLAG_RDTUN  ,
zio_use_uma,
,
"Use uma(9) for ZIO allocations"   
)
SYSCTL_INT ( _vfs_zfs_zio  ,
OID_AUTO  ,
exclude_metadata  ,
CTLFLAG_RDTUN  ,
zio_exclude_metadata,
,
"Exclude metadata buffers from dumps as well"   
)
SYSCTL_NODE ( _vfs_zfs  ,
OID_AUTO  ,
zio  ,
CTLFLAG_RW  ,
,
"ZFS ZIO"   
)
TUNABLE_INT ( "vfs.zfs.zio.exclude_metadata"  ,
zio_exclude_metadata 
)
TUNABLE_INT ( "vfs.zfs.zio.use_uma"  ,
zio_use_uma 
)
boolean_t zbookmark_is_before ( const dnode_phys_t dnp,
const zbookmark_t zb1,
const zbookmark_t zb2 
)
Parameters:
dnpThe dnode for zb1->zb_object

Definition at line 3110 of file zio.c.

void zio_add_child ( zio_t pio,
zio_t cio 
)

Definition at line 447 of file zio.c.

int zio_alloc_zil ( spa_t spa,
uint64_t  txg,
blkptr_t new_bp,
blkptr_t old_bp,
uint64_t  size,
boolean_t  use_slog 
)

Try to allocate an intent log block.

Returns:
0 on success, errno on failure.

Definition at line 2288 of file zio.c.

void* zio_buf_alloc ( size_t  size)

Use zio_buf_alloc to allocate ZFS metadata.

This data will appear in a crashdump if the kernel panics, so use it judiciously. Obviously, it's useful to inspect ZFS metadata, but if possible, we should avoid keeping excess / transient data in-core during a crashdump.

Definition at line 261 of file zio.c.

void zio_buf_free ( void *  buf,
size_t  size 
)

Definition at line 294 of file zio.c.

static int zio_checksum_generate ( zio_t zio) [static]

Definition at line 2640 of file zio.c.

void zio_checksum_verified ( zio_t zio)

Called by RAID-Z to ensure we don't compute the checksum twice.

Definition at line 2706 of file zio.c.

static int zio_checksum_verify ( zio_t zio) [static]

Definition at line 2671 of file zio.c.

zio_t* zio_claim ( zio_t pio,
spa_t spa,
uint64_t  txg,
const blkptr_t bp,
zio_done_func_t done,
void *  private,
enum zio_flag  flags 
)

Definition at line 758 of file zio.c.

zio_t* zio_claim_gang ( zio_t pio,
blkptr_t bp,
zio_gang_node_t gn,
void *  data 
)

Definition at line 1548 of file zio.c.

static zio_t* zio_create ( zio_t pio,
spa_t spa,
uint64_t  txg,
const blkptr_t bp,
void *  data,
uint64_t  size,
zio_done_func_t done,
void *  private,
zio_type_t  type,
int  priority,
enum zio_flag  flags,
vdev_t vd,
uint64_t  offset,
const zbookmark_t zb,
enum zio_stage  stage,
enum zio_stage  pipeline 
) [static]

Create the various types of I/O (read, write, free, etc)

Definition at line 550 of file zio.c.

void* zio_data_buf_alloc ( size_t  size)

Use zio_data_buf_alloc to allocate data.

The data will not appear in a crashdump if the kernel panics. This exists so that we will limit the amount of ZFS data that shows up in a kernel crashdump. (Thus reducing the amount of kernel heap dumped to disk when the kernel panics)

Definition at line 281 of file zio.c.

void zio_data_buf_free ( void *  buf,
size_t  size 
)

Definition at line 307 of file zio.c.

static void zio_ddt_child_read_done ( zio_t zio) [static]

Definition at line 1829 of file zio.c.

static void zio_ddt_child_write_done ( zio_t zio) [static]

Definition at line 2007 of file zio.c.

static void zio_ddt_child_write_ready ( zio_t zio) [static]

Definition at line 1983 of file zio.c.

static boolean_t zio_ddt_collision ( zio_t zio,
ddt_t ddt,
ddt_entry_t dde 
) [static]

Definition at line 1928 of file zio.c.

static void zio_ddt_ditto_write_done ( zio_t zio) [static]

Definition at line 2031 of file zio.c.

static int zio_ddt_free ( zio_t zio) [static]

Definition at line 2172 of file zio.c.

static int zio_ddt_read_done ( zio_t zio) [static]

Definition at line 1891 of file zio.c.

static int zio_ddt_read_start ( zio_t zio) [static]

Definition at line 1848 of file zio.c.

static int zio_ddt_write ( zio_t zio) [static]

Definition at line 2060 of file zio.c.

static void zio_decompress ( zio_t zio,
void *  data,
uint64_t  size 
) [static]

Definition at line 378 of file zio.c.

static void zio_destroy ( zio_t zio) [static]

Definition at line 631 of file zio.c.

static int zio_done ( zio_t zio) [static]

Definition at line 2800 of file zio.c.

static int zio_dva_allocate ( zio_t zio) [static]

Definition at line 2198 of file zio.c.

static int zio_dva_claim ( zio_t zio) [static]

Definition at line 2249 of file zio.c.

static int zio_dva_free ( zio_t zio) [static]

Definition at line 2241 of file zio.c.

static void zio_dva_unallocate ( zio_t zio,
zio_gang_node_t gn,
blkptr_t bp 
) [static]

Undo an allocation.

This is used by zio_done() when an I/O fails and we want to give back the block we just allocated. This handles both normal blocks and gang blocks.

Definition at line 2266 of file zio.c.

void zio_execute ( zio_t zio)

Execute the I/O pipeline until one of the following occurs:

  1. the I/O completes
  2. the pipeline stalls waiting for dependent child I/Os
  3. the I/O issues, so we're waiting for an I/O completion interrupt
  4. the I/O is delegated by vdev-level caching or aggregation
  5. the I/O is deferred due to vdev-level queueing
  6. the I/O is handed off to another thread.

In all cases, the pipeline stops whenever there's no CPU work; it never burns a thread in cv_wait().

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.

Definition at line 1219 of file zio.c.

void zio_fini ( void  )

Definition at line 217 of file zio.c.

void zio_flush ( zio_t zio,
vdev_t vd 
)

Definition at line 928 of file zio.c.

void zio_free ( spa_t spa,
uint64_t  txg,
const blkptr_t bp 
)

Definition at line 732 of file zio.c.

static int zio_free_bp_init ( zio_t zio) [static]

Definition at line 1116 of file zio.c.

zio_t* zio_free_gang ( zio_t pio,
blkptr_t bp,
zio_gang_node_t gn,
void *  data 
)

Definition at line 1539 of file zio.c.

zio_t* zio_free_sync ( zio_t pio,
spa_t spa,
uint64_t  txg,
const blkptr_t bp,
uint64_t  size,
enum zio_flag  flags 
)

Definition at line 738 of file zio.c.

void zio_free_zil ( spa_t spa,
uint64_t  txg,
blkptr_t bp 
)

Free an intent log block.

Definition at line 2332 of file zio.c.

static int zio_gang_assemble ( zio_t zio) [static]

Definition at line 1683 of file zio.c.

static int zio_gang_issue ( zio_t zio) [static]

Definition at line 1698 of file zio.c.

static zio_gang_node_t* zio_gang_node_alloc ( zio_gang_node_t **  gnpp) [static]

Definition at line 1566 of file zio.c.

static void zio_gang_node_free ( zio_gang_node_t **  gnpp) [static]

Definition at line 1580 of file zio.c.

static void zio_gang_tree_assemble ( zio_t gio,
blkptr_t bp,
zio_gang_node_t **  gnpp 
) [static]

Definition at line 1607 of file zio.c.

static void zio_gang_tree_assemble_done ( zio_t zio) [static]

Definition at line 1620 of file zio.c.

static void zio_gang_tree_free ( zio_gang_node_t **  gnpp) [static]

Definition at line 1593 of file zio.c.

static void zio_gang_tree_issue ( zio_t pio,
zio_gang_node_t gn,
blkptr_t bp,
void *  data 
) [static]

Definition at line 1648 of file zio.c.

static void zio_inherit_child_errors ( zio_t zio,
enum zio_child  c 
) [static]

Definition at line 540 of file zio.c.

void zio_init ( void  )

Definition at line 123 of file zio.c.

void zio_interrupt ( zio_t zio)

Definition at line 1196 of file zio.c.

zio_t* zio_ioctl ( zio_t pio,
spa_t spa,
vdev_t vd,
int  cmd,
uint64_t  offset,
uint64_t  size,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags 
)

Definition at line 787 of file zio.c.

static int zio_issue_async ( zio_t zio) [static]

Definition at line 1188 of file zio.c.

static void zio_notify_parent ( zio_t pio,
zio_t zio,
enum zio_wait_type  wait 
) [static]

Definition at line 520 of file zio.c.

void zio_nowait ( zio_t zio)

Definition at line 1292 of file zio.c.

zio_t* zio_null ( zio_t pio,
spa_t spa,
vdev_t vd,
zio_done_func_t done,
void *  private,
enum zio_flag  flags 
)

Definition at line 641 of file zio.c.

static void zio_pop_transforms ( zio_t zio) [static]

Definition at line 343 of file zio.c.

static void zio_push_transform ( zio_t zio,
void *  data,
uint64_t  size,
uint64_t  bufsize,
zio_transform_func_t transform 
) [static]

Definition at line 325 of file zio.c.

zio_t* zio_read ( zio_t pio,
spa_t spa,
const blkptr_t bp,
void *  data,
uint64_t  size,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags,
const zbookmark_t zb 
)

Definition at line 660 of file zio.c.

static int zio_read_bp_init ( zio_t zio) [static]

Prepare to read and write logical blocks.

Definition at line 967 of file zio.c.

static zio_t* zio_read_gang ( zio_t pio,
blkptr_t bp,
zio_gang_node_t gn,
void *  data 
) [static]

Definition at line 1490 of file zio.c.

zio_t* zio_read_phys ( zio_t pio,
vdev_t vd,
uint64_t  offset,
uint64_t  size,
void *  data,
int  checksum,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags,
boolean_t  labels 
)

Definition at line 812 of file zio.c.

static int zio_ready ( zio_t zio) [static]

Definition at line 2743 of file zio.c.

static void zio_reexecute ( zio_t pio) [static]

Reexecute or suspend/resume failed I/O.

Definition at line 1315 of file zio.c.

static void zio_remove_child ( zio_t pio,
zio_t cio,
zio_link_t zl 
) [static]

Definition at line 481 of file zio.c.

int zio_resume ( spa_t spa)

Definition at line 1394 of file zio.c.

void zio_resume_wait ( spa_t spa)

Definition at line 1416 of file zio.c.

zio_t* zio_rewrite ( zio_t pio,
spa_t spa,
uint64_t  txg,
blkptr_t bp,
void *  data,
uint64_t  size,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags,
zbookmark_t zb 
)

Definition at line 706 of file zio.c.

zio_t* zio_rewrite_gang ( zio_t pio,
blkptr_t bp,
zio_gang_node_t gn,
void *  data 
)

Definition at line 1501 of file zio.c.

zio_t* zio_root ( spa_t spa,
zio_done_func_t done,
void *  private,
enum zio_flag  flags 
)

Definition at line 654 of file zio.c.

void zio_shrink ( zio_t zio,
uint64_t  size 
)

Definition at line 947 of file zio.c.

static void zio_subblock ( zio_t zio,
void *  data,
uint64_t  size 
) [static]

Definition at line 369 of file zio.c.

void zio_suspend ( spa_t spa,
zio_t zio 
)

Definition at line 1363 of file zio.c.

static void zio_taskq_dispatch ( zio_t zio,
enum zio_taskq_type  q,
boolean_t  cutinline 
) [static]

Definition at line 1135 of file zio.c.

static boolean_t zio_taskq_member ( zio_t zio,
enum zio_taskq_type  q 
) [static]

Definition at line 1175 of file zio.c.

zio_t* zio_trim ( zio_t zio,
spa_t spa,
vdev_t vd,
uint64_t  offset,
uint64_t  size 
)

Definition at line 936 of file zio.c.

zio_t* zio_unique_parent ( zio_t cio)

Definition at line 438 of file zio.c.

zio_t* zio_vdev_child_io ( zio_t pio,
blkptr_t bp,
vdev_t vd,
uint64_t  offset,
void *  data,
uint64_t  size,
int  type,
int  priority,
enum zio_flag  flags,
zio_done_func_t done,
void *  private 
)

Create a child I/O to do some work for us.

Definition at line 869 of file zio.c.

zio_t* zio_vdev_delegated_io ( vdev_t vd,
uint64_t  offset,
void *  data,
uint64_t  size,
int  type,
int  priority,
enum zio_flag  flags,
zio_done_func_t done,
void *  private 
)

Definition at line 910 of file zio.c.

static int zio_vdev_io_assess ( zio_t zio) [static]

Definition at line 2534 of file zio.c.

void zio_vdev_io_bypass ( zio_t zio)

Definition at line 2625 of file zio.c.

static int zio_vdev_io_done ( zio_t zio) [static]

Definition at line 2458 of file zio.c.

void zio_vdev_io_redone ( zio_t zio)

Definition at line 2617 of file zio.c.

void zio_vdev_io_reissue ( zio_t zio)

Definition at line 2608 of file zio.c.

static int zio_vdev_io_start ( zio_t zio) [static]

Definition at line 2346 of file zio.c.

static void zio_vsd_default_cksum_finish ( zio_cksum_report_t zcr,
const void *  good_buf 
) [static]

For non-raidz ZIOs, we can just copy aside the bad data read from the disk, and use that to finish the checksum ereport later.

Definition at line 2512 of file zio.c.

void zio_vsd_default_cksum_report ( zio_t zio,
zio_cksum_report_t zcr,
void *  ignored 
)

Definition at line 2521 of file zio.c.

int zio_wait ( zio_t zio)

Initiate I/O, either sync or async.

Definition at line 1269 of file zio.c.

static boolean_t zio_wait_for_children ( zio_t zio,
enum zio_child  child,
enum zio_wait_type  wait 
) [static]

Definition at line 502 of file zio.c.

zio_t* zio_walk_children ( zio_t pio)
Note:
Callers must continue calling zio_walk_children until it returns NULL. Otherwise, the next caller will pick up the list walk in some indeterminate state. (Otherwise every caller would have to pass in a cookie to keep the state represented by io_walk_link, which gets annoying.)

Definition at line 422 of file zio.c.

zio_t* zio_walk_parents ( zio_t cio)
Note:
Callers must continue calling zio_walk_parents until it returns NULL. Otherwise, the next caller will pick up the list walk in some indeterminate state. (Otherwise every caller would have to pass in a cookie to keep the state represented by io_walk_link, which gets annoying.)

Definition at line 399 of file zio.c.

int zio_worst_error ( int  e1,
int  e2 
)

Compare the severity of errors.

Errors are ranked in the order 0, ENXIO, ECKSUM, EIO, other. An error of 0 indictes success. ENXIO indicates whole-device failure, which may be transient (e.g. unplugged) or permament. ECKSUM and EIO indicate errors that are specific to one I/O, and most likely permanent. Any other error is presumed to be worse because we weren't expecting it.

Definition at line 2721 of file zio.c.

zio_t* zio_write ( zio_t pio,
spa_t spa,
uint64_t  txg,
blkptr_t bp,
void *  data,
uint64_t  size,
const zio_prop_t zp,
zio_done_func_t ready,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags,
const zbookmark_t zb 
)

Definition at line 676 of file zio.c.

static int zio_write_bp_init ( zio_t zio) [static]

Definition at line 993 of file zio.c.

static int zio_write_gang_block ( zio_t pio) [static]

Definition at line 1749 of file zio.c.

static void zio_write_gang_member_ready ( zio_t zio) [static]

Definition at line 1719 of file zio.c.

void zio_write_override ( zio_t zio,
blkptr_t bp,
int  copies 
)

Definition at line 720 of file zio.c.

zio_t* zio_write_phys ( zio_t pio,
vdev_t vd,
uint64_t  offset,
uint64_t  size,
void *  data,
int  checksum,
zio_done_func_t done,
void *  private,
int  priority,
enum zio_flag  flags,
boolean_t  labels 
)

Definition at line 833 of file zio.c.


Variable Documentation

Definition at line 2169 of file zio.c.

vmem_t* zio_alloc_arena
kmem_cache_t* zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]

Definition at line 100 of file zio.c.

Definition at line 119 of file zio.c.

kmem_cache_t* zio_cache

Definition at line 98 of file zio.c.

kmem_cache_t* zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]

Definition at line 101 of file zio.c.

int zio_exclude_metadata = 0 [static]

Definition at line 49 of file zio.c.

Initial value:

Definition at line 1554 of file zio.c.

kmem_cache_t* zio_link_cache

Definition at line 99 of file zio.c.

static zio_pipe_stage_t * zio_pipeline [static]
uint8_t zio_priority_table[ZIO_PRIORITY_TABLE_SIZE]
Initial value:
 {
        0,      
        0,      
        0,      
        0,      
        1,      
        1,      
        4,      
        4,      
        6,      
        10,     
        20,     
        2,      
        30,     
}

I/O priority table.

Definition at line 69 of file zio.c.

Definition at line 114 of file zio.c.

kstat_t* zio_trim_ksp [static]

Definition at line 64 of file zio.c.

Initial value:
 {
        { "zio_trim_bytes",             KSTAT_DATA_UINT64 },
        { "zio_trim_success",           KSTAT_DATA_UINT64 },
        { "zio_trim_unsupported",       KSTAT_DATA_UINT64 },
        { "zio_trim_failed",            KSTAT_DATA_UINT64 },
}

See zio.h for more information about these fields.

Definition at line 57 of file zio.c.

char* zio_type_name[ZIO_TYPES]
Initial value:
 {
        "zio_null", "zio_read", "zio_write", "zio_free", "zio_claim",
        "zio_ioctl"
}

I/O type descriptions.

Definition at line 88 of file zio.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines