3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * CDDL HEADER START
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * The contents of this file are subject to the terms of the
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * Common Development and Distribution License (the "License").
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * You may not use this file except in compliance with the License.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * See the License for the specific language governing permissions
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * and limitations under the License.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * When distributing Covered Code, include this CDDL HEADER in each
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * If applicable, add the following below this CDDL HEADER, with the
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * fields enclosed by brackets "[]" replaced with your own identifying
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * information: Portions Copyright [yyyy] [name of copyright owner]
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * CDDL HEADER END
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
7802d7bf98dec568dadf72286893b1fe5abd8602Matthew Ahrens * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingextern "C" {
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * All members of this structure must be uint64_t, for byteswap
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * purposes.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling uint64_t scn_to_examine; /* total bytes to be scanned */
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling#define SCAN_PHYS_NUMINTS (sizeof (dsl_scan_phys_t) / sizeof (uint64_t))
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * Every pool will have one dsl_scan_t and this structure will contain
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * in-memory information about the scan and a pointer to the on-disk
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * representation (i.e. dsl_scan_phys_t). Most of the state of the scan
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * is contained on-disk to allow the scan to resume in the event of a reboot
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * or panic. This structure maintains information about the behavior of a
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * running scan, some caching information, and how it should traverse the pool.
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * The following members of this structure direct the behavior of the scan:
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * scn_pausing - a scan that cannot be completed in a single txg or
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * has exceeded its allotted time will need to pause.
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * When this flag is set the scanner will stop traversing
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * the pool and write out the current state to disk.
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * scn_restart_txg - directs the scanner to either restart or start a
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * a scan at the specified txg value.
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * scn_done_txg - when a scan completes its traversal it will set
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * the completion txg to the next txg. This is necessary
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * to ensure that any blocks that were freed during
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * the scan but have not yet been processed (i.e deferred
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * frees) are accounted for.
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * This structure also maintains information about deferred frees which are
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * a special kind of traversal. Deferred free can exist in either a bptree or
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * a bpobj structure. The scn_is_bptree flag will indicate the type of
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * deferred free that is in progress. If the deferred free is part of an
b4952e17e8858d3225793b28788278de9fe6038dGeorge Wilson * asynchronous destroy then the scn_async_destroying flag will be set.
ad135b5d644628e791c3188a6ecbd9c257961ef8Christopher Siden /* for freeing blocks */
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling /* for debugging / information */
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingint dsl_scan_init(struct dsl_pool *dp, uint64_t txg);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingvoid dsl_resilver_restart(struct dsl_pool *, uint64_t txg);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingboolean_t dsl_scan_resilvering(struct dsl_pool *dp);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingboolean_t dsl_dataset_unstable(struct dsl_dataset *ds);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingvoid dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum checksum,
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingvoid dsl_scan_ds_destroyed(struct dsl_dataset *ds, struct dmu_tx *tx);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingvoid dsl_scan_ds_snapshotted(struct dsl_dataset *ds, struct dmu_tx *tx);
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Lingvoid dsl_scan_ds_clone_swapped(struct dsl_dataset *ds1, struct dsl_dataset *ds2,
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling#endif /* _SYS_DSL_SCAN_H */