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.
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.
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]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include <sys/refcount.h>
48 * No synchronization is needed because a tx can only be handled
51 list_t tx_holds; /* list of dmu_tx_hold_t */
53 struct dsl_dir *tx_dir;
54 struct dsl_pool *tx_pool;
56 uint64_t tx_lastsnap_txg;
57 uint64_t tx_lasttried_txg;
59 void *tx_tempreserve_cookie;
60 struct dmu_tx_hold *tx_needassign_txh;
64 uint64_t tx_space_towrite;
65 uint64_t tx_space_tofree;
66 uint64_t tx_space_tooverwrite;
67 refcount_t tx_space_written;
68 refcount_t tx_space_freed;
72 enum dmu_tx_hold_type {
82 typedef struct dmu_tx_hold {
85 struct dnode *txh_dnode;
86 uint64_t txh_space_towrite;
87 uint64_t txh_space_tofree;
88 uint64_t txh_space_tooverwrite;
90 enum dmu_tx_hold_type txh_type;
98 * These routines are defined in dmu.h, and are called by the user.
100 dmu_tx_t *dmu_tx_create(objset_t *dd);
101 int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how);
102 void dmu_tx_commit(dmu_tx_t *tx);
103 void dmu_tx_abort(dmu_tx_t *tx);
104 uint64_t dmu_tx_get_txg(dmu_tx_t *tx);
105 void dmu_tx_wait(dmu_tx_t *tx);
108 * These routines are defined in dmu_spa.h, and are called by the SPA.
110 extern dmu_tx_t *dmu_tx_create_assigned(struct dsl_pool *dp, uint64_t txg);
113 * These routines are only called by the DMU.
115 dmu_tx_t *dmu_tx_create_dd(dsl_dir_t *dd);
116 int dmu_tx_is_syncing(dmu_tx_t *tx);
117 int dmu_tx_private_ok(dmu_tx_t *tx);
118 void dmu_tx_add_new_object(dmu_tx_t *tx, objset_t *os, uint64_t object);
119 void dmu_tx_willuse_space(dmu_tx_t *tx, int64_t delta);
120 void dmu_tx_dirty_buf(dmu_tx_t *tx, struct dmu_buf_impl *db);
121 int dmu_tx_holds(dmu_tx_t *tx, uint64_t object);
122 void dmu_tx_hold_space(dmu_tx_t *tx, uint64_t space);
125 #define DMU_TX_DIRTY_BUF(tx, db) dmu_tx_dirty_buf(tx, db)
127 #define DMU_TX_DIRTY_BUF(tx, db)
134 #endif /* _SYS_DMU_TX_H */