From 8976f9dae5da325961110eaa070b6bb483f15546 Mon Sep 17 00:00:00 2001 From: Haakan T Johansson Date: Sun, 11 Sep 2016 14:35:23 +0200 Subject: [PATCH] zpool iostat tells which rotor vector each vdev is part of. For the time being, abusing the -S flag. --- cmd/zpool/zpool_main.c | 15 ++++++++++++++- include/sys/fs/zfs.h | 1 + module/zfs/vdev.c | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 859c4684a2d1..f880991b9d29 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2804,6 +2804,8 @@ print_iostat_dashes(iostat_cbdata_t *cb, unsigned int force_column_width, if (cb->cb_nonrotational) printf(" -"); + if (!(cb->cb_flags & IOS_ANYHISTO_M)) + printf(" -"); /* For each bit in flags */ for (f = flags; f; f &= ~(1ULL << idx)) { @@ -2863,10 +2865,12 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width, else printf("%*s", namewidth, ""); - if (cb->cb_nonrotational) printf(" N"); + if (cb->cb_nonrotational) + printf(" R"); + print_iostat_labels(cb, force_column_width, iostat_top_labels); printf("%-*s", namewidth, title); @@ -2874,6 +2878,9 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width, if (cb->cb_nonrotational) printf(" R"); + if (cb->cb_nonrotational) + printf(" V"); + print_iostat_labels(cb, force_column_width, iostat_bottom_labels); print_iostat_separator_impl(cb, force_column_width); @@ -3377,6 +3384,12 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, printf("%s%s", cb->cb_scripted ? "\t" : " ", nonrotational_mark(newvs)); } + if (cb->cb_nonrotational) { + if (newvs->vs_nrotor != (uint64_t) -1) + (void) printf(" %d", (int) newvs->vs_nrotor); + else + (void) printf(" -"); + } } /* Calculate our scaling factor */ diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index fe234debf918..2d25c54945cc 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -826,6 +826,7 @@ typedef struct vdev_stat { uint64_t vs_state; /* vdev state */ uint64_t vs_aux; /* see vdev_aux_t */ uint64_t vs_nonrotational; /* nonrotational */ + uint64_t vs_nrotor; /* allocation rotor */ uint64_t vs_alloc; /* space allocated */ uint64_t vs_space; /* total capacity */ uint64_t vs_dspace; /* deflated capacity */ diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 0321963c2469..fa69d2d8a588 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -2930,6 +2930,10 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx) vs->vs_nonrotational = VDEV_NONROTATIONAL_MIXED; else vs->vs_nonrotational = VDEV_NONROTATIONAL_NO; + if (vd->vdev_mg) + vs->vs_nrotor = vd->vdev_mg->mg_nrot; + else + vs->vs_nrotor = -1; } ASSERT(spa_config_held(vd->vdev_spa, SCL_ALL, RW_READER) != 0);