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 -k flag.
  • Loading branch information
inkdot7 committed Dec 9, 2016
1 parent 1ca9fdb commit cb0e4d3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2869,6 +2869,8 @@ print_iostat_dashes(iostat_cbdata_t *cb, unsigned int force_column_width,

if (cb->cb_kind)
printf(" ----");
if (cb->cb_kind)
printf(" ---");

printf("\n");
}
Expand Down Expand Up @@ -2924,6 +2926,8 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width,

if (cb->cb_kind)
printf(" kind");
if (cb->cb_kind)
printf(" nrv");

printf("\n");

Expand Down Expand Up @@ -3376,6 +3380,8 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
int ret = 0;
uint64_t tdelta;
double scale;
nvlist_t *nvx;
uint64_t nrotor = (uint64_t) -1;

calcvs = safe_malloc(sizeof (*calcvs));

Expand Down Expand Up @@ -3455,11 +3461,21 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
print_iostat_histos(cb, oldnv, newnv, scale, name);
}

if (nvlist_lookup_nvlist(newnv, ZPOOL_CONFIG_VDEV_STATS_EX, &nvx) == 0)
nvlist_lookup_uint64(nvx, ZPOOL_CONFIG_VDEV_NROTOR,
&nrotor);

if (!(cb->cb_flags & IOS_ANYHISTO_M)) {
if (cb->cb_kind) {
printf("%s%4s", cb->cb_scripted ? "\t" : " ",
kind_mark(newnv));
}
if (cb->cb_kind) {
if (nrotor != (uint64_t) -1)
(void) printf(" %d", (int) nrotor);
else
(void) printf(" -");
}
}

if (cb->vcdl != NULL) {
Expand Down
3 changes: 3 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ typedef struct zpool_rewind_policy {

/* Kind (ssd, file, mix, hdd) (part of vdev_stat_ex_t) */
#define ZPOOL_CONFIG_VDEV_KIND "kind"
#define ZPOOL_CONFIG_VDEV_NROTOR "nrotor"

#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
#define ZPOOL_CONFIG_ERRCOUNT "error_count"
Expand Down Expand Up @@ -902,6 +903,8 @@ typedef struct vdev_stat_ex {

/* Kind of vdev (ssd, file, mixed, hdd). Exported as one value. */
uint64_t vsx_kind;
/* Allocation rotor */
uint64_t vsx_nrotor;
} vdev_stat_ex_t;

/*
Expand Down
4 changes: 4 additions & 0 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,10 @@ vdev_get_stats_ex_impl(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
vsx->vsx_kind = VDEV_KIND_MIXED;
else
vsx->vsx_kind = VDEV_KIND_HDD;
if (vd->vdev_mg)
vsx->vsx_nrotor = vd->vdev_mg->mg_nrot;
else
vsx->vsx_nrotor = -1;
}
}

Expand Down
2 changes: 2 additions & 0 deletions module/zfs/vdev_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ vdev_config_generate_stats(vdev_t *vd, nvlist_t *nv)

fnvlist_add_uint64(nvx, ZPOOL_CONFIG_VDEV_KIND, vsx->vsx_kind);

fnvlist_add_uint64(nvx, ZPOOL_CONFIG_VDEV_NROTOR, vsx->vsx_nrotor);

/* Add extended stats nvlist to main nvlist */
fnvlist_add_nvlist(nv, ZPOOL_CONFIG_VDEV_STATS_EX, nvx);

Expand Down

0 comments on commit cb0e4d3

Please sign in to comment.