MFV 286602: 5810 zdb should print details of bpobj
Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Alex Reece <alex@delphix.com> Reviewed by: George Wilson <george@delphix.com> Reviewed by: Will Andrews <will@freebsd.org> Reviewed by: Simon Klinkert <simon.klinkert@gmail.com> Approved by: Gordon Ross <gwr@nexenta.com> Author: Matthew Ahrens <mahrens@delphix.com> illumos/illumos-gate@732885fca0
This commit is contained in:
parent
2cf624f68a
commit
799f47828d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286603
@ -95,6 +95,8 @@ static int zopt_objects = 0;
|
|||||||
static libzfs_handle_t *g_zfs;
|
static libzfs_handle_t *g_zfs;
|
||||||
static uint64_t max_inflight = 1000;
|
static uint64_t max_inflight = 1000;
|
||||||
|
|
||||||
|
static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These libumem hooks provide a reasonable set of defaults for the allocator's
|
* These libumem hooks provide a reasonable set of defaults for the allocator's
|
||||||
* debugging facilities.
|
* debugging facilities.
|
||||||
@ -418,6 +420,79 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size)
|
|||||||
zap_cursor_fini(&zc);
|
zap_cursor_fini(&zc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dump_bpobj(objset_t *os, uint64_t object, void *data, size_t size)
|
||||||
|
{
|
||||||
|
bpobj_phys_t *bpop = data;
|
||||||
|
char bytes[32], comp[32], uncomp[32];
|
||||||
|
|
||||||
|
if (bpop == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
zdb_nicenum(bpop->bpo_bytes, bytes);
|
||||||
|
zdb_nicenum(bpop->bpo_comp, comp);
|
||||||
|
zdb_nicenum(bpop->bpo_uncomp, uncomp);
|
||||||
|
|
||||||
|
(void) printf("\t\tnum_blkptrs = %llu\n",
|
||||||
|
(u_longlong_t)bpop->bpo_num_blkptrs);
|
||||||
|
(void) printf("\t\tbytes = %s\n", bytes);
|
||||||
|
if (size >= BPOBJ_SIZE_V1) {
|
||||||
|
(void) printf("\t\tcomp = %s\n", comp);
|
||||||
|
(void) printf("\t\tuncomp = %s\n", uncomp);
|
||||||
|
}
|
||||||
|
if (size >= sizeof (*bpop)) {
|
||||||
|
(void) printf("\t\tsubobjs = %llu\n",
|
||||||
|
(u_longlong_t)bpop->bpo_subobjs);
|
||||||
|
(void) printf("\t\tnum_subobjs = %llu\n",
|
||||||
|
(u_longlong_t)bpop->bpo_num_subobjs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_opt['d'] < 5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (uint64_t i = 0; i < bpop->bpo_num_blkptrs; i++) {
|
||||||
|
char blkbuf[BP_SPRINTF_LEN];
|
||||||
|
blkptr_t bp;
|
||||||
|
|
||||||
|
int err = dmu_read(os, object,
|
||||||
|
i * sizeof (bp), sizeof (bp), &bp, 0);
|
||||||
|
if (err != 0) {
|
||||||
|
(void) printf("got error %u from dmu_read\n", err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), &bp);
|
||||||
|
(void) printf("\t%s\n", blkbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
static void
|
||||||
|
dump_bpobj_subobjs(objset_t *os, uint64_t object, void *data, size_t size)
|
||||||
|
{
|
||||||
|
dmu_object_info_t doi;
|
||||||
|
|
||||||
|
VERIFY0(dmu_object_info(os, object, &doi));
|
||||||
|
uint64_t *subobjs = kmem_alloc(doi.doi_max_offset, KM_SLEEP);
|
||||||
|
|
||||||
|
int err = dmu_read(os, object, 0, doi.doi_max_offset, subobjs, 0);
|
||||||
|
if (err != 0) {
|
||||||
|
(void) printf("got error %u from dmu_read\n", err);
|
||||||
|
kmem_free(subobjs, doi.doi_max_offset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t last_nonzero = -1;
|
||||||
|
for (uint64_t i = 0; i < doi.doi_max_offset / 8; i++) {
|
||||||
|
if (subobjs[i] != 0)
|
||||||
|
last_nonzero = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int64_t i = 0; i <= last_nonzero; i++) {
|
||||||
|
(void) printf("\t%llu\n", (longlong_t)subobjs[i]);
|
||||||
|
}
|
||||||
|
kmem_free(subobjs, doi.doi_max_offset);
|
||||||
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
static void
|
static void
|
||||||
dump_ddt_zap(objset_t *os, uint64_t object, void *data, size_t size)
|
dump_ddt_zap(objset_t *os, uint64_t object, void *data, size_t size)
|
||||||
@ -1397,7 +1472,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_bpobj(bpobj_t *bpo, char *name, int indent)
|
dump_full_bpobj(bpobj_t *bpo, char *name, int indent)
|
||||||
{
|
{
|
||||||
char bytes[32];
|
char bytes[32];
|
||||||
char comp[32];
|
char comp[32];
|
||||||
@ -1411,11 +1486,12 @@ dump_bpobj(bpobj_t *bpo, char *name, int indent)
|
|||||||
zdb_nicenum(bpo->bpo_phys->bpo_comp, comp);
|
zdb_nicenum(bpo->bpo_phys->bpo_comp, comp);
|
||||||
zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp);
|
zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp);
|
||||||
(void) printf(" %*s: object %llu, %llu local blkptrs, "
|
(void) printf(" %*s: object %llu, %llu local blkptrs, "
|
||||||
"%llu subobjs, %s (%s/%s comp)\n",
|
"%llu subobjs in object %llu, %s (%s/%s comp)\n",
|
||||||
indent * 8, name,
|
indent * 8, name,
|
||||||
(u_longlong_t)bpo->bpo_object,
|
(u_longlong_t)bpo->bpo_object,
|
||||||
(u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs,
|
(u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs,
|
||||||
(u_longlong_t)bpo->bpo_phys->bpo_num_subobjs,
|
(u_longlong_t)bpo->bpo_phys->bpo_num_subobjs,
|
||||||
|
(u_longlong_t)bpo->bpo_phys->bpo_subobjs,
|
||||||
bytes, comp, uncomp);
|
bytes, comp, uncomp);
|
||||||
|
|
||||||
for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) {
|
for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) {
|
||||||
@ -1432,7 +1508,7 @@ dump_bpobj(bpobj_t *bpo, char *name, int indent)
|
|||||||
error, (u_longlong_t)subobj);
|
error, (u_longlong_t)subobj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dump_bpobj(&subbpo, "subobj", indent + 1);
|
dump_full_bpobj(&subbpo, "subobj", indent + 1);
|
||||||
bpobj_close(&subbpo);
|
bpobj_close(&subbpo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1466,7 +1542,7 @@ dump_deadlist(dsl_deadlist_t *dl)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (dl->dl_oldfmt) {
|
if (dl->dl_oldfmt) {
|
||||||
dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0);
|
dump_full_bpobj(&dl->dl_bpobj, "old-format deadlist", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1491,7 +1567,7 @@ dump_deadlist(dsl_deadlist_t *dl)
|
|||||||
(void) snprintf(buf, sizeof (buf), "mintxg %llu -> "
|
(void) snprintf(buf, sizeof (buf), "mintxg %llu -> "
|
||||||
"obj %llu", (longlong_t)dle->dle_mintxg,
|
"obj %llu", (longlong_t)dle->dle_mintxg,
|
||||||
(longlong_t)dle->dle_bpobj.bpo_object);
|
(longlong_t)dle->dle_bpobj.bpo_object);
|
||||||
dump_bpobj(&dle->dle_bpobj, buf, 0);
|
dump_full_bpobj(&dle->dle_bpobj, buf, 0);
|
||||||
} else {
|
} else {
|
||||||
(void) printf("mintxg %llu -> obj %llu\n",
|
(void) printf("mintxg %llu -> obj %llu\n",
|
||||||
(longlong_t)dle->dle_mintxg,
|
(longlong_t)dle->dle_mintxg,
|
||||||
@ -1682,8 +1758,8 @@ static object_viewer_t *object_viewer[DMU_OT_NUMTYPES + 1] = {
|
|||||||
dump_uint64, /* object array */
|
dump_uint64, /* object array */
|
||||||
dump_none, /* packed nvlist */
|
dump_none, /* packed nvlist */
|
||||||
dump_packed_nvlist, /* packed nvlist size */
|
dump_packed_nvlist, /* packed nvlist size */
|
||||||
dump_none, /* bplist */
|
dump_none, /* bpobj */
|
||||||
dump_none, /* bplist header */
|
dump_bpobj, /* bpobj header */
|
||||||
dump_none, /* SPA space map header */
|
dump_none, /* SPA space map header */
|
||||||
dump_none, /* SPA space map */
|
dump_none, /* SPA space map */
|
||||||
dump_none, /* ZIL intent log */
|
dump_none, /* ZIL intent log */
|
||||||
@ -1730,7 +1806,7 @@ static object_viewer_t *object_viewer[DMU_OT_NUMTYPES + 1] = {
|
|||||||
dump_zap, /* deadlist */
|
dump_zap, /* deadlist */
|
||||||
dump_none, /* deadlist hdr */
|
dump_none, /* deadlist hdr */
|
||||||
dump_zap, /* dsl clones */
|
dump_zap, /* dsl clones */
|
||||||
dump_none, /* bpobj subobjs */
|
dump_bpobj_subobjs, /* bpobj subobjs */
|
||||||
dump_unknown, /* Unknown type, must be last */
|
dump_unknown, /* Unknown type, must be last */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2959,10 +3035,11 @@ dump_zpool(spa_t *spa)
|
|||||||
uint64_t refcount;
|
uint64_t refcount;
|
||||||
dump_dir(dp->dp_meta_objset);
|
dump_dir(dp->dp_meta_objset);
|
||||||
if (dump_opt['d'] >= 3) {
|
if (dump_opt['d'] >= 3) {
|
||||||
dump_bpobj(&spa->spa_deferred_bpobj,
|
dump_full_bpobj(&spa->spa_deferred_bpobj,
|
||||||
"Deferred frees", 0);
|
"Deferred frees", 0);
|
||||||
if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
|
if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
|
||||||
dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj,
|
dump_full_bpobj(
|
||||||
|
&spa->spa_dsl_pool->dp_free_bpobj,
|
||||||
"Pool snapshot frees", 0);
|
"Pool snapshot frees", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/bpobj.h>
|
#include <sys/bpobj.h>
|
||||||
@ -256,9 +256,8 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx,
|
|||||||
dbuf = NULL;
|
dbuf = NULL;
|
||||||
}
|
}
|
||||||
if (free) {
|
if (free) {
|
||||||
i++;
|
|
||||||
VERIFY3U(0, ==, dmu_free_range(bpo->bpo_os, bpo->bpo_object,
|
VERIFY3U(0, ==, dmu_free_range(bpo->bpo_os, bpo->bpo_object,
|
||||||
i * sizeof (blkptr_t), -1ULL, tx));
|
(i + 1) * sizeof (blkptr_t), -1ULL, tx));
|
||||||
}
|
}
|
||||||
if (err || !bpo->bpo_havesubobj || bpo->bpo_phys->bpo_subobjs == 0)
|
if (err || !bpo->bpo_havesubobj || bpo->bpo_phys->bpo_subobjs == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_BPOBJ_H
|
#ifndef _SYS_BPOBJ_H
|
||||||
@ -77,7 +77,6 @@ void bpobj_close(bpobj_t *bpo);
|
|||||||
|
|
||||||
int bpobj_iterate(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx);
|
int bpobj_iterate(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx);
|
||||||
int bpobj_iterate_nofree(bpobj_t *bpo, bpobj_itor_t func, void *, dmu_tx_t *);
|
int bpobj_iterate_nofree(bpobj_t *bpo, bpobj_itor_t func, void *, dmu_tx_t *);
|
||||||
int bpobj_iterate_dbg(bpobj_t *bpo, uint64_t *itorp, blkptr_t *bp);
|
|
||||||
|
|
||||||
void bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dmu_tx_t *tx);
|
void bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dmu_tx_t *tx);
|
||||||
void bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, dmu_tx_t *tx);
|
void bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, dmu_tx_t *tx);
|
||||||
|
Loading…
Reference in New Issue
Block a user