aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_traverse.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2015-05-14 17:41:29 -0600
committerBrian Behlendorf <[email protected]>2015-05-15 11:14:54 -0700
commite5fd1dd6820d6ebca470990e433dfa9f60afc5f7 (patch)
tree53a3ac20aa2d6b45dfb1a07dc57f75580025d8b0 /module/zfs/dmu_traverse.c
parentb1b85c8772ed28d2c8227e6d32905740817ae2c3 (diff)
Illumos 5243 - zdb -b could be much faster
5243 zdb -b could be much faster Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5243 https://github.com/illumos/illumos-gate/commit/f7950bf Ported-by: Don Brady <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3414
Diffstat (limited to 'module/zfs/dmu_traverse.c')
-rw-r--r--module/zfs/dmu_traverse.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c
index 21e34f822..8673132a0 100644
--- a/module/zfs/dmu_traverse.c
+++ b/module/zfs/dmu_traverse.c
@@ -58,6 +58,7 @@ typedef struct traverse_data {
int td_flags;
prefetch_data_t *td_pfd;
boolean_t td_paused;
+ uint64_t td_hole_birth_enabled_txg;
blkptr_cb_t *td_func;
void *td_arg;
} traverse_data_t;
@@ -226,25 +227,20 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
}
if (bp->blk_birth == 0) {
- if (spa_feature_is_active(td->td_spa, SPA_FEATURE_HOLE_BIRTH)) {
- /*
- * Since this block has a birth time of 0 it must be a
- * hole created before the SPA_FEATURE_HOLE_BIRTH
- * feature was enabled. If SPA_FEATURE_HOLE_BIRTH
- * was enabled before the min_txg for this traveral we
- * know the hole must have been created before the
- * min_txg for this traveral, so we can skip it. If
- * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg
- * for this traveral we cannot tell if the hole was
- * created before or after the min_txg for this
- * traversal, so we cannot skip it.
- */
- uint64_t hole_birth_enabled_txg;
- VERIFY(spa_feature_enabled_txg(td->td_spa,
- SPA_FEATURE_HOLE_BIRTH, &hole_birth_enabled_txg));
- if (hole_birth_enabled_txg < td->td_min_txg)
- return (0);
- }
+ /*
+ * Since this block has a birth time of 0 it must be a
+ * hole created before the SPA_FEATURE_HOLE_BIRTH
+ * feature was enabled. If SPA_FEATURE_HOLE_BIRTH
+ * was enabled before the min_txg for this traveral we
+ * know the hole must have been created before the
+ * min_txg for this traveral, so we can skip it. If
+ * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg
+ * for this traveral we cannot tell if the hole was
+ * created before or after the min_txg for this
+ * traversal, so we cannot skip it.
+ */
+ if (td->td_hole_birth_enabled_txg < td->td_min_txg)
+ return (0);
} else if (bp->blk_birth <= td->td_min_txg) {
return (0);
}
@@ -533,6 +529,13 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp,
td->td_flags = flags;
td->td_paused = B_FALSE;
+ if (spa_feature_is_active(spa, SPA_FEATURE_HOLE_BIRTH)) {
+ VERIFY(spa_feature_enabled_txg(spa,
+ SPA_FEATURE_HOLE_BIRTH, &td->td_hole_birth_enabled_txg));
+ } else {
+ td->td_hole_birth_enabled_txg = 0;
+ }
+
pd->pd_flags = flags;
mutex_init(&pd->pd_mtx, NULL, MUTEX_DEFAULT, NULL);
cv_init(&pd->pd_cv, NULL, CV_DEFAULT, NULL);