Skip to content

Commit

Permalink
Set vdev_stat->vs_nonrotational in function called after vdev_open re…
Browse files Browse the repository at this point in the history
…turns.
  • Loading branch information
inkdot7 committed Oct 8, 2016
1 parent ff233a3 commit 1903075
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,17 @@ vdev_open_children(vdev_t *vd)
vd->vdev_nonrot_mix = B_FALSE;
}

static void
vdev_update_stat_nonrotational(vdev_t *vd)
{
if (vd->vdev_nonrot)
vd->vdev_stat.vs_nonrotational = VDEV_NONROTATIONAL_YES;
else if (vd->vdev_nonrot_mix)
vd->vdev_stat.vs_nonrotational = VDEV_NONROTATIONAL_MIXED;
else
vd->vdev_stat.vs_nonrotational = VDEV_NONROTATIONAL_NO;
}

/*
* Prepare a virtual device for access.
*/
Expand Down Expand Up @@ -1231,6 +1242,8 @@ vdev_open(vdev_t *vd)

error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift);

vdev_update_stat_nonrotational(vd);

/*
* Reset the vdev_reopening flag so that we actually close
* the vdev on error.
Expand Down Expand Up @@ -2898,16 +2911,6 @@ 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 1903075

Please sign in to comment.