Skip to content

Commit

Permalink
Pass info to zpool cmd whether devices are ssd-based, or rotational.
Browse files Browse the repository at this point in the history
  • Loading branch information
inkdot7 committed Sep 20, 2016
1 parent 6e2db15 commit 45082bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,12 @@ 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_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 @@ -812,6 +818,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 @@ -2898,6 +2898,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_mix)
vs->vs_nonrotational = VDEV_NONROTATIONAL_MIXED;
else if (vd->vdev_nonrot)
vs->vs_nonrotational = VDEV_NONROTATIONAL_YES;
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 45082bc

Please sign in to comment.