vdev_impl.h revision 095bcd6622e3b3520eb3b71039a3be5cfab25b74
/*
* 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 _SYS_VDEV_IMPL_H
#define _SYS_VDEV_IMPL_H
#include <sys/metaslab.h>
#include <sys/space_map.h>
#include <sys/uberblock_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Virtual device descriptors.
*
* All storage pool operations go through the virtual device framework,
* which provides data replication and I/O scheduling.
*/
/*
* Forward declarations that lots of things need.
*/
typedef struct vdev_queue vdev_queue_t;
typedef struct vdev_cache vdev_cache_t;
typedef struct vdev_cache_entry vdev_cache_entry_t;
/*
* Virtual device operations
*/
typedef struct vdev_ops {
char vdev_op_type[16];
} vdev_ops_t;
/*
* Virtual device properties
*/
struct vdev_cache_entry {
char *ve_data;
};
struct vdev_cache {
};
struct vdev_queue {
};
/*
* Virtual device descriptor
*/
struct vdev {
/*
* Common to all vdev types.
*/
void *vdev_tsd; /* type-specific data */
int vdev_open_error; /* error on last open */
/*
* Top-level vdev state.
*/
/*
* Leaf vdev state.
*/
char *vdev_path; /* vdev path (if any) */
char *vdev_devid; /* vdev devid (if any) */
char *vdev_physpath; /* vdev device path (if any) */
char *vdev_fru; /* physical FRU location */
/*
* For DTrace to work in userland (libzpool) context, these fields must
* remain at the end of the structure. DTrace will use the kernel's
* CTF definition for 'struct vdev', and since the size of a kmutex_t is
* larger in userland, the offsets for the rest fields would be
* incorrect.
*/
};
/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
#define VDEV_UBERBLOCK_SHIFT(vd) \
#define VDEV_UBERBLOCK_COUNT(vd) \
#define VDEV_UBERBLOCK_OFFSET(vd, n) \
typedef struct vdev_phys {
} vdev_phys_t;
typedef struct vdev_label {
} vdev_label_t; /* 256K total */
/*
* vdev_dirty() flags
*/
#define VDD_METASLAB 0x01
#define VDD_DTL 0x02
/*
* Size and offset of embedded boot loader region on each label.
* The total size of the first two labels plus the boot area is 4MB.
*/
/*
* Size of label regions at the start and end of each leaf device.
*/
#define VDEV_LABELS 4
#define VDEV_ALLOC_LOAD 0
#define VDEV_ALLOC_ADD 1
#define VDEV_ALLOC_SPARE 2
#define VDEV_ALLOC_L2CACHE 3
#define VDEV_ALLOC_ROOTPOOL 4
/*
* Allocate or free a vdev
*/
vdev_ops_t *ops);
/*
* Add or remove children and parents
*/
/*
* vdev sync load and sync
*/
/*
* Available vdev types.
*/
extern vdev_ops_t vdev_root_ops;
extern vdev_ops_t vdev_mirror_ops;
extern vdev_ops_t vdev_replacing_ops;
extern vdev_ops_t vdev_raidz_ops;
extern vdev_ops_t vdev_disk_ops;
extern vdev_ops_t vdev_file_ops;
extern vdev_ops_t vdev_missing_ops;
extern vdev_ops_t vdev_hole_ops;
extern vdev_ops_t vdev_spare_ops;
/*
* Common size functions
*/
/*
* zdb uses this tunable, so it must be declared here to make lint happy.
*/
extern int zfs_vdev_cache_size;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_VDEV_IMPL_H */