xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/bplist.h (revision cde58dbc)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
22*cde58dbcSMatthew Ahrens  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23fa9e4066Sahrens  */
24fa9e4066Sahrens 
25fa9e4066Sahrens #ifndef	_SYS_BPLIST_H
26fa9e4066Sahrens #define	_SYS_BPLIST_H
27fa9e4066Sahrens 
28fa9e4066Sahrens #include <sys/zfs_context.h>
29*cde58dbcSMatthew Ahrens #include <sys/spa.h>
30fa9e4066Sahrens 
31fa9e4066Sahrens #ifdef	__cplusplus
32fa9e4066Sahrens extern "C" {
33fa9e4066Sahrens #endif
34fa9e4066Sahrens 
35*cde58dbcSMatthew Ahrens typedef struct bplist_entry {
36*cde58dbcSMatthew Ahrens 	blkptr_t	bpe_blk;
37*cde58dbcSMatthew Ahrens 	list_node_t	bpe_node;
38*cde58dbcSMatthew Ahrens } bplist_entry_t;
39fa9e4066Sahrens 
40fa9e4066Sahrens typedef struct bplist {
41fa9e4066Sahrens 	kmutex_t	bpl_lock;
42*cde58dbcSMatthew Ahrens 	list_t		bpl_list;
43fa9e4066Sahrens } bplist_t;
44fa9e4066Sahrens 
45*cde58dbcSMatthew Ahrens typedef int bplist_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx);
46b24ab676SJeff Bonwick 
47*cde58dbcSMatthew Ahrens void bplist_create(bplist_t *bpl);
48*cde58dbcSMatthew Ahrens void bplist_destroy(bplist_t *bpl);
49*cde58dbcSMatthew Ahrens void bplist_append(bplist_t *bpl, const blkptr_t *bp);
50*cde58dbcSMatthew Ahrens void bplist_iterate(bplist_t *bpl, bplist_itor_t *func,
51b24ab676SJeff Bonwick     void *arg, dmu_tx_t *tx);
52fa9e4066Sahrens 
53fa9e4066Sahrens #ifdef	__cplusplus
54fa9e4066Sahrens }
55fa9e4066Sahrens #endif
56fa9e4066Sahrens 
57fa9e4066Sahrens #endif /* _SYS_BPLIST_H */
58