1236884Smm/* 2236884Smm * CDDL HEADER START 3236884Smm * 4236884Smm * The contents of this file are subject to the terms of the 5236884Smm * Common Development and Distribution License (the "License"). 6236884Smm * You may not use this file except in compliance with the License. 7236884Smm * 8236884Smm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9236884Smm * or http://www.opensolaris.org/os/licensing. 10236884Smm * See the License for the specific language governing permissions 11236884Smm * and limitations under the License. 12236884Smm * 13236884Smm * When distributing Covered Code, include this CDDL HEADER in each 14236884Smm * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15236884Smm * If applicable, add the following below this CDDL HEADER, with the 16236884Smm * fields enclosed by brackets "[]" replaced with your own identifying 17236884Smm * information: Portions Copyright [yyyy] [name of copyright owner] 18236884Smm * 19236884Smm * CDDL HEADER END 20236884Smm */ 21236884Smm/* 22236884Smm * Copyright (c) 2012 by Delphix. All rights reserved. 23236884Smm */ 24236884Smm 25236884Smm#ifndef _SYS_BPTREE_H 26236884Smm#define _SYS_BPTREE_H 27236884Smm 28236884Smm#include <sys/spa.h> 29236884Smm#include <sys/zio.h> 30236884Smm 31236884Smm#ifdef __cplusplus 32236884Smmextern "C" { 33236884Smm#endif 34236884Smm 35236884Smmtypedef struct bptree_phys { 36236884Smm uint64_t bt_begin; 37236884Smm uint64_t bt_end; 38236884Smm uint64_t bt_bytes; 39236884Smm uint64_t bt_comp; 40236884Smm uint64_t bt_uncomp; 41236884Smm} bptree_phys_t; 42236884Smm 43236884Smmtypedef struct bptree_entry_phys { 44236884Smm blkptr_t be_bp; 45236884Smm uint64_t be_birth_txg; /* only delete blocks born after this txg */ 46236884Smm zbookmark_t be_zb; /* holds traversal resume point if needed */ 47236884Smm} bptree_entry_phys_t; 48236884Smm 49236884Smmtypedef int bptree_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx); 50236884Smm 51236884Smmuint64_t bptree_alloc(objset_t *os, dmu_tx_t *tx); 52236884Smmint bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx); 53236884Smm 54236884Smmvoid bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, 55236884Smm uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx); 56236884Smm 57236884Smmint bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, 58236884Smm bptree_itor_t func, void *arg, dmu_tx_t *tx); 59236884Smm 60236884Smm#ifdef __cplusplus 61236884Smm} 62236884Smm#endif 63236884Smm 64236884Smm#endif /* _SYS_BPTREE_H */ 65