diff options
author | Matthew Ahrens <[email protected]> | 2015-05-14 17:41:29 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-05-15 11:14:54 -0700 |
commit | e5fd1dd6820d6ebca470990e433dfa9f60afc5f7 (patch) | |
tree | 53a3ac20aa2d6b45dfb1a07dc57f75580025d8b0 /cmd/zdb | |
parent | b1b85c8772ed28d2c8227e6d32905740817ae2c3 (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 'cmd/zdb')
-rw-r--r-- | cmd/zdb/zdb.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index d0bebbe60..fc6e3fff0 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -76,9 +76,11 @@ #ifndef lint extern int zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; +extern int zfs_vdev_async_read_max_active; #else int zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; +int zfs_vdev_async_read_max_active; #endif const char cmdname[] = "zdb"; @@ -2513,8 +2515,14 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, zcb->zcb_readfails = 0; - if (dump_opt['b'] < 5 && - gethrtime() > zcb->zcb_lastprint + NANOSEC) { + /* only call gethrtime() every 100 blocks */ + static int iters; + if (++iters > 100) + iters = 0; + else + return (0); + + if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) { uint64_t now = gethrtime(); char buf[10]; uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize; @@ -2625,6 +2633,14 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) (longlong_t)vd->vdev_ms_count); msp->ms_ops = &zdb_metaslab_ops; + + /* + * We don't want to spend the CPU + * manipulating the size-ordered + * tree, so clear the range_tree + * ops. + */ + msp->ms_tree->rt_ops = NULL; VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); msp->ms_loaded = B_TRUE; @@ -3675,6 +3691,13 @@ main(int argc, char **argv) zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024; #endif + /* + * "zdb -c" uses checksum-verifying scrub i/os which are async reads. + * "zdb -b" uses traversal prefetch which uses async reads. + * For good performance, let several of them be active at once. + */ + zfs_vdev_async_read_max_active = 10; + kernel_init(FREAD); if ((g_zfs = libzfs_init()) == NULL) return (1); |