Rebase master to b117
[zfs.git] / module / zfs / include / sys / vdev_impl.h
index 6523493..8240b66 100644 (file)
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -113,6 +113,7 @@ struct vdev {
        uint64_t        vdev_guid;      /* unique ID for this vdev      */
        uint64_t        vdev_guid_sum;  /* self guid + all child guids  */
        uint64_t        vdev_asize;     /* allocatable device capacity  */
+       uint64_t        vdev_min_asize; /* min acceptable asize         */
        uint64_t        vdev_ashift;    /* block alignment shift        */
        uint64_t        vdev_state;     /* see VDEV_STATE_* #defines    */
        uint64_t        vdev_prevstate; /* used when reopening a vdev   */
@@ -125,6 +126,7 @@ struct vdev {
        uint64_t        vdev_children;  /* number of children           */
        space_map_t     vdev_dtl[DTL_TYPES]; /* in-core dirty time logs */
        vdev_stat_t     vdev_stat;      /* virtual device statistics    */
+       boolean_t       vdev_expanding; /* expand the vdev?             */
 
        /*
         * Top-level vdev state.
@@ -159,6 +161,7 @@ struct vdev {
        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        */
        uint64_t        vdev_not_present; /* not present during import  */
        uint64_t        vdev_unspare;   /* unspare when resilvering done */
        hrtime_t        vdev_last_try;  /* last reopen time             */
@@ -188,8 +191,9 @@ struct vdev {
        kmutex_t        vdev_probe_lock; /* protects vdev_probe_zio     */
 };
 
-#define        VDEV_SKIP_SIZE          (8 << 10)
-#define        VDEV_BOOT_HEADER_SIZE   (8 << 10)
+#define        VDEV_PAD_SIZE           (8 << 10)
+/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
+#define        VDEV_SKIP_SIZE          VDEV_PAD_SIZE * 2
 #define        VDEV_PHYS_SIZE          (112 << 10)
 #define        VDEV_UBERBLOCK_RING     (128 << 10)
 
@@ -201,26 +205,14 @@ struct vdev {
        offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)])
 #define        VDEV_UBERBLOCK_SIZE(vd)         (1ULL << VDEV_UBERBLOCK_SHIFT(vd))
 
-/* ZFS boot block */
-#define        VDEV_BOOT_MAGIC         0x2f5b007b10cULL
-#define        VDEV_BOOT_VERSION       1               /* version number       */
-
-typedef struct vdev_boot_header {
-       uint64_t        vb_magic;               /* VDEV_BOOT_MAGIC      */
-       uint64_t        vb_version;             /* VDEV_BOOT_VERSION    */
-       uint64_t        vb_offset;              /* start offset (bytes) */
-       uint64_t        vb_size;                /* size (bytes)         */
-       char            vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)];
-} vdev_boot_header_t;
-
 typedef struct vdev_phys {
        char            vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)];
        zio_block_tail_t vp_zbt;
 } vdev_phys_t;
 
 typedef struct vdev_label {
-       char            vl_pad[VDEV_SKIP_SIZE];                 /*   8K */
-       vdev_boot_header_t vl_boot_header;                      /*   8K */
+       char            vl_pad1[VDEV_PAD_SIZE];                 /*  8K */
+       char            vl_pad2[VDEV_PAD_SIZE];                 /*  8K */
        vdev_phys_t     vl_vdev_phys;                           /* 112K */
        char            vl_uberblock[VDEV_UBERBLOCK_RING];      /* 128K */
 } vdev_label_t;                                                        /* 256K total */
@@ -249,6 +241,7 @@ typedef struct vdev_label {
 #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
@@ -269,6 +262,7 @@ extern void vdev_remove_parent(vdev_t *cvd);
 /*
  * vdev sync load and sync
  */
+extern void vdev_load_log_state(vdev_t *vd, nvlist_t *nv);
 extern void vdev_load(vdev_t *vd);
 extern void vdev_sync(vdev_t *vd, uint64_t txg);
 extern void vdev_sync_done(vdev_t *vd, uint64_t txg);
@@ -290,7 +284,8 @@ extern vdev_ops_t vdev_spare_ops;
  * Common size functions
  */
 extern uint64_t vdev_default_asize(vdev_t *vd, uint64_t psize);
-extern uint64_t vdev_get_rsize(vdev_t *vd);
+extern uint64_t vdev_get_min_asize(vdev_t *vd);
+extern void vdev_set_min_asize(vdev_t *vd);
 
 /*
  * zdb uses this tunable, so it must be declared here to make lint happy.