1fa9e4066Sahrens /* 2fa9e4066Sahrens * CDDL HEADER START 3fa9e4066Sahrens * 4fa9e4066Sahrens * The contents of this file are subject to the terms of the 5ea8dc4b6Seschrock * Common Development and Distribution License (the "License"). 6ea8dc4b6Seschrock * You may not use this file except in compliance with the License. 7fa9e4066Sahrens * 8fa9e4066Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fa9e4066Sahrens * or http://www.opensolaris.org/os/licensing. 10fa9e4066Sahrens * See the License for the specific language governing permissions 11fa9e4066Sahrens * and limitations under the License. 12fa9e4066Sahrens * 13fa9e4066Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14fa9e4066Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fa9e4066Sahrens * If applicable, add the following below this CDDL HEADER, with the 16fa9e4066Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17fa9e4066Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18fa9e4066Sahrens * 19fa9e4066Sahrens * CDDL HEADER END 20fa9e4066Sahrens */ 21fa9e4066Sahrens /* 223f9d6ad7SLin Ling * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 237802d7bfSMatthew Ahrens * Copyright (c) 2012, 2014 by Delphix. All rights reserved. 24fa9e4066Sahrens */ 25fa9e4066Sahrens 26fa9e4066Sahrens #ifndef _SYS_DMU_TRAVERSE_H 27fa9e4066Sahrens #define _SYS_DMU_TRAVERSE_H 28fa9e4066Sahrens 29fa9e4066Sahrens #include <sys/zfs_context.h> 30fa9e4066Sahrens #include <sys/spa.h> 31fa9e4066Sahrens #include <sys/zio.h> 32fa9e4066Sahrens 33fa9e4066Sahrens #ifdef __cplusplus 34fa9e4066Sahrens extern "C" { 35fa9e4066Sahrens #endif 36fa9e4066Sahrens 3788b7b0f2SMatthew Ahrens struct dnode_phys; 3888b7b0f2SMatthew Ahrens struct dsl_dataset; 39b24ab676SJeff Bonwick struct zilog; 403f9d6ad7SLin Ling struct arc_buf; 41fa9e4066Sahrens 42b24ab676SJeff Bonwick typedef int (blkptr_cb_t)(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, 437802d7bfSMatthew Ahrens const zbookmark_phys_t *zb, const struct dnode_phys *dnp, void *arg); 44fa9e4066Sahrens 4588b7b0f2SMatthew Ahrens #define TRAVERSE_PRE (1<<0) 4688b7b0f2SMatthew Ahrens #define TRAVERSE_POST (1<<1) 4788b7b0f2SMatthew Ahrens #define TRAVERSE_PREFETCH_METADATA (1<<2) 4888b7b0f2SMatthew Ahrens #define TRAVERSE_PREFETCH_DATA (1<<3) 4988b7b0f2SMatthew Ahrens #define TRAVERSE_PREFETCH (TRAVERSE_PREFETCH_METADATA | TRAVERSE_PREFETCH_DATA) 50cd088ea4SVictor Latushkin #define TRAVERSE_HARD (1<<4) 51fa9e4066Sahrens 52*eb633035STom Caputi /* 53*eb633035STom Caputi * Encrypted dnode blocks have encrypted bonus buffers while the rest 54*eb633035STom Caputi * of the dnode is left unencrypted. Callers can specify the 55*eb633035STom Caputi * TRAVERSE_NO_DECRYPT flag to indicate to the traversal code that 56*eb633035STom Caputi * they wish to receive the raw encrypted dnodes instead of attempting 57*eb633035STom Caputi * to read the logical data. 58*eb633035STom Caputi */ 59*eb633035STom Caputi #define TRAVERSE_NO_DECRYPT (1<<5) 60*eb633035STom Caputi 6199d5e173STim Haley /* Special traverse error return value to indicate skipping of children */ 6299d5e173STim Haley #define TRAVERSE_VISIT_NO_CHILDREN -1 6399d5e173STim Haley 64bbfd46c4SJeff Bonwick int traverse_dataset(struct dsl_dataset *ds, 65bbfd46c4SJeff Bonwick uint64_t txg_start, int flags, blkptr_cb_t func, void *arg); 669c3fd121SMatthew Ahrens int traverse_dataset_resume(struct dsl_dataset *ds, uint64_t txg_start, 679c3fd121SMatthew Ahrens zbookmark_phys_t *resume, int flags, blkptr_cb_t func, void *arg); 68ad135b5dSChristopher Siden int traverse_dataset_destroyed(spa_t *spa, blkptr_t *blkptr, 697802d7bfSMatthew Ahrens uint64_t txg_start, zbookmark_phys_t *resume, int flags, 70ad135b5dSChristopher Siden blkptr_cb_t func, void *arg); 71bbfd46c4SJeff Bonwick int traverse_pool(spa_t *spa, 72bbfd46c4SJeff Bonwick uint64_t txg_start, int flags, blkptr_cb_t func, void *arg); 73fa9e4066Sahrens 74fa9e4066Sahrens #ifdef __cplusplus 75fa9e4066Sahrens } 76fa9e4066Sahrens #endif 77fa9e4066Sahrens 78fa9e4066Sahrens #endif /* _SYS_DMU_TRAVERSE_H */ 79