4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
28 */
29
30 #ifndef _SYS_DMU_IMPL_H
31 #define _SYS_DMU_IMPL_H
32
33 #include <sys/txg_impl.h>
34 #include <sys/zio.h>
35 #include <sys/dnode.h>
36 #include <sys/zfs_context.h>
37 #include <sys/zfs_ioctl.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * This is the locking strategy for the DMU. Numbers in parenthesis are
45 * cases that use that lock order, referenced below:
46 *
47 * ARC is self-contained
48 * bplist is self-contained
49 * refcount is self-contained
50 * txg is self-contained (hopefully!)
51 * zst_lock
52 * zf_rwlock
53 *
54 * XXX try to improve evicting path?
55 *
56 * dp_config_rwlock > os_obj_lock > dn_struct_rwlock >
57 * dn_dbufs_mtx > hash_mutexes > db_mtx > dd_lock > leafs
274 * DRR_FREEOBJECTS replay record.
275 */
276 typedef enum {
277 PENDING_NONE,
278 PENDING_FREE,
279 PENDING_FREEOBJECTS
280 } dmu_pendop_t;
281
282 typedef struct dmu_sendarg {
283 list_node_t dsa_link;
284 dmu_replay_record_t *dsa_drr;
285 vnode_t *dsa_vp;
286 int dsa_outfd;
287 struct proc *dsa_proc;
288 offset_t *dsa_off;
289 objset_t *dsa_os;
290 zio_cksum_t dsa_zc;
291 uint64_t dsa_toguid;
292 int dsa_err;
293 dmu_pendop_t dsa_pending_op;
294 uint64_t dsa_featureflags;
295 uint64_t dsa_last_data_object;
296 uint64_t dsa_last_data_offset;
297 uint64_t dsa_resume_object;
298 uint64_t dsa_resume_offset;
299 boolean_t dsa_sent_begin;
300 boolean_t dsa_sent_end;
301 } dmu_sendarg_t;
302
303 void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
304 void dmu_object_free_zapified(objset_t *, uint64_t, dmu_tx_t *);
305 int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t,
306 void *, dmu_buf_t **);
307
308 #ifdef __cplusplus
309 }
310 #endif
311
312 #endif /* _SYS_DMU_IMPL_H */
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
26 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #ifndef _SYS_DMU_IMPL_H
30 #define _SYS_DMU_IMPL_H
31
32 #include <sys/txg_impl.h>
33 #include <sys/zio.h>
34 #include <sys/dnode.h>
35 #include <sys/zfs_context.h>
36 #include <sys/zfs_ioctl.h>
37 #include <sys/dmu_krrp.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * This is the locking strategy for the DMU. Numbers in parenthesis are
45 * cases that use that lock order, referenced below:
46 *
47 * ARC is self-contained
48 * bplist is self-contained
49 * refcount is self-contained
50 * txg is self-contained (hopefully!)
51 * zst_lock
52 * zf_rwlock
53 *
54 * XXX try to improve evicting path?
55 *
56 * dp_config_rwlock > os_obj_lock > dn_struct_rwlock >
57 * dn_dbufs_mtx > hash_mutexes > db_mtx > dd_lock > leafs
274 * DRR_FREEOBJECTS replay record.
275 */
276 typedef enum {
277 PENDING_NONE,
278 PENDING_FREE,
279 PENDING_FREEOBJECTS
280 } dmu_pendop_t;
281
282 typedef struct dmu_sendarg {
283 list_node_t dsa_link;
284 dmu_replay_record_t *dsa_drr;
285 vnode_t *dsa_vp;
286 int dsa_outfd;
287 struct proc *dsa_proc;
288 offset_t *dsa_off;
289 objset_t *dsa_os;
290 zio_cksum_t dsa_zc;
291 uint64_t dsa_toguid;
292 int dsa_err;
293 dmu_pendop_t dsa_pending_op;
294 boolean_t sendsize;
295 uint64_t dsa_featureflags;
296 uint64_t dsa_last_data_object;
297 uint64_t dsa_last_data_offset;
298 dmu_krrp_task_t *dsa_krrp_task;
299 uint64_t dsa_resume_object;
300 uint64_t dsa_resume_offset;
301 boolean_t dsa_sent_begin;
302 boolean_t dsa_sent_end;
303 } dmu_sendarg_t;
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
319 void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
320 void dmu_object_free_zapified(objset_t *, uint64_t, dmu_tx_t *);
321 int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t,
322 void *, dmu_buf_t **);
323
324 #ifdef __cplusplus
325 }
326 #endif
327
328 #endif /* _SYS_DMU_IMPL_H */
|