usr/src/uts/common/fs/zfs/sys/bptree.h
author eschrock
Mon, 21 May 2012 13:37:21 -0700
changeset 13701 1949b688d5fb
permissions -rw-r--r--
2619 asynchronous destruction of ZFS file systems (missed files)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13701
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     1
/*
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     2
 * CDDL HEADER START
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     3
 *
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     7
 *
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    11
 * and limitations under the License.
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    12
 *
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    18
 *
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    19
 * CDDL HEADER END
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    20
 */
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    21
/*
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    22
 * Copyright (c) 2012 by Delphix. All rights reserved.
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    23
 */
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    24
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    25
#ifndef	_SYS_BPTREE_H
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    26
#define	_SYS_BPTREE_H
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    27
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    28
#include <sys/spa.h>
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    29
#include <sys/zio.h>
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    30
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    31
#ifdef	__cplusplus
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    32
extern "C" {
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    33
#endif
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    34
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    35
typedef struct bptree_phys {
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    36
	uint64_t bt_begin;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    37
	uint64_t bt_end;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    38
	uint64_t bt_bytes;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    39
	uint64_t bt_comp;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    40
	uint64_t bt_uncomp;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    41
} bptree_phys_t;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    42
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    43
typedef struct bptree_entry_phys {
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    44
	blkptr_t be_bp;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    45
	uint64_t be_birth_txg; /* only delete blocks born after this txg */
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    46
	zbookmark_t be_zb; /* holds traversal resume point if needed */
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    47
} bptree_entry_phys_t;
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    48
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    49
typedef int bptree_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx);
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    50
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    51
uint64_t bptree_alloc(objset_t *os, dmu_tx_t *tx);
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    52
int bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx);
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    53
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    54
void bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg,
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    55
    uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx);
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    56
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    57
int bptree_iterate(objset_t *os, uint64_t obj, boolean_t free,
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    58
    bptree_itor_t func, void *arg, dmu_tx_t *tx);
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    59
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    60
#ifdef	__cplusplus
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    61
}
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    62
#endif
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    63
1949b688d5fb 2619 asynchronous destruction of ZFS file systems (missed files)
eschrock
parents:
diff changeset
    64
#endif	/* _SYS_BPTREE_H */