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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_BPLIST_H 28 #define _SYS_BPLIST_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/dmu.h> 33 #include <sys/spa.h> 34 #include <sys/txg.h> 35 #include <sys/zfs_context.h> 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 typedef struct bplist_phys { 42 /* 43 * This is the bonus buffer for the dead lists. The object's 44 * contents is an array of bpl_entries blkptr_t's, representing 45 * a total of bpl_bytes physical space. 46 */ 47 uint64_t bpl_entries; 48 uint64_t bpl_bytes; 49 } bplist_phys_t; 50 51 typedef struct bplist_q { 52 blkptr_t bpq_blk; 53 void *bpq_next; 54 } bplist_q_t; 55 56 typedef struct bplist { 57 kmutex_t bpl_lock; 58 objset_t *bpl_mos; 59 uint64_t bpl_object; 60 int bpl_blockshift; 61 int bpl_bpshift; 62 bplist_q_t *bpl_queue; 63 bplist_phys_t *bpl_phys; 64 dmu_buf_t *bpl_dbuf; 65 dmu_buf_t *bpl_cached_dbuf; 66 } bplist_t; 67 68 extern uint64_t bplist_create(objset_t *mos, int blocksize, dmu_tx_t *tx); 69 extern void bplist_destroy(objset_t *mos, uint64_t object, dmu_tx_t *tx); 70 extern void bplist_open(bplist_t *bpl, objset_t *mos, uint64_t object); 71 extern void bplist_close(bplist_t *bpl); 72 extern boolean_t bplist_empty(bplist_t *bpl); 73 extern int bplist_iterate(bplist_t *bpl, uint64_t *itorp, blkptr_t *bp); 74 extern void bplist_enqueue(bplist_t *bpl, blkptr_t *bp, dmu_tx_t *tx); 75 extern void bplist_enqueue_deferred(bplist_t *bpl, blkptr_t *bp); 76 extern void bplist_sync(bplist_t *bpl, dmu_tx_t *tx); 77 extern void bplist_vacate(bplist_t *bpl, dmu_tx_t *tx); 78 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #endif /* _SYS_BPLIST_H */ 84