Skip to content

Commit

Permalink
Pass info to zpool cmd whether devices are solid state, or rotational.
Browse files Browse the repository at this point in the history
Info is passed in ZPOOL_CONFIG_VDEV_STATS_EX -> ZPOOL_CONFIG_VDEV_KIND.
  • Loading branch information
inkdot7 committed Dec 13, 2016
1 parent 7cbcb24 commit ce984b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ typedef struct zpool_rewind_policy {
/* vdev enclosure sysfs path */
#define ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH "vdev_enc_sysfs_path"

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

#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
#define ZPOOL_CONFIG_ERRCOUNT "error_count"
#define ZPOOL_CONFIG_NOT_PRESENT "not_present"
Expand Down Expand Up @@ -730,6 +733,14 @@ typedef enum vdev_aux {
VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
} vdev_aux_t;

typedef enum vdev_kind_info {
VDEV_KIND_UNKNOWN = 0, /* not set yet */
VDEV_KIND_SSD, /* device is solid state */
VDEV_KIND_FILE, /* device is file backed */
VDEV_KIND_MIXED, /* device has both kinds */
VDEV_KIND_HDD /* device is not solid state */
} vdev_kind_info_t;

/*
* pool state. The following states are written to disk as part of the normal
* SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
Expand Down Expand Up @@ -887,6 +898,8 @@ typedef struct vdev_stat_ex {
uint64_t vsx_agg_histo[ZIO_PRIORITY_NUM_QUEUEABLE]
[VDEV_RQ_HISTO_BUCKETS];

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

/*
Expand Down
11 changes: 11 additions & 0 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2906,6 +2906,17 @@ vdev_get_stats_ex_impl(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
&vd->vdev_queue.vq_class[t].vqc_queued_tree);
}
}
if (vsx) {
if (vd->vdev_nonrot) {
if (vd->vdev_ops == &vdev_file_ops)
vsx->vsx_kind = VDEV_KIND_FILE;
else
vsx->vsx_kind = VDEV_KIND_SSD;
} else if (vd->vdev_nonrot_mix)
vsx->vsx_kind = VDEV_KIND_MIXED;
else
vsx->vsx_kind = VDEV_KIND_HDD;
}
}

void
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 @@ -344,6 +344,8 @@ vdev_config_generate_stats(vdev_t *vd, nvlist_t *nv)
vsx->vsx_agg_histo[ZIO_PRIORITY_SCRUB],
ARRAY_SIZE(vsx->vsx_agg_histo[ZIO_PRIORITY_SCRUB]));

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

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

Expand Down

0 comments on commit ce984b5

Please sign in to comment.