Print this page
expandable RAID-Z


  47  * All storage pool operations go through the virtual device framework,
  48  * which provides data replication and I/O scheduling.
  49  */
  50 
  51 /*
  52  * Forward declarations that lots of things need.
  53  */
  54 typedef struct vdev_queue vdev_queue_t;
  55 typedef struct vdev_cache vdev_cache_t;
  56 typedef struct vdev_cache_entry vdev_cache_entry_t;
  57 
  58 /*
  59  * Virtual device operations
  60  */
  61 typedef int     vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift);
  62 typedef void    vdev_close_func_t(vdev_t *vd);
  63 typedef int     vdev_probe_func_t(vdev_t *vd);
  64 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
  65 typedef int     vdev_io_start_func_t(zio_t *zio);
  66 typedef int     vdev_io_done_func_t(zio_t *zio);
  67 typedef void    vdev_state_change_func_t(vdev_t *vd, int, int);

  68 
  69 typedef struct vdev_ops {
  70         vdev_open_func_t                *vdev_op_open;
  71         vdev_close_func_t               *vdev_op_close;
  72         vdev_probe_func_t               *vdev_op_probe;
  73         vdev_asize_func_t               *vdev_op_asize;
  74         vdev_io_start_func_t            *vdev_op_io_start;
  75         vdev_io_done_func_t             *vdev_op_io_done;
  76         vdev_state_change_func_t        *vdev_op_state_change;

  77         char                            vdev_op_type[16];
  78         boolean_t                       vdev_op_leaf;
  79 } vdev_ops_t;
  80 
  81 /*
  82  * Virtual device properties
  83  */
  84 struct vdev_cache_entry {
  85         char            *ve_data;
  86         uint64_t        ve_offset;
  87         uint64_t        ve_lastused;
  88         avl_node_t      ve_offset_node;
  89         avl_node_t      ve_lastused_node;
  90         uint32_t        ve_hits;
  91         uint16_t        ve_missed_update;
  92         zio_t           *ve_fill_io;
  93 };
  94 
  95 struct vdev_cache {
  96         avl_tree_t      vc_offset_tree;




  47  * All storage pool operations go through the virtual device framework,
  48  * which provides data replication and I/O scheduling.
  49  */
  50 
  51 /*
  52  * Forward declarations that lots of things need.
  53  */
  54 typedef struct vdev_queue vdev_queue_t;
  55 typedef struct vdev_cache vdev_cache_t;
  56 typedef struct vdev_cache_entry vdev_cache_entry_t;
  57 
  58 /*
  59  * Virtual device operations
  60  */
  61 typedef int     vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift);
  62 typedef void    vdev_close_func_t(vdev_t *vd);
  63 typedef int     vdev_probe_func_t(vdev_t *vd);
  64 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
  65 typedef int     vdev_io_start_func_t(zio_t *zio);
  66 typedef int     vdev_io_done_func_t(zio_t *zio);
  67 typedef void    vdev_state_change_func_t(vdev_t *vd, int fauled, int degraded);
  68 typedef uint8_t vdev_grid_func_t(vdev_t *vd);
  69 
  70 typedef struct vdev_ops {
  71         vdev_open_func_t                *vdev_op_open;
  72         vdev_close_func_t               *vdev_op_close;
  73         vdev_probe_func_t               *vdev_op_probe;
  74         vdev_asize_func_t               *vdev_op_asize;
  75         vdev_io_start_func_t            *vdev_op_io_start;
  76         vdev_io_done_func_t             *vdev_op_io_done;
  77         vdev_state_change_func_t        *vdev_op_state_change;
  78         vdev_grid_func_t                *vdev_op_grid;
  79         char                            vdev_op_type[16];
  80         boolean_t                       vdev_op_leaf;
  81 } vdev_ops_t;
  82 
  83 /*
  84  * Virtual device properties
  85  */
  86 struct vdev_cache_entry {
  87         char            *ve_data;
  88         uint64_t        ve_offset;
  89         uint64_t        ve_lastused;
  90         avl_node_t      ve_offset_node;
  91         avl_node_t      ve_lastused_node;
  92         uint32_t        ve_hits;
  93         uint16_t        ve_missed_update;
  94         zio_t           *ve_fill_io;
  95 };
  96 
  97 struct vdev_cache {
  98         avl_tree_t      vc_offset_tree;