MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vdev_get_stats_ex

Function vdev_get_stats_ex

freebsd/contrib/openzfs/module/zfs/vdev.c:4194–4266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4192}
4193
4194void
4195vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
4196{
4197 vdev_t *tvd = vd->vdev_top;
4198 mutex_enter(&vd->vdev_stat_lock);
4199 if (vs) {
4200 bcopy(&vd->vdev_stat, vs, sizeof (*vs));
4201 vs->vs_timestamp = gethrtime() - vs->vs_timestamp;
4202 vs->vs_state = vd->vdev_state;
4203 vs->vs_rsize = vdev_get_min_asize(vd);
4204
4205 if (vd->vdev_ops->vdev_op_leaf) {
4206 vs->vs_rsize += VDEV_LABEL_START_SIZE +
4207 VDEV_LABEL_END_SIZE;
4208 /*
4209 * Report initializing progress. Since we don't
4210 * have the initializing locks held, this is only
4211 * an estimate (although a fairly accurate one).
4212 */
4213 vs->vs_initialize_bytes_done =
4214 vd->vdev_initialize_bytes_done;
4215 vs->vs_initialize_bytes_est =
4216 vd->vdev_initialize_bytes_est;
4217 vs->vs_initialize_state = vd->vdev_initialize_state;
4218 vs->vs_initialize_action_time =
4219 vd->vdev_initialize_action_time;
4220
4221 /*
4222 * Report manual TRIM progress. Since we don't have
4223 * the manual TRIM locks held, this is only an
4224 * estimate (although fairly accurate one).
4225 */
4226 vs->vs_trim_notsup = !vd->vdev_has_trim;
4227 vs->vs_trim_bytes_done = vd->vdev_trim_bytes_done;
4228 vs->vs_trim_bytes_est = vd->vdev_trim_bytes_est;
4229 vs->vs_trim_state = vd->vdev_trim_state;
4230 vs->vs_trim_action_time = vd->vdev_trim_action_time;
4231
4232 /* Set when there is a deferred resilver. */
4233 vs->vs_resilver_deferred = vd->vdev_resilver_deferred;
4234 }
4235
4236 /*
4237 * Report expandable space on top-level, non-auxiliary devices
4238 * only. The expandable space is reported in terms of metaslab
4239 * sized units since that determines how much space the pool
4240 * can expand.
4241 */
4242 if (vd->vdev_aux == NULL && tvd != NULL) {
4243 vs->vs_esize = P2ALIGN(
4244 vd->vdev_max_asize - vd->vdev_asize,
4245 1ULL << tvd->vdev_ms_shift);
4246 }
4247
4248 vs->vs_configured_ashift = vd->vdev_top != NULL
4249 ? vd->vdev_top->vdev_ashift : vd->vdev_ashift;
4250 vs->vs_logical_ashift = vd->vdev_logical_ashift;
4251 vs->vs_physical_ashift = vd->vdev_physical_ashift;

Callers 2

vdev_get_statsFunction · 0.85

Calls 6

mutex_enterFunction · 0.85
vdev_get_min_asizeFunction · 0.85
vdev_is_concreteFunction · 0.85
vdev_get_stats_ex_implFunction · 0.85
mutex_exitFunction · 0.85
gethrtimeFunction · 0.50

Tested by

no test coverage detected