FreeBSD ZFS
The Zettabyte File System

sys/bptree.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright (c) 2012 by Delphix. All rights reserved.
00023  */
00024 
00025 #ifndef _SYS_BPTREE_H
00026 #define _SYS_BPTREE_H
00027 
00028 #include <sys/spa.h>
00029 #include <sys/zio.h>
00030 
00031 #ifdef  __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 typedef struct bptree_phys {
00036         uint64_t bt_begin;
00037         uint64_t bt_end;
00038         uint64_t bt_bytes;
00039         uint64_t bt_comp;
00040         uint64_t bt_uncomp;
00041 } bptree_phys_t;
00042 
00043 typedef struct bptree_entry_phys {
00044         blkptr_t be_bp;
00045         uint64_t be_birth_txg; /* only delete blocks born after this txg */
00046         zbookmark_t be_zb; /* holds traversal resume point if needed */
00047 } bptree_entry_phys_t;
00048 
00049 typedef int bptree_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx);
00050 
00051 uint64_t bptree_alloc(objset_t *os, dmu_tx_t *tx);
00052 int bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx);
00053 
00054 void bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg,
00055     uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx);
00056 
00057 int bptree_iterate(objset_t *os, uint64_t obj, boolean_t free,
00058     bptree_itor_t func, void *arg, dmu_tx_t *tx);
00059 
00060 #ifdef  __cplusplus
00061 }
00062 #endif
00063 
00064 #endif  /* _SYS_BPTREE_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines