]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/vdev_impl.h
Add slow disk diagnosis to ZED
[mirror_zfs.git] / include / sys / vdev_impl.h
index c22087307ceb5527fbfde1fc4c0b913266769fb7..f39ebf031ceab7a41118c01ef738ce872384fc92 100644 (file)
@@ -6,7 +6,7 @@
  * 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
- * or http://www.opensolaris.org/os/licensing.
+ * or https://opensource.org/licenses/CDDL-1.0.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
@@ -20,7 +20,9 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
+ * Copyright (c) 2017, Intel Corporation.
+ * Copyright (c) 2023, Klara Inc.
  */
 
 #ifndef _SYS_VDEV_IMPL_H
@@ -37,6 +39,7 @@
 #include <sys/uberblock_impl.h>
 #include <sys/vdev_indirect_mapping.h>
 #include <sys/vdev_indirect_births.h>
+#include <sys/vdev_rebuild.h>
 #include <sys/vdev_removal.h>
 #include <sys/zfs_ratelimit.h>
 
@@ -55,24 +58,29 @@ extern "C" {
  * 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;
 struct abd;
 
-extern int zfs_vdev_queue_depth_pct;
-extern uint32_t zfs_vdev_async_write_max_active;
+extern uint_t zfs_vdev_queue_depth_pct;
+extern uint_t zfs_vdev_def_queue_depth;
+extern uint_t zfs_vdev_async_write_max_active;
 
 /*
  * Virtual device operations
  */
+typedef int    vdev_init_func_t(spa_t *spa, nvlist_t *nv, void **tsd);
+typedef void   vdev_kobj_post_evt_func_t(vdev_t *vd);
+typedef void   vdev_fini_func_t(vdev_t *vd);
 typedef int    vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size,
-    uint64_t *ashift);
+    uint64_t *ashift, uint64_t *pshift);
 typedef void   vdev_close_func_t(vdev_t *vd);
-typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
+typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize, uint64_t txg);
+typedef uint64_t vdev_min_asize_func_t(vdev_t *vd);
+typedef uint64_t vdev_min_alloc_func_t(vdev_t *vd);
 typedef void   vdev_io_start_func_t(zio_t *zio);
 typedef void   vdev_io_done_func_t(zio_t *zio);
 typedef void   vdev_state_change_func_t(vdev_t *vd, int, int);
-typedef boolean_t vdev_need_resilver_func_t(vdev_t *vd, uint64_t, size_t);
+typedef boolean_t vdev_need_resilver_func_t(vdev_t *vd, const dva_t *dva,
+    size_t psize, uint64_t phys_birth);
 typedef void   vdev_hold_func_t(vdev_t *vd);
 typedef void   vdev_rele_func_t(vdev_t *vd);
 
@@ -80,11 +88,28 @@ typedef void        vdev_remap_cb_t(uint64_t inner_offset, vdev_t *vd,
     uint64_t offset, uint64_t size, void *arg);
 typedef void   vdev_remap_func_t(vdev_t *vd, uint64_t offset, uint64_t size,
     vdev_remap_cb_t callback, void *arg);
+/*
+ * Given a target vdev, translates the logical range "in" to the physical
+ * range "res"
+ */
+typedef void vdev_xlation_func_t(vdev_t *cvd, const range_seg64_t *logical,
+    range_seg64_t *physical, range_seg64_t *remain);
+typedef uint64_t vdev_rebuild_asize_func_t(vdev_t *vd, uint64_t start,
+    uint64_t size, uint64_t max_segment);
+typedef void vdev_metaslab_init_func_t(vdev_t *vd, uint64_t *startp,
+    uint64_t *sizep);
+typedef void vdev_config_generate_func_t(vdev_t *vd, nvlist_t *nv);
+typedef uint64_t vdev_nparity_func_t(vdev_t *vd);
+typedef uint64_t vdev_ndisks_func_t(vdev_t *vd);
 
 typedef const struct vdev_ops {
+       vdev_init_func_t                *vdev_op_init;
+       vdev_fini_func_t                *vdev_op_fini;
        vdev_open_func_t                *vdev_op_open;
        vdev_close_func_t               *vdev_op_close;
        vdev_asize_func_t               *vdev_op_asize;
+       vdev_min_asize_func_t           *vdev_op_min_asize;
+       vdev_min_alloc_func_t           *vdev_op_min_alloc;
        vdev_io_start_func_t            *vdev_op_io_start;
        vdev_io_done_func_t             *vdev_op_io_done;
        vdev_state_change_func_t        *vdev_op_state_change;
@@ -92,6 +117,13 @@ typedef const struct vdev_ops {
        vdev_hold_func_t                *vdev_op_hold;
        vdev_rele_func_t                *vdev_op_rele;
        vdev_remap_func_t               *vdev_op_remap;
+       vdev_xlation_func_t             *vdev_op_xlate;
+       vdev_rebuild_asize_func_t       *vdev_op_rebuild_asize;
+       vdev_metaslab_init_func_t       *vdev_op_metaslab_init;
+       vdev_config_generate_func_t     *vdev_op_config_generate;
+       vdev_nparity_func_t             *vdev_op_nparity;
+       vdev_ndisks_func_t              *vdev_op_ndisks;
+       vdev_kobj_post_evt_func_t       *vdev_op_kobj_evt_post;
        char                            vdev_op_type[16];
        boolean_t                       vdev_op_leaf;
 } vdev_ops_t;
@@ -99,46 +131,41 @@ typedef const struct vdev_ops {
 /*
  * Virtual device properties
  */
-struct vdev_cache_entry {
-       struct abd      *ve_abd;
-       uint64_t        ve_offset;
-       clock_t         ve_lastused;
-       avl_node_t      ve_offset_node;
-       avl_node_t      ve_lastused_node;
-       uint32_t        ve_hits;
-       uint16_t        ve_missed_update;
-       zio_t           *ve_fill_io;
-};
-
-struct vdev_cache {
-       avl_tree_t      vc_offset_tree;
-       avl_tree_t      vc_lastused_tree;
-       kmutex_t        vc_lock;
-};
-
-typedef struct vdev_queue_class {
-       uint32_t        vqc_active;
-
-       /*
-        * Sorted by offset or timestamp, depending on if the queue is
-        * LBA-ordered vs FIFO.
-        */
-       avl_tree_t      vqc_queued_tree;
+typedef union vdev_queue_class {
+       struct {
+               ulong_t         vqc_list_numnodes;
+               list_t          vqc_list;
+       };
+       avl_tree_t      vqc_tree;
 } vdev_queue_class_t;
 
 struct vdev_queue {
        vdev_t          *vq_vdev;
        vdev_queue_class_t vq_class[ZIO_PRIORITY_NUM_QUEUEABLE];
-       avl_tree_t      vq_active_tree;
        avl_tree_t      vq_read_offset_tree;
        avl_tree_t      vq_write_offset_tree;
        uint64_t        vq_last_offset;
+       zio_priority_t  vq_last_prio;   /* Last sent I/O priority. */
+       uint32_t        vq_cqueued;     /* Classes with queued I/Os. */
+       uint32_t        vq_cactive[ZIO_PRIORITY_NUM_QUEUEABLE];
+       uint32_t        vq_active;      /* Number of active I/Os. */
+       uint32_t        vq_ia_active;   /* Active interactive I/Os. */
+       uint32_t        vq_nia_credit;  /* Non-interactive I/Os credit. */
+       list_t          vq_active_list; /* List of active I/Os. */
        hrtime_t        vq_io_complete_ts; /* time last i/o completed */
        hrtime_t        vq_io_delta_ts;
        zio_t           vq_io_search; /* used as local for stack reduction */
        kmutex_t        vq_lock;
 };
 
+typedef enum vdev_alloc_bias {
+       VDEV_BIAS_NONE,
+       VDEV_BIAS_LOG,          /* dedicated to ZIL data (SLOG) */
+       VDEV_BIAS_SPECIAL,      /* dedicated to ddt, metadata, and small blks */
+       VDEV_BIAS_DEDUP         /* dedicated to dedup metadata */
+} vdev_alloc_bias_t;
+
+
 /*
  * On-disk indirect vdev state.
  *
@@ -193,13 +220,30 @@ struct vdev {
        uint64_t        vdev_min_asize; /* min acceptable asize         */
        uint64_t        vdev_max_asize; /* max acceptable asize         */
        uint64_t        vdev_ashift;    /* block alignment shift        */
+
+       /*
+        * Logical block alignment shift
+        *
+        * The smallest sized/aligned I/O supported by the device.
+        */
+       uint64_t        vdev_logical_ashift;
+       /*
+        * Physical block alignment shift
+        *
+        * The device supports logical I/Os with vdev_logical_ashift
+        * size/alignment, but optimum performance will be achieved by
+        * aligning/sizing requests to vdev_physical_ashift.  Smaller
+        * requests may be inflated or incur device level read-modify-write
+        * operations.
+        *
+        * May be 0 to indicate no preference (i.e. use vdev_logical_ashift).
+        */
+       uint64_t        vdev_physical_ashift;
        uint64_t        vdev_state;     /* see VDEV_STATE_* #defines    */
        uint64_t        vdev_prevstate; /* used when reopening a vdev   */
        vdev_ops_t      *vdev_ops;      /* vdev operations              */
        spa_t           *vdev_spa;      /* spa for this vdev            */
        void            *vdev_tsd;      /* type-specific data           */
-       vnode_t         *vdev_name_vp;  /* vnode for pathname           */
-       vnode_t         *vdev_devid_vp; /* vnode for devid              */
        vdev_t          *vdev_top;      /* top-level vdev               */
        vdev_t          *vdev_parent;   /* parent vdev                  */
        vdev_t          **vdev_child;   /* array of children            */
@@ -209,9 +253,13 @@ struct vdev {
        boolean_t       vdev_expanding; /* expand the vdev?             */
        boolean_t       vdev_reopening; /* reopen in progress?          */
        boolean_t       vdev_nonrot;    /* true if solid state          */
+       int             vdev_load_error; /* error on last load          */
        int             vdev_open_error; /* error on last open          */
+       int             vdev_validate_error; /* error on last validate  */
        kthread_t       *vdev_open_thread; /* thread opening children   */
+       kthread_t       *vdev_validate_thread; /* thread validating children */
        uint64_t        vdev_crtxg;     /* txg when top-level was added */
+       uint64_t        vdev_root_zap;
 
        /*
         * Top-level vdev state.
@@ -220,8 +268,8 @@ struct vdev {
        uint64_t        vdev_ms_shift;  /* metaslab size shift          */
        uint64_t        vdev_ms_count;  /* number of metaslabs          */
        metaslab_group_t *vdev_mg;      /* metaslab group               */
+       metaslab_group_t *vdev_log_mg;  /* embedded slog metaslab group */
        metaslab_t      **vdev_ms;      /* metaslab array               */
-       uint64_t        vdev_pending_fastwrite; /* allocated fastwrites */
        txg_list_t      vdev_ms_list;   /* per-txg dirty metaslab lists */
        txg_list_t      vdev_dtl_list;  /* per-txg dirty DTL lists      */
        txg_node_t      vdev_txg_node;  /* per-txg dirty vdev linkage   */
@@ -231,14 +279,72 @@ struct vdev {
        list_node_t     vdev_state_dirty_node; /* state dirty list      */
        uint64_t        vdev_deflate_ratio; /* deflation ratio (x512)   */
        uint64_t        vdev_islog;     /* is an intent log device      */
+       uint64_t        vdev_noalloc;   /* device is passivated?        */
        uint64_t        vdev_removing;  /* device is being removed?     */
+       uint64_t        vdev_failfast;  /* device failfast setting      */
+       boolean_t       vdev_rz_expanding; /* raidz is being expanded?  */
        boolean_t       vdev_ishole;    /* is a hole in the namespace   */
-       kmutex_t        vdev_queue_lock; /* protects vdev_queue_depth   */
        uint64_t        vdev_top_zap;
+       vdev_alloc_bias_t vdev_alloc_bias; /* metaslab allocation bias  */
 
        /* pool checkpoint related */
        space_map_t     *vdev_checkpoint_sm;    /* contains reserved blocks */
 
+       /* Initialize related */
+       boolean_t       vdev_initialize_exit_wanted;
+       vdev_initializing_state_t       vdev_initialize_state;
+       list_node_t     vdev_initialize_node;
+       kthread_t       *vdev_initialize_thread;
+       /* Protects vdev_initialize_thread and vdev_initialize_state. */
+       kmutex_t        vdev_initialize_lock;
+       kcondvar_t      vdev_initialize_cv;
+       uint64_t        vdev_initialize_offset[TXG_SIZE];
+       uint64_t        vdev_initialize_last_offset;
+       range_tree_t    *vdev_initialize_tree;  /* valid while initializing */
+       uint64_t        vdev_initialize_bytes_est;
+       uint64_t        vdev_initialize_bytes_done;
+       uint64_t        vdev_initialize_action_time;    /* start and end time */
+
+       /* TRIM related */
+       boolean_t       vdev_trim_exit_wanted;
+       boolean_t       vdev_autotrim_exit_wanted;
+       vdev_trim_state_t       vdev_trim_state;
+       list_node_t     vdev_trim_node;
+       kmutex_t        vdev_autotrim_lock;
+       kcondvar_t      vdev_autotrim_cv;
+       kcondvar_t      vdev_autotrim_kick_cv;
+       kthread_t       *vdev_autotrim_thread;
+       /* Protects vdev_trim_thread and vdev_trim_state. */
+       kmutex_t        vdev_trim_lock;
+       kcondvar_t      vdev_trim_cv;
+       kthread_t       *vdev_trim_thread;
+       uint64_t        vdev_trim_offset[TXG_SIZE];
+       uint64_t        vdev_trim_last_offset;
+       uint64_t        vdev_trim_bytes_est;
+       uint64_t        vdev_trim_bytes_done;
+       uint64_t        vdev_trim_rate;         /* requested rate (bytes/sec) */
+       uint64_t        vdev_trim_partial;      /* requested partial TRIM */
+       uint64_t        vdev_trim_secure;       /* requested secure TRIM */
+       uint64_t        vdev_trim_action_time;  /* start and end time */
+
+       /* Rebuild related */
+       boolean_t       vdev_rebuilding;
+       boolean_t       vdev_rebuild_exit_wanted;
+       boolean_t       vdev_rebuild_cancel_wanted;
+       boolean_t       vdev_rebuild_reset_wanted;
+       kmutex_t        vdev_rebuild_lock;
+       kcondvar_t      vdev_rebuild_cv;
+       kthread_t       *vdev_rebuild_thread;
+       vdev_rebuild_t  vdev_rebuild_config;
+
+       /* For limiting outstanding I/Os (initialize, TRIM) */
+       kmutex_t        vdev_initialize_io_lock;
+       kcondvar_t      vdev_initialize_io_cv;
+       uint64_t        vdev_initialize_inflight;
+       kmutex_t        vdev_trim_io_lock;
+       kcondvar_t      vdev_trim_io_cv;
+       uint64_t        vdev_trim_inflight[3];
+
        /*
         * Values stored in the config for an indirect or removing vdev.
         */
@@ -273,16 +379,6 @@ struct vdev {
        range_tree_t    *vdev_obsolete_segments;
        space_map_t     *vdev_obsolete_sm;
 
-       /*
-        * The queue depth parameters determine how many async writes are
-        * still pending (i.e. allocated by net yet issued to disk) per
-        * top-level (vdev_async_write_queue_depth) and the maximum allowed
-        * (vdev_max_async_write_queue_depth). These values only apply to
-        * top-level vdevs.
-        */
-       uint64_t        vdev_async_write_queue_depth;
-       uint64_t        vdev_max_async_write_queue_depth;
-
        /*
         * Protects the vdev_scan_io_queue field itself as well as the
         * structure's contents (when present).
@@ -304,7 +400,7 @@ struct vdev {
        uint64_t        vdev_degraded;  /* persistent degraded state    */
        uint64_t        vdev_removed;   /* persistent removed state     */
        uint64_t        vdev_resilver_txg; /* persistent resilvering state */
-       uint64_t        vdev_nparity;   /* number of parity devices for raidz */
+       uint64_t        vdev_rebuild_txg; /* persistent rebuilding state */
        char            *vdev_path;     /* vdev path (if any)           */
        char            *vdev_devid;    /* vdev devid (if any)          */
        char            *vdev_physpath; /* vdev device path (if any)    */
@@ -313,6 +409,8 @@ struct vdev {
        uint64_t        vdev_not_present; /* not present during import  */
        uint64_t        vdev_unspare;   /* unspare when resilvering done */
        boolean_t       vdev_nowritecache; /* true if flushwritecache failed */
+       boolean_t       vdev_has_trim;  /* TRIM is supported            */
+       boolean_t       vdev_has_securetrim; /* secure TRIM is supported */
        boolean_t       vdev_checkremove; /* temporary online test      */
        boolean_t       vdev_forcefault; /* force online fault          */
        boolean_t       vdev_splitting; /* split or repair in progress  */
@@ -324,14 +422,18 @@ struct vdev {
        boolean_t       vdev_isspare;   /* was a hot spare              */
        boolean_t       vdev_isl2cache; /* was a l2cache device         */
        boolean_t       vdev_copy_uberblocks;  /* post expand copy uberblocks */
+       boolean_t       vdev_resilver_deferred;  /* resilver deferred */
+       boolean_t       vdev_kobj_flag; /* kobj event record */
+       boolean_t       vdev_attaching; /* vdev attach ashift handling */
        vdev_queue_t    vdev_queue;     /* I/O deadline schedule queue  */
-       vdev_cache_t    vdev_cache;     /* physical block cache         */
        spa_aux_vdev_t  *vdev_aux;      /* for l2cache and spares vdevs */
        zio_t           *vdev_probe_zio; /* root of current probe       */
        vdev_aux_t      vdev_label_aux; /* on-disk aux state            */
        uint64_t        vdev_leaf_zap;
        hrtime_t        vdev_mmp_pending; /* 0 if write finished        */
        uint64_t        vdev_mmp_kstat_id;      /* to find kstat entry */
+       uint64_t        vdev_expansion_time;    /* vdev's last expansion time */
+       list_node_t     vdev_leaf_node;         /* leaf vdev list */
 
        /*
         * For DTrace to work in userland (libzpool) context, these fields must
@@ -345,17 +447,26 @@ struct vdev {
        kmutex_t        vdev_probe_lock; /* protects vdev_probe_zio     */
 
        /*
-        * We rate limit ZIO delay and ZIO checksum events, since they
+        * We rate limit ZIO delay, deadman, and checksum events, since they
         * can flood ZED with tons of events when a drive is acting up.
         */
        zfs_ratelimit_t vdev_delay_rl;
+       zfs_ratelimit_t vdev_deadman_rl;
        zfs_ratelimit_t vdev_checksum_rl;
-};
 
-#define        VDEV_RAIDZ_MAXPARITY    3
+       /*
+        * Vdev properties for tuning ZED
+        */
+       uint64_t        vdev_checksum_n;
+       uint64_t        vdev_checksum_t;
+       uint64_t        vdev_io_n;
+       uint64_t        vdev_io_t;
+       uint64_t        vdev_slow_io_n;
+       uint64_t        vdev_slow_io_t;
+};
 
 #define        VDEV_PAD_SIZE           (8 << 10)
-/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
+/* 2 padding areas (vl_pad1 and vl_be) to skip */
 #define        VDEV_SKIP_SIZE          VDEV_PAD_SIZE * 2
 #define        VDEV_PHYS_SIZE          (112 << 10)
 #define        VDEV_UBERBLOCK_RING     (128 << 10)
@@ -382,12 +493,41 @@ typedef struct vdev_phys {
        zio_eck_t       vp_zbt;
 } vdev_phys_t;
 
+typedef enum vbe_vers {
+       /*
+        * The bootenv file is stored as ascii text in the envblock.
+        * It is used by the GRUB bootloader used on Linux to store the
+        * contents of the grubenv file. The file is stored as raw ASCII,
+        * and is protected by an embedded checksum. By default, GRUB will
+        * check if the boot filesystem supports storing the environment data
+        * in a special location, and if so, will invoke filesystem specific
+        * logic to retrieve it. This can be overridden by a variable, should
+        * the user so desire.
+        */
+       VB_RAW = 0,
+
+       /*
+        * The bootenv file is converted to an nvlist and then packed into the
+        * envblock.
+        */
+       VB_NVLIST = 1
+} vbe_vers_t;
+
+typedef struct vdev_boot_envblock {
+       uint64_t        vbe_version;
+       char            vbe_bootenv[VDEV_PAD_SIZE - sizeof (uint64_t) -
+                       sizeof (zio_eck_t)];
+       zio_eck_t       vbe_zbt;
+} vdev_boot_envblock_t;
+_Static_assert(sizeof (vdev_boot_envblock_t) == VDEV_PAD_SIZE,
+       "vdev_boot_envblock_t wrong size");
+
 typedef struct vdev_label {
        char            vl_pad1[VDEV_PAD_SIZE];                 /*  8K */
-       char            vl_pad2[VDEV_PAD_SIZE];                 /*  8K */
+       vdev_boot_envblock_t    vl_be;                          /*  8K */
        vdev_phys_t     vl_vdev_phys;                           /* 112K */
        char            vl_uberblock[VDEV_UBERBLOCK_RING];      /* 128K */
-} vdev_label_t;                                                        /* 256K total */
+} vdev_label_t;                                                /* 256K total */
 
 /*
  * vdev_dirty() flags
@@ -400,6 +540,7 @@ typedef struct vdev_label {
 /*
  * Size of embedded boot loader region on each label.
  * The total size of the first two labels plus the boot area is 4MB.
+ * On RAIDZ, this space is overwritten during RAIDZ expansion.
  */
 #define        VDEV_BOOT_SIZE          (7ULL << 19)                    /* 3.5M */
 
@@ -410,6 +551,9 @@ typedef struct vdev_label {
 #define        VDEV_LABEL_END_SIZE     (2 * sizeof (vdev_label_t))
 #define        VDEV_LABELS             4
 #define        VDEV_BEST_LABEL         VDEV_LABELS
+#define        VDEV_OFFSET_IS_LABEL(vd, off)                           \
+       (((off) < VDEV_LABEL_START_SIZE) ||                     \
+       ((off) >= ((vd)->vdev_psize - VDEV_LABEL_END_SIZE)))
 
 #define        VDEV_ALLOC_LOAD         0
 #define        VDEV_ALLOC_ADD          1
@@ -455,6 +599,8 @@ 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_draid_ops;
+extern vdev_ops_t vdev_draid_spare_ops;
 extern vdev_ops_t vdev_disk_ops;
 extern vdev_ops_t vdev_file_ops;
 extern vdev_ops_t vdev_missing_ops;
@@ -465,16 +611,20 @@ extern vdev_ops_t vdev_indirect_ops;
 /*
  * Common size functions
  */
-extern uint64_t vdev_default_asize(vdev_t *vd, uint64_t psize);
+extern void vdev_default_xlate(vdev_t *vd, const range_seg64_t *logical_rs,
+    range_seg64_t *physical_rs, range_seg64_t *remain_rs);
+extern uint64_t vdev_default_asize(vdev_t *vd, uint64_t psize, uint64_t txg);
+extern uint64_t vdev_default_min_asize(vdev_t *vd);
 extern uint64_t vdev_get_min_asize(vdev_t *vd);
 extern void vdev_set_min_asize(vdev_t *vd);
+extern uint64_t vdev_get_min_alloc(vdev_t *vd);
+extern uint64_t vdev_get_nparity(vdev_t *vd);
+extern uint64_t vdev_get_ndisks(vdev_t *vd);
 
 /*
  * Global variables
  */
-extern int vdev_standard_sm_blksz;
-/* zdb uses this tunable, so it must be declared here to make lint happy. */
-extern int zfs_vdev_cache_size;
+extern int zfs_vdev_standard_sm_blksz;
 
 /*
  * Functions from vdev_indirect.c
@@ -482,13 +632,23 @@ extern int zfs_vdev_cache_size;
 extern void vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx);
 extern boolean_t vdev_indirect_should_condense(vdev_t *vd);
 extern void spa_condense_indirect_start_sync(vdev_t *vd, dmu_tx_t *tx);
-extern int vdev_obsolete_sm_object(vdev_t *vd);
-extern boolean_t vdev_obsolete_counts_are_precise(vdev_t *vd);
+extern int vdev_obsolete_sm_object(vdev_t *vd, uint64_t *sm_obj);
+extern int vdev_obsolete_counts_are_precise(vdev_t *vd, boolean_t *are_precise);
 
 /*
  * Other miscellaneous functions
  */
-int vdev_checkpoint_sm_object(vdev_t *vd);
+int vdev_checkpoint_sm_object(vdev_t *vd, uint64_t *sm_obj);
+void vdev_metaslab_group_create(vdev_t *vd);
+uint64_t vdev_best_ashift(uint64_t logical, uint64_t a, uint64_t b);
+
+/*
+ * Vdev ashift optimization tunables
+ */
+extern uint_t zfs_vdev_min_auto_ashift;
+extern uint_t zfs_vdev_max_auto_ashift;
+int param_set_min_auto_ashift(ZFS_MODULE_PARAM_ARGS);
+int param_set_max_auto_ashift(ZFS_MODULE_PARAM_ARGS);
 
 #ifdef __cplusplus
 }