mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 09:12:11 +03:00
zdb: Filter log spacemaps by vdev
When requested to dump metaslabs only for specific vdev, apply the filter also to log spacemaps to reduce the output. Unfortunately filtering by metaslab numbers is more difficult so leave those. While there, tune the output formatting. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #17643
This commit is contained in:
parent
574eec2964
commit
94413bc75d
@ -1586,9 +1586,8 @@ dump_spacemap(objset_t *os, space_map_t *sm)
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t words;
|
||||
char entry_type;
|
||||
uint64_t entry_off, entry_run, entry_vdev = SM_NO_VDEVID;
|
||||
uint64_t entry_off, entry_run, entry_vdev;
|
||||
|
||||
if (sm_entry_is_single_word(word)) {
|
||||
entry_type = (SM_TYPE_DECODE(word) == SM_ALLOC) ?
|
||||
@ -1596,35 +1595,43 @@ dump_spacemap(objset_t *os, space_map_t *sm)
|
||||
entry_off = (SM_OFFSET_DECODE(word) << mapshift) +
|
||||
sm->sm_start;
|
||||
entry_run = SM_RUN_DECODE(word) << mapshift;
|
||||
words = 1;
|
||||
|
||||
(void) printf("\t [%6llu] %c "
|
||||
"range: %012llx-%012llx size: %08llx\n",
|
||||
(u_longlong_t)entry_id, entry_type,
|
||||
(u_longlong_t)entry_off,
|
||||
(u_longlong_t)(entry_off + entry_run - 1),
|
||||
(u_longlong_t)entry_run);
|
||||
} else {
|
||||
/* it is a two-word entry so we read another word */
|
||||
ASSERT(sm_entry_is_double_word(word));
|
||||
|
||||
uint64_t extra_word;
|
||||
offset += sizeof (extra_word);
|
||||
ASSERT3U(offset, <, space_map_length(sm));
|
||||
VERIFY0(dmu_read(os, space_map_object(sm), offset,
|
||||
sizeof (extra_word), &extra_word,
|
||||
DMU_READ_PREFETCH));
|
||||
|
||||
ASSERT3U(offset, <=, space_map_length(sm));
|
||||
|
||||
entry_run = SM2_RUN_DECODE(word) << mapshift;
|
||||
entry_vdev = SM2_VDEV_DECODE(word);
|
||||
entry_type = (SM2_TYPE_DECODE(extra_word) == SM_ALLOC) ?
|
||||
'A' : 'F';
|
||||
entry_off = (SM2_OFFSET_DECODE(extra_word) <<
|
||||
mapshift) + sm->sm_start;
|
||||
words = 2;
|
||||
}
|
||||
|
||||
(void) printf("\t [%6llu] %c range:"
|
||||
" %010llx-%010llx size: %06llx vdev: %06llu words: %u\n",
|
||||
(u_longlong_t)entry_id,
|
||||
entry_type, (u_longlong_t)entry_off,
|
||||
(u_longlong_t)(entry_off + entry_run),
|
||||
(u_longlong_t)entry_run,
|
||||
(u_longlong_t)entry_vdev, words);
|
||||
if (zopt_metaslab_args == 0 ||
|
||||
zopt_metaslab[0] == entry_vdev) {
|
||||
(void) printf("\t [%6llu] %c "
|
||||
"range: %012llx-%012llx size: %08llx "
|
||||
"vdev: %llu\n",
|
||||
(u_longlong_t)entry_id, entry_type,
|
||||
(u_longlong_t)entry_off,
|
||||
(u_longlong_t)(entry_off + entry_run - 1),
|
||||
(u_longlong_t)entry_run,
|
||||
(u_longlong_t)entry_vdev);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry_type == 'A')
|
||||
alloc += entry_run;
|
||||
@ -1873,7 +1880,7 @@ dump_metaslabs(spa_t *spa)
|
||||
|
||||
(void) printf("\nMetaslabs:\n");
|
||||
|
||||
if (!dump_opt['d'] && zopt_metaslab_args > 0) {
|
||||
if (zopt_metaslab_args > 0) {
|
||||
c = zopt_metaslab[0];
|
||||
|
||||
if (c >= children)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user