1168404Spjd/*
2168404Spjd * CDDL HEADER START
3168404Spjd *
4168404Spjd * The contents of this file are subject to the terms of the
5168404Spjd * Common Development and Distribution License (the "License").
6168404Spjd * You may not use this file except in compliance with the License.
7168404Spjd *
8168404Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9168404Spjd * or http://www.opensolaris.org/os/licensing.
10168404Spjd * See the License for the specific language governing permissions
11168404Spjd * and limitations under the License.
12168404Spjd *
13168404Spjd * When distributing Covered Code, include this CDDL HEADER in each
14168404Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15168404Spjd * If applicable, add the following below this CDDL HEADER, with the
16168404Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17168404Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18168404Spjd *
19168404Spjd * CDDL HEADER END
20168404Spjd */
21168404Spjd/*
22219089Spjd * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23243674Smm * Copyright (c) 2012 by Delphix. All rights reserved.
24168404Spjd */
25168404Spjd
26168404Spjd#ifndef	_SYS_DMU_TRAVERSE_H
27168404Spjd#define	_SYS_DMU_TRAVERSE_H
28168404Spjd
29168404Spjd#include <sys/zfs_context.h>
30168404Spjd#include <sys/spa.h>
31168404Spjd#include <sys/zio.h>
32168404Spjd
33168404Spjd#ifdef	__cplusplus
34168404Spjdextern "C" {
35168404Spjd#endif
36168404Spjd
37208047Smmstruct dnode_phys;
38208047Smmstruct dsl_dataset;
39219089Spjdstruct zilog;
40219089Spjdstruct arc_buf;
41168404Spjd
42219089Spjdtypedef int (blkptr_cb_t)(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
43247406Smm    const zbookmark_t *zb, const struct dnode_phys *dnp, void *arg);
44168404Spjd
45208047Smm#define	TRAVERSE_PRE			(1<<0)
46208047Smm#define	TRAVERSE_POST			(1<<1)
47208047Smm#define	TRAVERSE_PREFETCH_METADATA	(1<<2)
48208047Smm#define	TRAVERSE_PREFETCH_DATA		(1<<3)
49208047Smm#define	TRAVERSE_PREFETCH (TRAVERSE_PREFETCH_METADATA | TRAVERSE_PREFETCH_DATA)
50219089Spjd#define	TRAVERSE_HARD			(1<<4)
51168404Spjd
52219089Spjd/* Special traverse error return value to indicate skipping of children */
53219089Spjd#define	TRAVERSE_VISIT_NO_CHILDREN	-1
54168404Spjd
55219089Spjdint traverse_dataset(struct dsl_dataset *ds,
56219089Spjd    uint64_t txg_start, int flags, blkptr_cb_t func, void *arg);
57243674Smmint traverse_dataset_destroyed(spa_t *spa, blkptr_t *blkptr,
58243674Smm    uint64_t txg_start, zbookmark_t *resume, int flags,
59243674Smm    blkptr_cb_t func, void *arg);
60219089Spjdint traverse_pool(spa_t *spa,
61219089Spjd    uint64_t txg_start, int flags, blkptr_cb_t func, void *arg);
62219089Spjd
63168404Spjd#ifdef	__cplusplus
64168404Spjd}
65168404Spjd#endif
66168404Spjd
67168404Spjd#endif /* _SYS_DMU_TRAVERSE_H */
68