]> git.proxmox.com Git - mirror_zfs.git/blame - include/sys/dsl_deadlist.h
OpenZFS 7614, 9064 - zfs device evacuation/removal
[mirror_zfs.git] / include / sys / dsl_deadlist.h
CommitLineData
428870ff
BB
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.
a1d477c2 23 * Copyright (c) 2015 by Delphix. All rights reserved.
428870ff
BB
24 */
25
26#ifndef _SYS_DSL_DEADLIST_H
27#define _SYS_DSL_DEADLIST_H
28
29#include <sys/bpobj.h>
30#include <sys/zfs_context.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36struct dmu_buf;
37struct dsl_dataset;
38
39typedef struct dsl_deadlist_phys {
40 uint64_t dl_used;
41 uint64_t dl_comp;
42 uint64_t dl_uncomp;
43 uint64_t dl_pad[37]; /* pad out to 320b for future expansion */
44} dsl_deadlist_phys_t;
45
46typedef struct dsl_deadlist {
47 objset_t *dl_os;
48 uint64_t dl_object;
49 avl_tree_t dl_tree;
50 boolean_t dl_havetree;
51 struct dmu_buf *dl_dbuf;
52 dsl_deadlist_phys_t *dl_phys;
53 kmutex_t dl_lock;
54
55 /* if it's the old on-disk format: */
56 bpobj_t dl_bpobj;
57 boolean_t dl_oldfmt;
58} dsl_deadlist_t;
59
60typedef struct dsl_deadlist_entry {
61 avl_node_t dle_node;
62 uint64_t dle_mintxg;
63 bpobj_t dle_bpobj;
64} dsl_deadlist_entry_t;
65
66void dsl_deadlist_open(dsl_deadlist_t *dl, objset_t *os, uint64_t object);
67void dsl_deadlist_close(dsl_deadlist_t *dl);
68uint64_t dsl_deadlist_alloc(objset_t *os, dmu_tx_t *tx);
69void dsl_deadlist_free(objset_t *os, uint64_t dlobj, dmu_tx_t *tx);
70void dsl_deadlist_insert(dsl_deadlist_t *dl, const blkptr_t *bp, dmu_tx_t *tx);
71void dsl_deadlist_add_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx);
72void dsl_deadlist_remove_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx);
73uint64_t dsl_deadlist_clone(dsl_deadlist_t *dl, uint64_t maxtxg,
74 uint64_t mrs_obj, dmu_tx_t *tx);
75void dsl_deadlist_space(dsl_deadlist_t *dl,
76 uint64_t *usedp, uint64_t *compp, uint64_t *uncompp);
77void dsl_deadlist_space_range(dsl_deadlist_t *dl,
78 uint64_t mintxg, uint64_t maxtxg,
79 uint64_t *usedp, uint64_t *compp, uint64_t *uncompp);
80void dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, dmu_tx_t *tx);
81void dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *bpo, uint64_t mintxg,
82 dmu_tx_t *tx);
a1d477c2 83boolean_t dsl_deadlist_is_open(dsl_deadlist_t *dl);
428870ff
BB
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* _SYS_DSL_DEADLIST_H */