Print this page
4045 zfs write throttle & i/o scheduler performance work
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/dmu_tx.h
+++ new/usr/src/uts/common/fs/zfs/sys/dmu_tx.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
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
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
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 24 */
25 25 /*
26 - * Copyright (c) 2012 by Delphix. All rights reserved.
26 + * Copyright (c) 2013 by Delphix. All rights reserved.
27 27 */
28 28
29 29 #ifndef _SYS_DMU_TX_H
30 30 #define _SYS_DMU_TX_H
31 31
32 32 #include <sys/inttypes.h>
33 33 #include <sys/dmu.h>
34 34 #include <sys/txg.h>
35 35 #include <sys/refcount.h>
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
39 39 #endif
40 40
41 41 struct dmu_buf_impl;
42 42 struct dmu_tx_hold;
43 43 struct dnode_link;
44 44 struct dsl_pool;
45 45 struct dnode;
46 46 struct dsl_dir;
47 47
48 48 struct dmu_tx {
49 49 /*
50 50 * No synchronization is needed because a tx can only be handled
51 51 * by one thread.
52 52 */
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
53 53 list_t tx_holds; /* list of dmu_tx_hold_t */
54 54 objset_t *tx_objset;
55 55 struct dsl_dir *tx_dir;
56 56 struct dsl_pool *tx_pool;
57 57 uint64_t tx_txg;
58 58 uint64_t tx_lastsnap_txg;
59 59 uint64_t tx_lasttried_txg;
60 60 txg_handle_t tx_txgh;
61 61 void *tx_tempreserve_cookie;
62 62 struct dmu_tx_hold *tx_needassign_txh;
63 - list_t tx_callbacks; /* list of dmu_tx_callback_t on this dmu_tx */
64 - uint8_t tx_anyobj;
63 +
64 + /* list of dmu_tx_callback_t on this dmu_tx */
65 + list_t tx_callbacks;
66 +
67 + /* placeholder for syncing context, doesn't need specific holds */
68 + boolean_t tx_anyobj;
69 +
70 + /* has this transaction already been delayed? */
71 + boolean_t tx_waited;
72 +
73 + /* time this transaction was created */
74 + hrtime_t tx_start;
75 +
76 + /* need to wait for sufficient dirty space */
77 + boolean_t tx_wait_dirty;
78 +
65 79 int tx_err;
66 80 #ifdef ZFS_DEBUG
67 81 uint64_t tx_space_towrite;
68 82 uint64_t tx_space_tofree;
69 83 uint64_t tx_space_tooverwrite;
70 84 uint64_t tx_space_tounref;
71 85 refcount_t tx_space_written;
72 86 refcount_t tx_space_freed;
73 87 #endif
74 88 };
75 89
76 90 enum dmu_tx_hold_type {
77 91 THT_NEWOBJECT,
78 92 THT_WRITE,
79 93 THT_BONUS,
80 94 THT_FREE,
81 95 THT_ZAP,
82 96 THT_SPACE,
83 97 THT_SPILL,
84 98 THT_NUMTYPES
85 99 };
86 100
87 101 typedef struct dmu_tx_hold {
88 102 dmu_tx_t *txh_tx;
89 103 list_node_t txh_node;
90 104 struct dnode *txh_dnode;
91 105 uint64_t txh_space_towrite;
92 106 uint64_t txh_space_tofree;
93 107 uint64_t txh_space_tooverwrite;
94 108 uint64_t txh_space_tounref;
95 109 uint64_t txh_memory_tohold;
96 110 uint64_t txh_fudge;
97 111 #ifdef ZFS_DEBUG
98 112 enum dmu_tx_hold_type txh_type;
99 113 uint64_t txh_arg1;
100 114 uint64_t txh_arg2;
101 115 #endif
102 116 } dmu_tx_hold_t;
103 117
104 118 typedef struct dmu_tx_callback {
105 119 list_node_t dcb_node; /* linked to tx_callbacks list */
106 120 dmu_tx_callback_func_t *dcb_func; /* caller function pointer */
107 121 void *dcb_data; /* caller private data */
108 122 } dmu_tx_callback_t;
109 123
110 124 /*
111 125 * These routines are defined in dmu.h, and are called by the user.
112 126 */
113 127 dmu_tx_t *dmu_tx_create(objset_t *dd);
114 128 int dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how);
115 129 void dmu_tx_commit(dmu_tx_t *tx);
116 130 void dmu_tx_abort(dmu_tx_t *tx);
117 131 uint64_t dmu_tx_get_txg(dmu_tx_t *tx);
118 132 struct dsl_pool *dmu_tx_pool(dmu_tx_t *tx);
119 133 void dmu_tx_wait(dmu_tx_t *tx);
120 134
121 135 void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
122 136 void *dcb_data);
123 137 void dmu_tx_do_callbacks(list_t *cb_list, int error);
124 138
125 139 /*
126 140 * These routines are defined in dmu_spa.h, and are called by the SPA.
127 141 */
128 142 extern dmu_tx_t *dmu_tx_create_assigned(struct dsl_pool *dp, uint64_t txg);
129 143
130 144 /*
131 145 * These routines are only called by the DMU.
132 146 */
133 147 dmu_tx_t *dmu_tx_create_dd(dsl_dir_t *dd);
134 148 int dmu_tx_is_syncing(dmu_tx_t *tx);
135 149 int dmu_tx_private_ok(dmu_tx_t *tx);
136 150 void dmu_tx_add_new_object(dmu_tx_t *tx, objset_t *os, uint64_t object);
137 151 void dmu_tx_willuse_space(dmu_tx_t *tx, int64_t delta);
138 152 void dmu_tx_dirty_buf(dmu_tx_t *tx, struct dmu_buf_impl *db);
139 153 int dmu_tx_holds(dmu_tx_t *tx, uint64_t object);
140 154 void dmu_tx_hold_space(dmu_tx_t *tx, uint64_t space);
141 155
142 156 #ifdef ZFS_DEBUG
143 157 #define DMU_TX_DIRTY_BUF(tx, db) dmu_tx_dirty_buf(tx, db)
144 158 #else
145 159 #define DMU_TX_DIRTY_BUF(tx, db)
146 160 #endif
147 161
148 162 #ifdef __cplusplus
149 163 }
150 164 #endif
151 165
152 166 #endif /* _SYS_DMU_TX_H */
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX