FreeBSD ZFS
The Zettabyte File System
|
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) 2010, Oracle and/or its affiliates. All rights reserved. 00023 * Copyright (c) 2012 by Delphix. All rights reserved. 00024 */ 00025 00026 #ifndef _SYS_DSL_SCAN_H 00027 #define _SYS_DSL_SCAN_H 00028 00029 #include <sys/zfs_context.h> 00030 #include <sys/zio.h> 00031 #include <sys/ddt.h> 00032 #include <sys/bplist.h> 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 struct objset; 00039 struct dsl_dir; 00040 struct dsl_dataset; 00041 struct dsl_pool; 00042 struct dmu_tx; 00043 00044 /* 00045 * All members of this structure must be uint64_t, for byteswap 00046 * purposes. 00047 */ 00048 typedef struct dsl_scan_phys { 00049 uint64_t scn_func; 00050 uint64_t scn_state; 00051 uint64_t scn_queue_obj; 00052 uint64_t scn_min_txg; 00053 uint64_t scn_max_txg; 00054 uint64_t scn_cur_min_txg; 00055 uint64_t scn_cur_max_txg; 00056 uint64_t scn_start_time; 00057 uint64_t scn_end_time; 00058 uint64_t scn_to_examine; 00059 uint64_t scn_examined; 00060 uint64_t scn_to_process; 00061 uint64_t scn_processed; 00062 uint64_t scn_errors; 00063 uint64_t scn_ddt_class_max; 00064 ddt_bookmark_t scn_ddt_bookmark; 00065 zbookmark_t scn_bookmark; 00066 uint64_t scn_flags; 00067 } dsl_scan_phys_t; 00068 00069 #define SCAN_PHYS_NUMINTS (sizeof (dsl_scan_phys_t) / sizeof (uint64_t)) 00070 00071 typedef enum dsl_scan_flags { 00072 DSF_VISIT_DS_AGAIN = 1<<0, 00073 } dsl_scan_flags_t; 00074 00075 typedef struct dsl_scan { 00076 struct dsl_pool *scn_dp; 00077 00078 boolean_t scn_pausing; 00079 uint64_t scn_restart_txg; 00080 uint64_t scn_sync_start_time; 00081 zio_t *scn_zio_root; 00082 00084 boolean_t scn_is_bptree; 00085 00087 uint64_t scn_visited_this_txg; 00088 00089 dsl_scan_phys_t scn_phys; 00090 } dsl_scan_t; 00091 00092 int dsl_scan_init(struct dsl_pool *dp, uint64_t txg); 00093 void dsl_scan_fini(struct dsl_pool *dp); 00094 void dsl_scan_sync(struct dsl_pool *, dmu_tx_t *); 00095 int dsl_scan_cancel(struct dsl_pool *); 00096 int dsl_scan(struct dsl_pool *, pool_scan_func_t); 00097 void dsl_resilver_restart(struct dsl_pool *, uint64_t txg); 00098 boolean_t dsl_scan_resilvering(struct dsl_pool *dp); 00099 boolean_t dsl_dataset_unstable(struct dsl_dataset *ds); 00100 void dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum checksum, 00101 ddt_entry_t *dde, dmu_tx_t *tx); 00102 void dsl_scan_ds_destroyed(struct dsl_dataset *ds, struct dmu_tx *tx); 00103 void dsl_scan_ds_snapshotted(struct dsl_dataset *ds, struct dmu_tx *tx); 00104 void dsl_scan_ds_clone_swapped(struct dsl_dataset *ds1, struct dsl_dataset *ds2, 00105 struct dmu_tx *tx); 00106 boolean_t dsl_scan_active(dsl_scan_t *scn); 00107 00108 #ifdef __cplusplus 00109 } 00110 #endif 00111 00112 #endif /* _SYS_DSL_SCAN_H */