]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deadlist.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / cddl / contrib / opensolaris / uts / common / fs / zfs / sys / dsl_deadlist.h
1 /*
2  * CDDL HEADER START
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) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24
25 #ifndef _SYS_DSL_DEADLIST_H
26 #define _SYS_DSL_DEADLIST_H
27
28 #include <sys/bpobj.h>
29 #include <sys/zfs_context.h>
30
31 #ifdef  __cplusplus
32 extern "C" {
33 #endif
34
35 struct dmu_buf;
36 struct dsl_dataset;
37
38 typedef struct dsl_deadlist_phys {
39         uint64_t dl_used;
40         uint64_t dl_comp;
41         uint64_t dl_uncomp;
42         uint64_t dl_pad[37]; /* pad out to 320b for future expansion */
43 } dsl_deadlist_phys_t;
44
45 typedef struct dsl_deadlist {
46         objset_t *dl_os;
47         uint64_t dl_object;
48         avl_tree_t dl_tree;
49         boolean_t dl_havetree;
50         struct dmu_buf *dl_dbuf;
51         dsl_deadlist_phys_t *dl_phys;
52         kmutex_t dl_lock;
53
54         /* if it's the old on-disk format: */
55         bpobj_t dl_bpobj;
56         boolean_t dl_oldfmt;
57 } dsl_deadlist_t;
58
59 typedef struct dsl_deadlist_entry {
60         avl_node_t dle_node;
61         uint64_t dle_mintxg;
62         bpobj_t dle_bpobj;
63 } dsl_deadlist_entry_t;
64
65 void dsl_deadlist_open(dsl_deadlist_t *dl, objset_t *os, uint64_t object);
66 void dsl_deadlist_close(dsl_deadlist_t *dl);
67 uint64_t dsl_deadlist_alloc(objset_t *os, dmu_tx_t *tx);
68 void dsl_deadlist_free(objset_t *os, uint64_t dlobj, dmu_tx_t *tx);
69 void dsl_deadlist_insert(dsl_deadlist_t *dl, const blkptr_t *bp, dmu_tx_t *tx);
70 void dsl_deadlist_add_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx);
71 void dsl_deadlist_remove_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx);
72 uint64_t dsl_deadlist_clone(dsl_deadlist_t *dl, uint64_t maxtxg,
73     uint64_t mrs_obj, dmu_tx_t *tx);
74 void dsl_deadlist_space(dsl_deadlist_t *dl,
75     uint64_t *usedp, uint64_t *compp, uint64_t *uncompp);
76 void dsl_deadlist_space_range(dsl_deadlist_t *dl,
77     uint64_t mintxg, uint64_t maxtxg,
78     uint64_t *usedp, uint64_t *compp, uint64_t *uncompp);
79 void dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, dmu_tx_t *tx);
80 void dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *bpo, uint64_t mintxg,
81     dmu_tx_t *tx);
82
83 #ifdef  __cplusplus
84 }
85 #endif
86
87 #endif /* _SYS_DSL_DEADLIST_H */