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 https://opensource.org/licenses/CDDL-1.0.
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2015, 2019 by Delphix. All rights reserved.
33 #include <sys/zfs_context.h>
34 #include <sys/bplist.h>
40 typedef struct bpobj_phys
{
42 * This is the bonus buffer for the dead lists. The object's
43 * contents is an array of bpo_entries blkptr_t's, representing
44 * a total of bpo_bytes physical space.
46 uint64_t bpo_num_blkptrs
;
51 uint64_t bpo_num_subobjs
;
52 uint64_t bpo_num_freed
;
55 #define BPOBJ_SIZE_V0 (2 * sizeof (uint64_t))
56 #define BPOBJ_SIZE_V1 (4 * sizeof (uint64_t))
57 #define BPOBJ_SIZE_V2 (6 * sizeof (uint64_t))
59 typedef struct bpobj
{
65 uint8_t bpo_havesubobj
;
66 uint8_t bpo_havefreed
;
67 bpobj_phys_t
*bpo_phys
;
69 dmu_buf_t
*bpo_cached_dbuf
;
72 typedef int bpobj_itor_t(void *arg
, const blkptr_t
*bp
, boolean_t bp_freed
,
75 uint64_t bpobj_alloc(objset_t
*mos
, int blocksize
, dmu_tx_t
*tx
);
76 uint64_t bpobj_alloc_empty(objset_t
*os
, int blocksize
, dmu_tx_t
*tx
);
77 void bpobj_free(objset_t
*os
, uint64_t obj
, dmu_tx_t
*tx
);
78 void bpobj_decr_empty(objset_t
*os
, dmu_tx_t
*tx
);
80 int bpobj_open(bpobj_t
*bpo
, objset_t
*mos
, uint64_t object
);
81 void bpobj_close(bpobj_t
*bpo
);
82 boolean_t
bpobj_is_open(const bpobj_t
*bpo
);
84 int bpobj_iterate(bpobj_t
*bpo
, bpobj_itor_t func
, void *arg
, dmu_tx_t
*tx
);
85 int bpobj_iterate_nofree(bpobj_t
*bpo
, bpobj_itor_t func
, void *, uint64_t *);
86 int livelist_bpobj_iterate_from_nofree(bpobj_t
*bpo
, bpobj_itor_t func
,
87 void *arg
, int64_t start
);
89 void bpobj_enqueue_subobj(bpobj_t
*bpo
, uint64_t subobj
, dmu_tx_t
*tx
);
90 void bpobj_prefetch_subobj(bpobj_t
*bpo
, uint64_t subobj
);
91 void bpobj_enqueue(bpobj_t
*bpo
, const blkptr_t
*bp
, boolean_t bp_freed
,
94 int bpobj_space(bpobj_t
*bpo
,
95 uint64_t *usedp
, uint64_t *compp
, uint64_t *uncompp
);
96 int bpobj_space_range(bpobj_t
*bpo
, uint64_t mintxg
, uint64_t maxtxg
,
97 uint64_t *usedp
, uint64_t *compp
, uint64_t *uncompp
);
98 boolean_t
bpobj_is_empty(bpobj_t
*bpo
);
100 int bplist_append_cb(void *arg
, const blkptr_t
*bp
, boolean_t bp_freed
,
107 #endif /* _SYS_BPOBJ_H */