svn commit: r274271 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb
Xin LI
delphij at FreeBSD.org
Sat Nov 8 06:31:52 UTC 2014
Author: delphij
Date: Sat Nov 8 06:31:51 2014
New Revision: 274271
URL: https://svnweb.freebsd.org/changeset/base/274271
Log:
5243 zdb -b could be much faster
Reviewed by: Christopher Siden <christopher.siden at delphix.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed by: Richard Elling <richard.elling at gmail.com>
Approved by: Dan McDonald <danmcd at omniti.com>
Author: Matthew Ahrens <mahrens at delphix.com>
illumos/illumos-gate at f7950bf1145637c6dc57742a8bb95631fd5c846f
Modified:
vendor/illumos/dist/cmd/zdb/zdb.c
Changes in other areas also in this revision:
Modified:
vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c
Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==============================================================================
--- vendor/illumos/dist/cmd/zdb/zdb.c Sat Nov 8 04:24:54 2014 (r274270)
+++ vendor/illumos/dist/cmd/zdb/zdb.c Sat Nov 8 06:31:51 2014 (r274271)
@@ -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";
@@ -2355,8 +2357,14 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
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;
@@ -2465,6 +2473,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;
@@ -3478,6 +3494,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);
More information about the svn-src-all
mailing list