Print this page
NEX-13135 Running BDD tests exposes a panic in ZFS TRIM due to a trimset overlap
Reviewed by: Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-9554 dsl_scan.c internals contain some confusingly similar function names for handling the dataset and block sorting queues
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-6088 ZFS scrub/resilver take excessively long due to issuing lots of random IO
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-7298 powertop dumps core when -c, -d or -t flags are used
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-6725 zpool offlining/onlining first disk in a mirror causes checksum error
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-5553 ZFS auto-trim, manual-trim and scrub can race and deadlock
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2846 Enable Automatic/Intelligent Hot Sparing capability
Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-4940 Special Vdev operation in presence (or absense) of IO Errors
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
NEX-4807 writecache load-balancing statistics: several distinct problems, must be revisited and revised
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-4620 ZFS autotrim triggering is unreliable
NEX-4622 On-demand TRIM code illogically enumerates metaslabs via mg_ms_tree
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
5818 zfs {ref}compressratio is incorrect with 4k sector size
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Don Brady <dev.fs.zfs@gmail.com>
Approved by: Albert Lee <trisk@omniti.com>
NEX-3984 On-demand TRIM
Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Conflicts:
usr/src/common/zfs/zpool_prop.c
usr/src/uts/common/sys/fs/zfs.h
NEX-3558 KRRP Integration
NEX-3508 CLONE - Port NEX-2946 Add UNMAP/TRIM functionality to ZFS and illumos
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Conflicts:
usr/src/uts/common/io/scsi/targets/sd.c
usr/src/uts/common/sys/scsi/targets/sddef.h
NEX-3212 remove vdev prop object type from dmu.h, p2 Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-3165 need some dedup improvements
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-1142 move rwlock to vdev to protect vdev_tsd
not just ldi handle.
This way we serialize open/close, yet allow parallel I/O.
OS-80 support for vdev and CoS properties for the new I/O scheduler
OS-95 lint warning introduced by OS-61
Issue #40: ZDB shouldn't crash with new code
zfsxx issue #11: support for spare device groups
Fixup merge results
re #12585 rb4049 ZFS++ work port - refactoring to improve separation of open/closed code, bug fixes, performance improvements - open code
Bug 11205: add missing libzfs_closed_stubs.c to fix opensource-only build.
ZFS plus work: special vdevs, cos, cos/vdev properties
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
+++ new/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
24 + * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
24 25 */
25 26
26 27 #ifndef _SYS_VDEV_IMPL_H
27 28 #define _SYS_VDEV_IMPL_H
28 29
29 30 #include <sys/avl.h>
30 -#include <sys/bpobj.h>
31 31 #include <sys/dmu.h>
32 32 #include <sys/metaslab.h>
33 33 #include <sys/nvpair.h>
34 34 #include <sys/space_map.h>
35 35 #include <sys/vdev.h>
36 36 #include <sys/dkio.h>
37 37 #include <sys/uberblock_impl.h>
38 -#include <sys/vdev_indirect_mapping.h>
39 -#include <sys/vdev_indirect_births.h>
40 -#include <sys/vdev_removal.h>
38 +#include <sys/fs/zfs.h>
39 +#include <sys/cos.h>
41 40
42 41 #ifdef __cplusplus
43 42 extern "C" {
44 43 #endif
45 44
46 45 /*
47 46 * Virtual device descriptors.
48 47 *
49 48 * All storage pool operations go through the virtual device framework,
50 49 * which provides data replication and I/O scheduling.
51 50 */
52 51
53 52 /*
54 53 * Forward declarations that lots of things need.
55 54 */
56 55 typedef struct vdev_queue vdev_queue_t;
57 56 typedef struct vdev_cache vdev_cache_t;
58 57 typedef struct vdev_cache_entry vdev_cache_entry_t;
59 58 struct abd;
60 59
61 60 extern int zfs_vdev_queue_depth_pct;
62 61 extern uint32_t zfs_vdev_async_write_max_active;
63 62
64 63 /*
65 64 * Virtual device operations
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
66 65 */
67 66 typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size,
68 67 uint64_t *ashift);
69 68 typedef void vdev_close_func_t(vdev_t *vd);
70 69 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
71 70 typedef void vdev_io_start_func_t(zio_t *zio);
72 71 typedef void vdev_io_done_func_t(zio_t *zio);
73 72 typedef void vdev_state_change_func_t(vdev_t *vd, int, int);
74 73 typedef void vdev_hold_func_t(vdev_t *vd);
75 74 typedef void vdev_rele_func_t(vdev_t *vd);
75 +typedef void vdev_trim_func_t(vdev_t *vd, zio_t *pio, void *trim_exts);
76 76
77 -typedef void vdev_remap_cb_t(uint64_t inner_offset, vdev_t *vd,
78 - uint64_t offset, uint64_t size, void *arg);
79 -typedef void vdev_remap_func_t(vdev_t *vd, uint64_t offset, uint64_t size,
80 - vdev_remap_cb_t callback, void *arg);
81 -
82 77 typedef struct vdev_ops {
83 78 vdev_open_func_t *vdev_op_open;
84 79 vdev_close_func_t *vdev_op_close;
85 80 vdev_asize_func_t *vdev_op_asize;
86 81 vdev_io_start_func_t *vdev_op_io_start;
87 82 vdev_io_done_func_t *vdev_op_io_done;
88 83 vdev_state_change_func_t *vdev_op_state_change;
89 84 vdev_hold_func_t *vdev_op_hold;
90 85 vdev_rele_func_t *vdev_op_rele;
91 - vdev_remap_func_t *vdev_op_remap;
86 + vdev_trim_func_t *vdev_op_trim;
92 87 char vdev_op_type[16];
93 88 boolean_t vdev_op_leaf;
94 89 } vdev_ops_t;
95 90
96 91 /*
97 92 * Virtual device properties
98 93 */
99 94 struct vdev_cache_entry {
100 95 struct abd *ve_abd;
101 96 uint64_t ve_offset;
102 97 uint64_t ve_lastused;
103 98 avl_node_t ve_offset_node;
104 99 avl_node_t ve_lastused_node;
105 100 uint32_t ve_hits;
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
106 101 uint16_t ve_missed_update;
107 102 zio_t *ve_fill_io;
108 103 };
109 104
110 105 struct vdev_cache {
111 106 avl_tree_t vc_offset_tree;
112 107 avl_tree_t vc_lastused_tree;
113 108 kmutex_t vc_lock;
114 109 };
115 110
111 +/*
112 + * Macros for conversion between zio priorities and vdev properties.
113 + * These rely on the specific corresponding order of the zio_priority_t
114 + * and vdev_prop_t enum definitions to simplify the conversion.
115 + */
116 +#define VDEV_PROP_TO_ZIO_PRIO_MIN(prp) ((prp) - VDEV_PROP_READ_MINACTIVE)
117 +#define VDEV_ZIO_PRIO_TO_PROP_MIN(pri) ((pri) + VDEV_PROP_READ_MINACTIVE)
118 +#define VDEV_PROP_MIN_VALID(prp) \
119 + (((prp) >= VDEV_PROP_READ_MINACTIVE) && \
120 + ((prp) <= VDEV_PROP_SCRUB_MINACTIVE))
121 +#define VDEV_PROP_TO_ZIO_PRIO_MAX(prp) ((prp) - VDEV_PROP_READ_MAXACTIVE)
122 +#define VDEV_ZIO_PRIO_TO_PROP_MAX(pri) ((pri) + VDEV_PROP_READ_MAXACTIVE)
123 +#define VDEV_PROP_MAX_VALID(prp) \
124 + (((prp) >= VDEV_PROP_READ_MAXACTIVE) && \
125 + ((prp) <= VDEV_PROP_SCRUB_MAXACTIVE))
126 +
116 127 typedef struct vdev_queue_class {
117 128 uint32_t vqc_active;
118 129
119 130 /*
131 + * If min/max active values are zero, we fall back on the global
132 + * corresponding tunables defined in vdev_queue.c; non-zero values
133 + * override the global tunables
134 + */
135 + uint32_t vqc_min_active; /* min concurently active IOs */
136 + uint32_t vqc_max_active; /* max concurently active IOs */
137 +
138 + /*
120 139 * Sorted by offset or timestamp, depending on if the queue is
121 140 * LBA-ordered vs FIFO.
122 141 */
123 142 avl_tree_t vqc_queued_tree;
124 143 } vdev_queue_class_t;
125 144
126 145 struct vdev_queue {
127 146 vdev_t *vq_vdev;
147 +
128 148 vdev_queue_class_t vq_class[ZIO_PRIORITY_NUM_QUEUEABLE];
149 + cos_t *vq_cos; /* assigned class of storage */
150 + uint64_t vq_preferred_read; /* property setting */
151 +
129 152 avl_tree_t vq_active_tree;
130 153 avl_tree_t vq_read_offset_tree;
131 154 avl_tree_t vq_write_offset_tree;
132 155 uint64_t vq_last_offset;
133 - hrtime_t vq_io_complete_ts; /* time last i/o completed */
156 + hrtime_t vq_io_complete_ts; /* time last i/o completed */
134 157 kmutex_t vq_lock;
135 158 };
136 159
137 160 /*
138 - * On-disk indirect vdev state.
139 - *
140 - * An indirect vdev is described exclusively in the MOS config of a pool.
141 - * The config for an indirect vdev includes several fields, which are
142 - * accessed in memory by a vdev_indirect_config_t.
161 + * vdev auxiliary kstat I/O statistics:
162 + * updates every spa_special_stat_update_ticks interval
163 + * it is used for adjust special vs normal data routing
143 164 */
144 -typedef struct vdev_indirect_config {
145 - /*
146 - * Object (in MOS) which contains the indirect mapping. This object
147 - * contains an array of vdev_indirect_mapping_entry_phys_t ordered by
148 - * vimep_src. The bonus buffer for this object is a
149 - * vdev_indirect_mapping_phys_t. This object is allocated when a vdev
150 - * removal is initiated.
151 - *
152 - * Note that this object can be empty if none of the data on the vdev
153 - * has been copied yet.
154 - */
155 - uint64_t vic_mapping_object;
165 +typedef struct vdev_aux_stat {
166 + uint64_t nread; /* number of bytes read */
167 + uint64_t nwritten; /* number of bytes written */
168 + uint64_t reads; /* number of read operations */
169 + uint64_t writes; /* number of write operations */
170 + uint64_t rtime; /* cumulative run (service) time */
171 + uint64_t wtime; /* cumulative wait (pre-service) time */
172 + uint64_t rlentime; /* cumulative run length*time product */
173 + uint64_t wlentime; /* cumulative wait length*time product */
174 + uint64_t rlastupdate; /* last time run queue changed */
175 + uint64_t wlastupdate; /* last time wait queue changed */
176 + uint64_t rcnt; /* count of elements in run state */
177 + uint64_t wcnt; /* count of elements in wait state */
178 +} vdev_aux_stat_t;
156 179
157 - /*
158 - * Object (in MOS) which contains the birth times for the mapping
159 - * entries. This object contains an array of
160 - * vdev_indirect_birth_entry_phys_t sorted by vibe_offset. The bonus
161 - * buffer for this object is a vdev_indirect_birth_phys_t. This object
162 - * is allocated when a vdev removal is initiated.
163 - *
164 - * Note that this object can be empty if none of the vdev has yet been
165 - * copied.
166 - */
167 - uint64_t vic_births_object;
168 -
169 - /*
170 - * This is the vdev ID which was removed previous to this vdev, or
171 - * UINT64_MAX if there are no previously removed vdevs.
172 - */
173 - uint64_t vic_prev_indirect_vdev;
174 -} vdev_indirect_config_t;
175 -
176 180 /*
177 181 * Virtual device descriptor
178 182 */
179 183 struct vdev {
180 184 /*
181 185 * Common to all vdev types.
182 186 */
183 187 uint64_t vdev_id; /* child number in vdev parent */
184 188 uint64_t vdev_guid; /* unique ID for this vdev */
185 189 uint64_t vdev_guid_sum; /* self guid + all child guids */
186 190 uint64_t vdev_orig_guid; /* orig. guid prior to remove */
187 191 uint64_t vdev_asize; /* allocatable device capacity */
188 192 uint64_t vdev_min_asize; /* min acceptable asize */
189 193 uint64_t vdev_max_asize; /* max acceptable asize */
190 194 uint64_t vdev_ashift; /* block alignment shift */
191 195 uint64_t vdev_state; /* see VDEV_STATE_* #defines */
192 196 uint64_t vdev_prevstate; /* used when reopening a vdev */
193 197 vdev_ops_t *vdev_ops; /* vdev operations */
194 198 spa_t *vdev_spa; /* spa for this vdev */
195 199 void *vdev_tsd; /* type-specific data */
196 200 vnode_t *vdev_name_vp; /* vnode for pathname */
197 201 vnode_t *vdev_devid_vp; /* vnode for devid */
198 202 vdev_t *vdev_top; /* top-level vdev */
199 203 vdev_t *vdev_parent; /* parent vdev */
200 204 vdev_t **vdev_child; /* array of children */
201 205 uint64_t vdev_children; /* number of children */
202 206 vdev_stat_t vdev_stat; /* virtual device statistics */
203 207 boolean_t vdev_expanding; /* expand the vdev? */
204 208 boolean_t vdev_reopening; /* reopen in progress? */
205 209 int vdev_open_error; /* error on last open */
206 210 kthread_t *vdev_open_thread; /* thread opening children */
207 211 uint64_t vdev_crtxg; /* txg when top-level was added */
208 212
209 213 /*
210 214 * Top-level vdev state.
211 215 */
212 216 uint64_t vdev_ms_array; /* metaslab array object */
213 217 uint64_t vdev_ms_shift; /* metaslab size shift */
214 218 uint64_t vdev_ms_count; /* number of metaslabs */
215 219 metaslab_group_t *vdev_mg; /* metaslab group */
216 220 metaslab_t **vdev_ms; /* metaslab array */
217 221 txg_list_t vdev_ms_list; /* per-txg dirty metaslab lists */
|
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
218 222 txg_list_t vdev_dtl_list; /* per-txg dirty DTL lists */
219 223 txg_node_t vdev_txg_node; /* per-txg dirty vdev linkage */
220 224 boolean_t vdev_remove_wanted; /* async remove wanted? */
221 225 boolean_t vdev_probe_wanted; /* async probe wanted? */
222 226 list_node_t vdev_config_dirty_node; /* config dirty list */
223 227 list_node_t vdev_state_dirty_node; /* state dirty list */
224 228 uint64_t vdev_deflate_ratio; /* deflation ratio (x512) */
225 229 uint64_t vdev_islog; /* is an intent log device */
226 230 uint64_t vdev_removing; /* device is being removed? */
227 231 boolean_t vdev_ishole; /* is a hole in the namespace */
228 - kmutex_t vdev_queue_lock; /* protects vdev_queue_depth */
229 232 uint64_t vdev_top_zap;
233 + uint64_t vdev_isspecial; /* is a special device */
230 234
231 - /*
232 - * Values stored in the config for an indirect or removing vdev.
233 - */
234 - vdev_indirect_config_t vdev_indirect_config;
235 + boolean_t vdev_man_trimming; /* manual trim is ongoing */
236 + uint64_t vdev_trim_prog; /* trim progress in bytes */
235 237
236 238 /*
237 - * The vdev_indirect_rwlock protects the vdev_indirect_mapping
238 - * pointer from changing on indirect vdevs (when it is condensed).
239 - * Note that removing (not yet indirect) vdevs have different
240 - * access patterns (the mapping is not accessed from open context,
241 - * e.g. from zio_read) and locking strategy (e.g. svr_lock).
239 + * Protects the vdev_scan_io_queue field itself as well as the
240 + * structure's contents (when present). The scn_status_lock in
241 + * dsl_scan_t must only ever be acquired stand-alone or inside
242 + * of vdev_scan_queue_lock, never in reverse.
242 243 */
243 - krwlock_t vdev_indirect_rwlock;
244 - vdev_indirect_mapping_t *vdev_indirect_mapping;
245 - vdev_indirect_births_t *vdev_indirect_births;
244 + kmutex_t vdev_scan_io_queue_lock;
245 + struct dsl_scan_io_queue *vdev_scan_io_queue;
246 246
247 247 /*
248 - * In memory data structures used to manage the obsolete sm, for
249 - * indirect or removing vdevs.
250 - *
251 - * The vdev_obsolete_segments is the in-core record of the segments
252 - * that are no longer referenced anywhere in the pool (due to
253 - * being freed or remapped and not referenced by any snapshots).
254 - * During a sync, segments are added to vdev_obsolete_segments
255 - * via vdev_indirect_mark_obsolete(); at the end of each sync
256 - * pass, this is appended to vdev_obsolete_sm via
257 - * vdev_indirect_sync_obsolete(). The vdev_obsolete_lock
258 - * protects against concurrent modifications of vdev_obsolete_segments
259 - * from multiple zio threads.
260 - */
261 - kmutex_t vdev_obsolete_lock;
262 - range_tree_t *vdev_obsolete_segments;
263 - space_map_t *vdev_obsolete_sm;
264 -
265 - /*
266 248 * The queue depth parameters determine how many async writes are
267 249 * still pending (i.e. allocated by net yet issued to disk) per
268 250 * top-level (vdev_async_write_queue_depth) and the maximum allowed
269 251 * (vdev_max_async_write_queue_depth). These values only apply to
270 252 * top-level vdevs.
271 253 */
272 254 uint64_t vdev_async_write_queue_depth;
273 255 uint64_t vdev_max_async_write_queue_depth;
274 256
275 257 /*
276 258 * Leaf vdev state.
277 259 */
278 260 range_tree_t *vdev_dtl[DTL_TYPES]; /* dirty time logs */
279 261 space_map_t *vdev_dtl_sm; /* dirty time log space map */
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
280 262 txg_node_t vdev_dtl_node; /* per-txg dirty DTL linkage */
281 263 uint64_t vdev_dtl_object; /* DTL object */
282 264 uint64_t vdev_psize; /* physical device capacity */
283 265 uint64_t vdev_wholedisk; /* true if this is a whole disk */
284 266 uint64_t vdev_offline; /* persistent offline state */
285 267 uint64_t vdev_faulted; /* persistent faulted state */
286 268 uint64_t vdev_degraded; /* persistent degraded state */
287 269 uint64_t vdev_removed; /* persistent removed state */
288 270 uint64_t vdev_resilver_txg; /* persistent resilvering state */
289 271 uint64_t vdev_nparity; /* number of parity devices for raidz */
272 + uint64_t vdev_l2ad_ddt; /* L2ARC vdev is used to cache DDT */
290 273 char *vdev_path; /* vdev path (if any) */
291 274 char *vdev_devid; /* vdev devid (if any) */
292 275 char *vdev_physpath; /* vdev device path (if any) */
293 276 char *vdev_fru; /* physical FRU location */
277 + int64_t vdev_weight; /* dynamic weight */
294 278 uint64_t vdev_not_present; /* not present during import */
295 279 uint64_t vdev_unspare; /* unspare when resilvering done */
296 280 boolean_t vdev_nowritecache; /* true if flushwritecache failed */
281 + boolean_t vdev_notrim; /* true if Unmap/TRIM is unsupported */
297 282 boolean_t vdev_checkremove; /* temporary online test */
298 283 boolean_t vdev_forcefault; /* force online fault */
299 284 boolean_t vdev_splitting; /* split or repair in progress */
300 285 boolean_t vdev_delayed_close; /* delayed device close? */
301 286 boolean_t vdev_tmpoffline; /* device taken offline temporarily? */
302 287 boolean_t vdev_detached; /* device detached? */
303 288 boolean_t vdev_cant_read; /* vdev is failing all reads */
304 289 boolean_t vdev_cant_write; /* vdev is failing all writes */
305 290 boolean_t vdev_isspare; /* was a hot spare */
306 291 boolean_t vdev_isl2cache; /* was a l2cache device */
292 + boolean_t vdev_isspecial_child; /* a child of top-level special */
307 293 vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
308 294 vdev_cache_t vdev_cache; /* physical block cache */
309 295 spa_aux_vdev_t *vdev_aux; /* for l2cache and spares vdevs */
310 296 zio_t *vdev_probe_zio; /* root of current probe */
311 297 vdev_aux_t vdev_label_aux; /* on-disk aux state */
312 298 uint64_t vdev_leaf_zap;
299 + boolean_t vdev_is_ssd; /* is solid state device */
313 300
301 + char *vdev_spare_group; /* spare group name */
302 +
303 + struct kstat *vdev_iokstat; /* vdev kstat I/O statistics */
304 + vdev_aux_stat_t vdev_aux_stat; /* auxiliary vdev kstat I/O statistics */
314 305 /*
315 306 * For DTrace to work in userland (libzpool) context, these fields must
316 307 * remain at the end of the structure. DTrace will use the kernel's
317 308 * CTF definition for 'struct vdev', and since the size of a kmutex_t is
318 309 * larger in userland, the offsets for the rest of the fields would be
319 310 * incorrect.
320 311 */
321 312 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
322 313 kmutex_t vdev_stat_lock; /* vdev_stat */
323 314 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
315 + krwlock_t vdev_tsd_lock; /* protects vdev_tsd */
324 316 };
325 317
326 318 #define VDEV_RAIDZ_MAXPARITY 3
327 319
328 320 #define VDEV_PAD_SIZE (8 << 10)
329 321 /* 2 padding areas (vl_pad1 and vl_pad2) to skip */
330 322 #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
331 323 #define VDEV_PHYS_SIZE (112 << 10)
332 324 #define VDEV_UBERBLOCK_RING (128 << 10)
333 325
334 326 /* The largest uberblock we support is 8k. */
335 327 #define MAX_UBERBLOCK_SHIFT (13)
336 328 #define VDEV_UBERBLOCK_SHIFT(vd) \
337 329 MIN(MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT), \
338 330 MAX_UBERBLOCK_SHIFT)
339 331 #define VDEV_UBERBLOCK_COUNT(vd) \
340 332 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
341 333 #define VDEV_UBERBLOCK_OFFSET(vd, n) \
342 334 offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)])
343 335 #define VDEV_UBERBLOCK_SIZE(vd) (1ULL << VDEV_UBERBLOCK_SHIFT(vd))
344 336
345 337 typedef struct vdev_phys {
346 338 char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)];
347 339 zio_eck_t vp_zbt;
348 340 } vdev_phys_t;
349 341
350 342 typedef struct vdev_label {
351 343 char vl_pad1[VDEV_PAD_SIZE]; /* 8K */
352 344 char vl_pad2[VDEV_PAD_SIZE]; /* 8K */
353 345 vdev_phys_t vl_vdev_phys; /* 112K */
354 346 char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
355 347 } vdev_label_t; /* 256K total */
356 348
357 349 /*
358 350 * vdev_dirty() flags
359 351 */
360 352 #define VDD_METASLAB 0x01
361 353 #define VDD_DTL 0x02
362 354
363 355 /* Offset of embedded boot loader region on each label */
364 356 #define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
365 357 /*
366 358 * Size of embedded boot loader region on each label.
367 359 * The total size of the first two labels plus the boot area is 4MB.
368 360 */
369 361 #define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
370 362
371 363 /*
372 364 * Size of label regions at the start and end of each leaf device.
373 365 */
374 366 #define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
375 367 #define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
376 368 #define VDEV_LABELS 4
377 369 #define VDEV_BEST_LABEL VDEV_LABELS
378 370
379 371 #define VDEV_ALLOC_LOAD 0
380 372 #define VDEV_ALLOC_ADD 1
381 373 #define VDEV_ALLOC_SPARE 2
382 374 #define VDEV_ALLOC_L2CACHE 3
383 375 #define VDEV_ALLOC_ROOTPOOL 4
384 376 #define VDEV_ALLOC_SPLIT 5
385 377 #define VDEV_ALLOC_ATTACH 6
386 378
387 379 /*
388 380 * Allocate or free a vdev
389 381 */
390 382 extern vdev_t *vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid,
391 383 vdev_ops_t *ops);
392 384 extern int vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *config,
393 385 vdev_t *parent, uint_t id, int alloctype);
394 386 extern void vdev_free(vdev_t *vd);
395 387
396 388 /*
397 389 * Add or remove children and parents
|
↓ open down ↓ |
64 lines elided |
↑ open up ↑ |
398 390 */
399 391 extern void vdev_add_child(vdev_t *pvd, vdev_t *cvd);
400 392 extern void vdev_remove_child(vdev_t *pvd, vdev_t *cvd);
401 393 extern void vdev_compact_children(vdev_t *pvd);
402 394 extern vdev_t *vdev_add_parent(vdev_t *cvd, vdev_ops_t *ops);
403 395 extern void vdev_remove_parent(vdev_t *cvd);
404 396
405 397 /*
406 398 * vdev sync load and sync
407 399 */
400 +extern void vdev_load_log_state(vdev_t *nvd, vdev_t *ovd);
408 401 extern boolean_t vdev_log_state_valid(vdev_t *vd);
409 -extern int vdev_load(vdev_t *vd);
402 +extern void vdev_load(vdev_t *vd);
410 403 extern int vdev_dtl_load(vdev_t *vd);
411 404 extern void vdev_sync(vdev_t *vd, uint64_t txg);
412 405 extern void vdev_sync_done(vdev_t *vd, uint64_t txg);
413 406 extern void vdev_dirty(vdev_t *vd, int flags, void *arg, uint64_t txg);
414 407 extern void vdev_dirty_leaves(vdev_t *vd, int flags, uint64_t txg);
415 408
416 409 /*
417 410 * Available vdev types.
418 411 */
419 412 extern vdev_ops_t vdev_root_ops;
420 413 extern vdev_ops_t vdev_mirror_ops;
421 414 extern vdev_ops_t vdev_replacing_ops;
422 415 extern vdev_ops_t vdev_raidz_ops;
423 416 extern vdev_ops_t vdev_disk_ops;
424 417 extern vdev_ops_t vdev_file_ops;
425 418 extern vdev_ops_t vdev_missing_ops;
426 419 extern vdev_ops_t vdev_hole_ops;
427 420 extern vdev_ops_t vdev_spare_ops;
428 -extern vdev_ops_t vdev_indirect_ops;
429 421
422 +extern uint_t vdev_count_leaf_vdevs(vdev_t *root);
423 +
430 424 /*
431 425 * Common size functions
432 426 */
433 427 extern uint64_t vdev_default_asize(vdev_t *vd, uint64_t psize);
434 428 extern uint64_t vdev_get_min_asize(vdev_t *vd);
435 429 extern void vdev_set_min_asize(vdev_t *vd);
436 430
431 +
437 432 /*
433 + * Wrapper for getting vdev-specific properties that enforces proper
434 + * overriding: vdev-specific properties override CoS properties
435 + *
436 + * The value of 0 indicates that the property is not set (default).
437 + */
438 +extern uint64_t vdev_queue_get_prop_uint64(vdev_queue_t *vq, vdev_prop_t prop);
439 +
440 +/*
438 441 * Global variables
439 442 */
440 443 /* zdb uses this tunable, so it must be declared here to make lint happy. */
441 444 extern int zfs_vdev_cache_size;
442 445
443 446 /*
444 - * Functions from vdev_indirect.c
445 - */
446 -extern void vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx);
447 -extern boolean_t vdev_indirect_should_condense(vdev_t *vd);
448 -extern void spa_condense_indirect_start_sync(vdev_t *vd, dmu_tx_t *tx);
449 -extern int vdev_obsolete_sm_object(vdev_t *vd);
450 -extern boolean_t vdev_obsolete_counts_are_precise(vdev_t *vd);
451 -
452 -/*
453 447 * The vdev_buf_t is used to translate between zio_t and buf_t, and back again.
454 448 */
455 449 typedef struct vdev_buf {
456 450 buf_t vb_buf; /* buffer that describes the io */
457 451 zio_t *vb_io; /* pointer back to the original zio_t */
458 452 } vdev_buf_t;
459 453
460 454 #ifdef __cplusplus
461 455 }
462 456 #endif
463 457
464 458 #endif /* _SYS_VDEV_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX