3 *
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 */
25
26 #ifndef _SYS_DNODE_H
27 #define _SYS_DNODE_H
28
29 #include <sys/zfs_context.h>
30 #include <sys/avl.h>
31 #include <sys/spa.h>
32 #include <sys/txg.h>
33 #include <sys/zio.h>
34 #include <sys/refcount.h>
35 #include <sys/dmu_zfetch.h>
36 #include <sys/zrlock.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*
43 * dnode_hold() flags.
171 uint8_t dn_nblkptr; /* number of blkptrs (immutable) */
172 uint8_t dn_checksum; /* ZIO_CHECKSUM type */
173 uint8_t dn_compress; /* ZIO_COMPRESS type */
174 uint8_t dn_nlevels;
175 uint8_t dn_indblkshift;
176 uint8_t dn_datablkshift; /* zero if blksz not power of 2! */
177 uint8_t dn_moved; /* Has this dnode been moved? */
178 uint16_t dn_datablkszsec; /* in 512b sectors */
179 uint32_t dn_datablksz; /* in bytes */
180 uint64_t dn_maxblkid;
181 uint8_t dn_next_nblkptr[TXG_SIZE];
182 uint8_t dn_next_nlevels[TXG_SIZE];
183 uint8_t dn_next_indblkshift[TXG_SIZE];
184 uint8_t dn_next_bonustype[TXG_SIZE];
185 uint8_t dn_rm_spillblk[TXG_SIZE]; /* for removing spill blk */
186 uint16_t dn_next_bonuslen[TXG_SIZE];
187 uint32_t dn_next_blksz[TXG_SIZE]; /* next block size in bytes */
188
189 /* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */
190 uint32_t dn_dbufs_count; /* count of dn_dbufs */
191
192 /* protected by os_lock: */
193 list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */
194
195 /* protected by dn_mtx: */
196 kmutex_t dn_mtx;
197 list_t dn_dirty_records[TXG_SIZE];
198 avl_tree_t dn_ranges[TXG_SIZE];
199 uint64_t dn_allocated_txg;
200 uint64_t dn_free_txg;
201 uint64_t dn_assigned_txg;
202 kcondvar_t dn_notxholds;
203 enum dnode_dirtycontext dn_dirtyctx;
204 uint8_t *dn_dirtyctx_firstset; /* dbg: contents meaningless */
205
206 /* protected by own devices */
207 refcount_t dn_tx_holds;
208 refcount_t dn_holds;
209
210 kmutex_t dn_dbufs_mtx;
|
3 *
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2013 by Delphix. All rights reserved.
24 */
25
26 #ifndef _SYS_DNODE_H
27 #define _SYS_DNODE_H
28
29 #include <sys/zfs_context.h>
30 #include <sys/avl.h>
31 #include <sys/spa.h>
32 #include <sys/txg.h>
33 #include <sys/zio.h>
34 #include <sys/refcount.h>
35 #include <sys/dmu_zfetch.h>
36 #include <sys/zrlock.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*
43 * dnode_hold() flags.
171 uint8_t dn_nblkptr; /* number of blkptrs (immutable) */
172 uint8_t dn_checksum; /* ZIO_CHECKSUM type */
173 uint8_t dn_compress; /* ZIO_COMPRESS type */
174 uint8_t dn_nlevels;
175 uint8_t dn_indblkshift;
176 uint8_t dn_datablkshift; /* zero if blksz not power of 2! */
177 uint8_t dn_moved; /* Has this dnode been moved? */
178 uint16_t dn_datablkszsec; /* in 512b sectors */
179 uint32_t dn_datablksz; /* in bytes */
180 uint64_t dn_maxblkid;
181 uint8_t dn_next_nblkptr[TXG_SIZE];
182 uint8_t dn_next_nlevels[TXG_SIZE];
183 uint8_t dn_next_indblkshift[TXG_SIZE];
184 uint8_t dn_next_bonustype[TXG_SIZE];
185 uint8_t dn_rm_spillblk[TXG_SIZE]; /* for removing spill blk */
186 uint16_t dn_next_bonuslen[TXG_SIZE];
187 uint32_t dn_next_blksz[TXG_SIZE]; /* next block size in bytes */
188
189 /* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */
190 uint32_t dn_dbufs_count; /* count of dn_dbufs */
191 /* There are no level-0 blocks of this blkid or higher in dn_dbufs */
192 uint64_t dn_unlisted_l0_blkid;
193
194 /* protected by os_lock: */
195 list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */
196
197 /* protected by dn_mtx: */
198 kmutex_t dn_mtx;
199 list_t dn_dirty_records[TXG_SIZE];
200 avl_tree_t dn_ranges[TXG_SIZE];
201 uint64_t dn_allocated_txg;
202 uint64_t dn_free_txg;
203 uint64_t dn_assigned_txg;
204 kcondvar_t dn_notxholds;
205 enum dnode_dirtycontext dn_dirtyctx;
206 uint8_t *dn_dirtyctx_firstset; /* dbg: contents meaningless */
207
208 /* protected by own devices */
209 refcount_t dn_tx_holds;
210 refcount_t dn_holds;
211
212 kmutex_t dn_dbufs_mtx;
|