Print this page
NEX-9673 Add capability to replicate cloned datasets relative to origin
Reviewed by: Alex Deiter <alex.deiter@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
6358 A faulted pool with only unavailable vdevs triggers assertion failure in libzfs
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Serban Maduta <serban.maduta@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
6393 zfs receive a full send as a clone
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Dan McDonald <danmcd@omniti.com>
2605 want to resume interrupted zfs send
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Xin Li <delphij@freebsd.org>
Reviewed by: Arne Jansen <sensille@gmx.net>
Approved by: Dan McDonald <danmcd@omniti.com>
NEX-3558 KRRP Integration
Bug 10481 - Dry run option in 'zfs send' isn't the same as in NexentaStor 3.1
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/dmu_impl.h
+++ new/usr/src/uts/common/fs/zfs/sys/dmu_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 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 - */
25 -/*
26 24 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 25 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
26 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
28 27 */
29 28
30 29 #ifndef _SYS_DMU_IMPL_H
31 30 #define _SYS_DMU_IMPL_H
32 31
33 32 #include <sys/txg_impl.h>
34 33 #include <sys/zio.h>
35 34 #include <sys/dnode.h>
36 35 #include <sys/zfs_context.h>
37 36 #include <sys/zfs_ioctl.h>
37 +#include <sys/dmu_krrp.h>
38 38
39 39 #ifdef __cplusplus
40 40 extern "C" {
41 41 #endif
42 42
43 43 /*
44 44 * This is the locking strategy for the DMU. Numbers in parenthesis are
45 45 * cases that use that lock order, referenced below:
46 46 *
47 47 * ARC is self-contained
48 48 * bplist is self-contained
49 49 * refcount is self-contained
50 50 * txg is self-contained (hopefully!)
51 51 * zst_lock
52 52 * zf_rwlock
53 53 *
54 54 * XXX try to improve evicting path?
55 55 *
56 56 * dp_config_rwlock > os_obj_lock > dn_struct_rwlock >
57 57 * dn_dbufs_mtx > hash_mutexes > db_mtx > dd_lock > leafs
58 58 *
59 59 * dp_config_rwlock
60 60 * must be held before: everything
61 61 * protects dd namespace changes
62 62 * protects property changes globally
63 63 * held from:
64 64 * dsl_dir_open/r:
65 65 * dsl_dir_create_sync/w:
66 66 * dsl_dir_sync_destroy/w:
67 67 * dsl_dir_rename_sync/w:
68 68 * dsl_prop_changed_notify/r:
69 69 *
70 70 * os_obj_lock
71 71 * must be held before:
72 72 * everything except dp_config_rwlock
73 73 * protects os_obj_next
74 74 * held from:
75 75 * dmu_object_alloc: dn_dbufs_mtx, db_mtx, hash_mutexes, dn_struct_rwlock
76 76 *
77 77 * dn_struct_rwlock
78 78 * must be held before:
79 79 * everything except dp_config_rwlock and os_obj_lock
80 80 * protects structure of dnode (eg. nlevels)
81 81 * db_blkptr can change when syncing out change to nlevels
82 82 * dn_maxblkid
83 83 * dn_nlevels
84 84 * dn_*blksz*
85 85 * phys nlevels, maxblkid, physical blkptr_t's (?)
86 86 * held from:
87 87 * callers of dbuf_read_impl, dbuf_hold[_impl], dbuf_prefetch
88 88 * dmu_object_info_from_dnode: dn_dirty_mtx (dn_datablksz)
89 89 * dbuf_read_impl: db_mtx, dmu_zfetch()
90 90 * dmu_zfetch: zf_rwlock/r, zst_lock, dbuf_prefetch()
91 91 * dbuf_new_size: db_mtx
92 92 * dbuf_dirty: db_mtx
93 93 * dbuf_findbp: (callers, phys? - the real need)
94 94 * dbuf_create: dn_dbufs_mtx, hash_mutexes, db_mtx (phys?)
95 95 * dbuf_prefetch: dn_dirty_mtx, hash_mutexes, db_mtx, dn_dbufs_mtx
96 96 * dbuf_hold_impl: hash_mutexes, db_mtx, dn_dbufs_mtx, dbuf_findbp()
97 97 * dnode_sync/w (increase_indirection): db_mtx (phys)
98 98 * dnode_set_blksz/w: dn_dbufs_mtx (dn_*blksz*)
99 99 * dnode_new_blkid/w: (dn_maxblkid)
100 100 * dnode_free_range/w: dn_dirty_mtx (dn_maxblkid)
101 101 * dnode_next_offset: (phys)
102 102 *
103 103 * dn_dbufs_mtx
104 104 * must be held before:
105 105 * db_mtx, hash_mutexes
106 106 * protects:
107 107 * dn_dbufs
108 108 * dn_evicted
109 109 * held from:
110 110 * dmu_evict_user: db_mtx (dn_dbufs)
111 111 * dbuf_free_range: db_mtx (dn_dbufs)
112 112 * dbuf_remove_ref: db_mtx, callees:
113 113 * dbuf_hash_remove: hash_mutexes, db_mtx
114 114 * dbuf_create: hash_mutexes, db_mtx (dn_dbufs)
115 115 * dnode_set_blksz: (dn_dbufs)
116 116 *
117 117 * hash_mutexes (global)
118 118 * must be held before:
119 119 * db_mtx
120 120 * protects dbuf_hash_table (global) and db_hash_next
121 121 * held from:
122 122 * dbuf_find: db_mtx
123 123 * dbuf_hash_insert: db_mtx
124 124 * dbuf_hash_remove: db_mtx
125 125 *
126 126 * db_mtx (meta-leaf)
127 127 * must be held before:
128 128 * dn_mtx, dn_dirty_mtx, dd_lock (leaf mutexes)
129 129 * protects:
130 130 * db_state
131 131 * db_holds
132 132 * db_buf
133 133 * db_changed
134 134 * db_data_pending
135 135 * db_dirtied
136 136 * db_link
137 137 * db_dirty_node (??)
138 138 * db_dirtycnt
139 139 * db_d.*
140 140 * db.*
141 141 * held from:
142 142 * dbuf_dirty: dn_mtx, dn_dirty_mtx
143 143 * dbuf_dirty->dsl_dir_willuse_space: dd_lock
144 144 * dbuf_dirty->dbuf_new_block->dsl_dataset_block_freeable: dd_lock
145 145 * dbuf_undirty: dn_dirty_mtx (db_d)
146 146 * dbuf_write_done: dn_dirty_mtx (db_state)
147 147 * dbuf_*
148 148 * dmu_buf_update_user: none (db_d)
149 149 * dmu_evict_user: none (db_d) (maybe can eliminate)
150 150 * dbuf_find: none (db_holds)
151 151 * dbuf_hash_insert: none (db_holds)
152 152 * dmu_buf_read_array_impl: none (db_state, db_changed)
153 153 * dmu_sync: none (db_dirty_node, db_d)
154 154 * dnode_reallocate: none (db)
155 155 *
156 156 * dn_mtx (leaf)
157 157 * protects:
158 158 * dn_dirty_dbufs
159 159 * dn_ranges
160 160 * phys accounting
161 161 * dn_allocated_txg
162 162 * dn_free_txg
163 163 * dn_assigned_txg
164 164 * dd_assigned_tx
165 165 * dn_notxholds
166 166 * dn_dirtyctx
167 167 * dn_dirtyctx_firstset
168 168 * (dn_phys copy fields?)
169 169 * (dn_phys contents?)
170 170 * held from:
171 171 * dnode_*
172 172 * dbuf_dirty: none
173 173 * dbuf_sync: none (phys accounting)
174 174 * dbuf_undirty: none (dn_ranges, dn_dirty_dbufs)
175 175 * dbuf_write_done: none (phys accounting)
176 176 * dmu_object_info_from_dnode: none (accounting)
177 177 * dmu_tx_commit: none
178 178 * dmu_tx_hold_object_impl: none
179 179 * dmu_tx_try_assign: dn_notxholds(cv)
180 180 * dmu_tx_unassign: none
181 181 *
182 182 * dd_lock
183 183 * must be held before:
184 184 * ds_lock
185 185 * ancestors' dd_lock
186 186 * protects:
187 187 * dd_prop_cbs
188 188 * dd_sync_*
189 189 * dd_used_bytes
190 190 * dd_tempreserved
191 191 * dd_space_towrite
192 192 * dd_myname
193 193 * dd_phys accounting?
194 194 * held from:
195 195 * dsl_dir_*
196 196 * dsl_prop_changed_notify: none (dd_prop_cbs)
197 197 * dsl_prop_register: none (dd_prop_cbs)
198 198 * dsl_prop_unregister: none (dd_prop_cbs)
199 199 *
200 200 * os_lock (leaf)
201 201 * protects:
202 202 * os_dirty_dnodes
203 203 * os_free_dnodes
204 204 * os_dnodes
205 205 * os_downgraded_dbufs
206 206 * dn_dirtyblksz
207 207 * dn_dirty_link
208 208 * held from:
209 209 * dnode_create: none (os_dnodes)
210 210 * dnode_destroy: none (os_dnodes)
211 211 * dnode_setdirty: none (dn_dirtyblksz, os_*_dnodes)
212 212 * dnode_free: none (dn_dirtyblksz, os_*_dnodes)
213 213 *
214 214 * ds_lock
215 215 * protects:
216 216 * ds_objset
217 217 * ds_open_refcount
218 218 * ds_snapname
219 219 * ds_phys accounting
220 220 * ds_phys userrefs zapobj
221 221 * ds_reserved
222 222 * held from:
223 223 * dsl_dataset_*
224 224 *
225 225 * dr_mtx (leaf)
226 226 * protects:
227 227 * dr_children
228 228 * held from:
229 229 * dbuf_dirty
230 230 * dbuf_undirty
231 231 * dbuf_sync_indirect
232 232 * dnode_new_blkid
233 233 */
234 234
235 235 struct objset;
236 236 struct dmu_pool;
237 237
238 238 typedef struct dmu_xuio {
239 239 int next;
240 240 int cnt;
241 241 struct arc_buf **bufs;
242 242 iovec_t *iovp;
243 243 } dmu_xuio_t;
244 244
245 245 typedef struct xuio_stats {
246 246 /* loaned yet not returned arc_buf */
247 247 kstat_named_t xuiostat_onloan_rbuf;
248 248 kstat_named_t xuiostat_onloan_wbuf;
249 249 /* whether a copy is made when loaning out a read buffer */
250 250 kstat_named_t xuiostat_rbuf_copied;
251 251 kstat_named_t xuiostat_rbuf_nocopy;
252 252 /* whether a copy is made when assigning a write buffer */
253 253 kstat_named_t xuiostat_wbuf_copied;
254 254 kstat_named_t xuiostat_wbuf_nocopy;
255 255 } xuio_stats_t;
256 256
257 257 static xuio_stats_t xuio_stats = {
258 258 { "onloan_read_buf", KSTAT_DATA_UINT64 },
259 259 { "onloan_write_buf", KSTAT_DATA_UINT64 },
260 260 { "read_buf_copied", KSTAT_DATA_UINT64 },
261 261 { "read_buf_nocopy", KSTAT_DATA_UINT64 },
262 262 { "write_buf_copied", KSTAT_DATA_UINT64 },
263 263 { "write_buf_nocopy", KSTAT_DATA_UINT64 }
264 264 };
265 265
266 266 #define XUIOSTAT_INCR(stat, val) \
267 267 atomic_add_64(&xuio_stats.stat.value.ui64, (val))
268 268 #define XUIOSTAT_BUMP(stat) XUIOSTAT_INCR(stat, 1)
269 269
270 270 /*
271 271 * The list of data whose inclusion in a send stream can be pending from
272 272 * one call to backup_cb to another. Multiple calls to dump_free() and
273 273 * dump_freeobjects() can be aggregated into a single DRR_FREE or
274 274 * DRR_FREEOBJECTS replay record.
275 275 */
276 276 typedef enum {
277 277 PENDING_NONE,
278 278 PENDING_FREE,
279 279 PENDING_FREEOBJECTS
280 280 } dmu_pendop_t;
281 281
282 282 typedef struct dmu_sendarg {
283 283 list_node_t dsa_link;
|
↓ open down ↓ |
236 lines elided |
↑ open up ↑ |
284 284 dmu_replay_record_t *dsa_drr;
285 285 vnode_t *dsa_vp;
286 286 int dsa_outfd;
287 287 struct proc *dsa_proc;
288 288 offset_t *dsa_off;
289 289 objset_t *dsa_os;
290 290 zio_cksum_t dsa_zc;
291 291 uint64_t dsa_toguid;
292 292 int dsa_err;
293 293 dmu_pendop_t dsa_pending_op;
294 + boolean_t sendsize;
294 295 uint64_t dsa_featureflags;
295 296 uint64_t dsa_last_data_object;
296 297 uint64_t dsa_last_data_offset;
298 + dmu_krrp_task_t *dsa_krrp_task;
297 299 uint64_t dsa_resume_object;
298 300 uint64_t dsa_resume_offset;
299 301 boolean_t dsa_sent_begin;
300 302 boolean_t dsa_sent_end;
301 303 } dmu_sendarg_t;
302 304
305 +void *dmu_krrp_stream_init();
306 +void dmu_krrp_stream_fini(void *handler);
307 +int dmu_krrp_buffer_write(void *buf, int len,
308 + dmu_krrp_task_t *krrp_task);
309 +int dmu_krrp_buffer_read(void *buf, int len,
310 + dmu_krrp_task_t *krrp_task);
311 +void* dmu_krrp_init_send_task(void *args);
312 +void* dmu_krrp_init_recv_task(void *args);
313 +int dmu_krrp_fini_task(void *krrp_task_void);
314 +int dmu_krrp_lend_send_buffer(void *krrp_task_void,
315 + kreplication_buffer_t *buffer);
316 +int dmu_krrp_lend_recv_buffer(void *krrp_task_void,
317 + kreplication_buffer_t *buffer);
318 +
303 319 void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
304 320 void dmu_object_free_zapified(objset_t *, uint64_t, dmu_tx_t *);
305 321 int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t,
306 322 void *, dmu_buf_t **);
307 323
308 324 #ifdef __cplusplus
309 325 }
310 326 #endif
311 327
312 328 #endif /* _SYS_DMU_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX