summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-12-04 23:20:44 +0000
committerdelphij <delphij@FreeBSD.org>2014-12-04 23:20:44 +0000
commita26baf65aa1c3aa3975cbda951c3f0d29e334a45 (patch)
treea79e56e7eae90e6d5e72cd3a5f24bb4c6b1e6d2f /cddl
parent36b0a2ac496a95bdf18a446e19acfe584158c076 (diff)
downloadFreeBSD-src-a26baf65aa1c3aa3975cbda951c3f0d29e334a45.zip
FreeBSD-src-a26baf65aa1c3aa3975cbda951c3f0d29e334a45.tar.gz
MFC r274276: MFV r274271:
Improve zdb -b performance: - Reduce gethrtime() call to 1/100th of blkptr's; - Skip manipulating the size-ordered tree; - Issue more (10, previously 3) async reads; - Use lighter weight testing in traverse_visitbp(); Illumos issue: 5243 zdb -b could be much faster
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
index 1fce5b6..c2c47d5 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -77,9 +77,11 @@
#ifndef lint
extern boolean_t zfs_recover;
extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
+extern int zfs_vdev_async_read_max_active;
#else
boolean_t zfs_recover;
uint64_t zfs_arc_max, zfs_arc_meta_limit;
+int zfs_vdev_async_read_max_active;
#endif
const char cmdname[] = "zdb";
@@ -2384,8 +2386,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;
@@ -2494,6 +2502,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;
@@ -3508,6 +3524,13 @@ main(int argc, char **argv)
*/
zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
+ /*
+ * "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);
g_zfs = libzfs_init();
ASSERT(g_zfs != NULL);
OpenPOWER on IntegriCloud