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
  • Loading branch information
inkdot7 committed Oct 9, 2016
1 parent 2b86c98 commit 1d621e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,13 @@ typedef enum vdev_aux {
VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
} vdev_aux_t;

typedef enum vdev_nonrotational_info {
VDEV_NONROTATIONAL_UNKNOWN = 0, /* not set yet */
VDEV_NONROTATIONAL_YES, /* device is solid state */
VDEV_NONROTATIONAL_MIXED, /* device has both kinds */
VDEV_NONROTATIONAL_NO /* device is not solid state */
} vdev_nonrotational_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 @@ -818,6 +825,7 @@ typedef struct vdev_stat {
hrtime_t vs_timestamp; /* time since vdev load */
uint64_t vs_state; /* vdev state */
uint64_t vs_aux; /* see vdev_aux_t */
uint64_t vs_nonrotational; /* nonrotational */
uint64_t vs_alloc; /* space allocated */
uint64_t vs_space; /* total capacity */
uint64_t vs_dspace; /* deflated capacity */
Expand Down
10 changes: 10 additions & 0 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,16 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
!vd->vdev_ishole) {
vs->vs_fragmentation = vd->vdev_mg->mg_fragmentation;
}
/*
* This is static information, so could be set in vd->vdev_stat
* elsewhere...?
*/
if (vd->vdev_nonrot)
vs->vs_nonrotational = VDEV_NONROTATIONAL_YES;
else if (vd->vdev_nonrot_mix)
vs->vs_nonrotational = VDEV_NONROTATIONAL_MIXED;
else
vs->vs_nonrotational = VDEV_NONROTATIONAL_NO;
}

ASSERT(spa_config_held(vd->vdev_spa, SCL_ALL, RW_READER) != 0);
Expand Down

0 comments on commit 1d621e3

Please sign in to comment.