Skip to content

Commit

Permalink
zpool iostat tells which rotor vector each vdev is part of.
Browse files Browse the repository at this point in the history
For the time being, abusing the -S flag.
  • Loading branch information
inkdot7 committed Oct 9, 2016
1 parent bc255f4 commit 8976f9d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -2863,17 +2865,22 @@ 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);

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);
Expand Down Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8976f9d

Please sign in to comment.