1*0713e232SGeorge Wilson /* 2*0713e232SGeorge Wilson * CDDL HEADER START 3*0713e232SGeorge Wilson * 4*0713e232SGeorge Wilson * The contents of this file are subject to the terms of the 5*0713e232SGeorge Wilson * Common Development and Distribution License (the "License"). 6*0713e232SGeorge Wilson * You may not use this file except in compliance with the License. 7*0713e232SGeorge Wilson * 8*0713e232SGeorge Wilson * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*0713e232SGeorge Wilson * or http://www.opensolaris.org/os/licensing. 10*0713e232SGeorge Wilson * See the License for the specific language governing permissions 11*0713e232SGeorge Wilson * and limitations under the License. 12*0713e232SGeorge Wilson * 13*0713e232SGeorge Wilson * When distributing Covered Code, include this CDDL HEADER in each 14*0713e232SGeorge Wilson * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*0713e232SGeorge Wilson * If applicable, add the following below this CDDL HEADER, with the 16*0713e232SGeorge Wilson * fields enclosed by brackets "[]" replaced with your own identifying 17*0713e232SGeorge Wilson * information: Portions Copyright [yyyy] [name of copyright owner] 18*0713e232SGeorge Wilson * 19*0713e232SGeorge Wilson * CDDL HEADER END 20*0713e232SGeorge Wilson */ 21*0713e232SGeorge Wilson /* 22*0713e232SGeorge Wilson * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*0713e232SGeorge Wilson * Use is subject to license terms. 24*0713e232SGeorge Wilson */ 25*0713e232SGeorge Wilson 26*0713e232SGeorge Wilson /* 27*0713e232SGeorge Wilson * Copyright (c) 2013 by Delphix. All rights reserved. 28*0713e232SGeorge Wilson */ 29*0713e232SGeorge Wilson 30*0713e232SGeorge Wilson #ifndef _SYS_SPACE_REFTREE_H 31*0713e232SGeorge Wilson #define _SYS_SPACE_REFTREE_H 32*0713e232SGeorge Wilson 33*0713e232SGeorge Wilson #include <sys/range_tree.h> 34*0713e232SGeorge Wilson 35*0713e232SGeorge Wilson #ifdef __cplusplus 36*0713e232SGeorge Wilson extern "C" { 37*0713e232SGeorge Wilson #endif 38*0713e232SGeorge Wilson 39*0713e232SGeorge Wilson typedef struct space_ref { 40*0713e232SGeorge Wilson avl_node_t sr_node; /* AVL node */ 41*0713e232SGeorge Wilson uint64_t sr_offset; /* range offset (start or end) */ 42*0713e232SGeorge Wilson int64_t sr_refcnt; /* associated reference count */ 43*0713e232SGeorge Wilson } space_ref_t; 44*0713e232SGeorge Wilson 45*0713e232SGeorge Wilson void space_reftree_create(avl_tree_t *t); 46*0713e232SGeorge Wilson void space_reftree_destroy(avl_tree_t *t); 47*0713e232SGeorge Wilson void space_reftree_add_seg(avl_tree_t *t, uint64_t start, uint64_t end, 48*0713e232SGeorge Wilson int64_t refcnt); 49*0713e232SGeorge Wilson void space_reftree_add_map(avl_tree_t *t, range_tree_t *rt, int64_t refcnt); 50*0713e232SGeorge Wilson void space_reftree_generate_map(avl_tree_t *t, range_tree_t *rt, 51*0713e232SGeorge Wilson int64_t minref); 52*0713e232SGeorge Wilson 53*0713e232SGeorge Wilson #ifdef __cplusplus 54*0713e232SGeorge Wilson } 55*0713e232SGeorge Wilson #endif 56*0713e232SGeorge Wilson 57*0713e232SGeorge Wilson #endif /* _SYS_SPACE_REFTREE_H */ 58