aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zdb/zdb.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2014-09-16 22:24:48 +0200
committerBrian Behlendorf <[email protected]>2014-10-23 10:27:55 -0700
commit0ec072487b678bb2bda110304e8efccbc7df8713 (patch)
treef3d507dae62990b0f9483015b9081a11ebf4e014 /cmd/zdb/zdb.c
parentacf58e706ce447f5d344896dc523e9d393d66f35 (diff)
Illumos 5169-5171 - zdb fixes
5169 zdb should limit its ARC size 5170 zdb -c should create more scrub i/os by default 5171 zdb should print status while loading metaslabs for leak detection Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Bayard Bell <[email protected]> Approved by: Robert Mustacchi <[email protected]> References: https://www.illumos.org/issues/5169 https://www.illumos.org/issues/5170 https://www.illumos.org/issues/5171 https://github.com/illumos/illumos-gate/commit/06be980 Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2707
Diffstat (limited to 'cmd/zdb/zdb.c')
-rw-r--r--cmd/zdb/zdb.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index fee9699db..205f65577 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -75,8 +75,10 @@
#ifndef lint
extern int zfs_recover;
+extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
#else
int zfs_recover;
+uint64_t zfs_arc_max, zfs_arc_meta_limit;
#endif
const char cmdname[] = "zdb";
@@ -88,7 +90,7 @@ extern void dump_intent_log(zilog_t *);
uint64_t *zopt_object = NULL;
int zopt_objects = 0;
libzfs_handle_t *g_zfs;
-uint64_t max_inflight = 200;
+uint64_t max_inflight = 1000;
/*
* These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -2395,7 +2397,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
zcb->zcb_readfails = 0;
- if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
+ if (dump_opt['b'] < 5 &&
gethrtime() > zcb->zcb_lastprint + NANOSEC) {
uint64_t now = gethrtime();
char buf[10];
@@ -2478,7 +2480,7 @@ static void
zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
{
zcb->zcb_spa = spa;
- int c, m;
+ uint64_t c, m;
if (!dump_opt['L']) {
vdev_t *rvd = spa->spa_root_vdev;
@@ -2497,6 +2499,15 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
* interfaces.
*/
if (msp->ms_sm != NULL) {
+ (void) fprintf(stderr,
+ "\rloading space map for "
+ "vdev %llu of %llu, "
+ "metaslab %llu of %llu ...",
+ (longlong_t)c,
+ (longlong_t)rvd->vdev_children,
+ (longlong_t)m,
+ (longlong_t)vd->vdev_ms_count);
+
msp->ms_ops = &zdb_metaslab_ops;
VERIFY0(space_map_load(msp->ms_sm,
msp->ms_tree, SM_ALLOC));
@@ -2505,6 +2516,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
mutex_exit(&msp->ms_lock);
}
}
+ (void) fprintf(stderr, "\n");
}
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
@@ -3510,6 +3522,12 @@ main(int argc, char **argv)
usage();
}
+ /*
+ * ZDB does not typically re-read blocks; therefore limit the ARC
+ * to 256 MB, which can be used entirely for metadata.
+ */
+ zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
+
kernel_init(FREAD);
if ((g_zfs = libzfs_init()) == NULL)
return (1);