Allow printing special vdev metaslab groups

Sometimes, we'd like to know info about the metaslab groups
on special vdevs too. So let's make -MM do something useful.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12750
This commit is contained in:
Rich Ercolani 2021-11-30 13:26:45 -05:00 committed by GitHub
parent 34eef3e9a7
commit c5ccbbdcf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1734,10 +1734,11 @@ print_vdev_metaslab_header(vdev_t *vd)
}
static void
dump_metaslab_groups(spa_t *spa)
dump_metaslab_groups(spa_t *spa, boolean_t show_special)
{
vdev_t *rvd = spa->spa_root_vdev;
metaslab_class_t *mc = spa_normal_class(spa);
metaslab_class_t *smc = spa_special_class(spa);
uint64_t fragmentation;
metaslab_class_histogram_verify(mc);
@ -1746,7 +1747,8 @@ dump_metaslab_groups(spa_t *spa)
vdev_t *tvd = rvd->vdev_child[c];
metaslab_group_t *mg = tvd->vdev_mg;
if (mg == NULL || mg->mg_class != mc)
if (mg == NULL || (mg->mg_class != mc &&
(!show_special || mg->mg_class != smc)))
continue;
metaslab_group_histogram_verify(mg);
@ -7673,7 +7675,7 @@ dump_zpool(spa_t *spa)
if (dump_opt['d'] > 2 || dump_opt['m'])
dump_metaslabs(spa);
if (dump_opt['M'])
dump_metaslab_groups(spa);
dump_metaslab_groups(spa, dump_opt['M'] > 1);
if (dump_opt['d'] > 2 || dump_opt['m']) {
dump_log_spacemaps(spa);
dump_log_spacemap_obsolete_stats(spa);

View File

@ -266,12 +266,10 @@ the percentage of free space in each space map.
.It Fl mmmm
Display every spacemap record.
.It Fl M
Display the offset, spacemap, and free space of each metaslab.
Display all "normal" vdev metaslab group information - per-vdev metaslab count, fragmentation,
and free space histogram, as well as overall pool fragmentation and histogram.
.It Fl MM
Also display information about the maximum contiguous free space and the
percentage of free space in each space map.
.It Fl MMM
Display every spacemap record.
"Special" vdevs are added to -M's normal output.
.It Fl O Ar dataset path
Look up the specified
.Ar path