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

Function vdev_get_stats_ex_impl

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

* Get statistics for the given vdev. */

Source from the content-addressed store, hash-verified

4146 * Get statistics for the given vdev.
4147 */
4148static void
4149vdev_get_stats_ex_impl(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
4150{
4151 int t;
4152 /*
4153 * If we're getting stats on the root vdev, aggregate the I/O counts
4154 * over all top-level vdevs (i.e. the direct children of the root).
4155 */
4156 if (!vd->vdev_ops->vdev_op_leaf) {
4157 if (vs) {
4158 memset(vs->vs_ops, 0, sizeof (vs->vs_ops));
4159 memset(vs->vs_bytes, 0, sizeof (vs->vs_bytes));
4160 }
4161 if (vsx)
4162 memset(vsx, 0, sizeof (*vsx));
4163
4164 for (int c = 0; c < vd->vdev_children; c++) {
4165 vdev_t *cvd = vd->vdev_child[c];
4166 vdev_stat_t *cvs = &cvd->vdev_stat;
4167 vdev_stat_ex_t *cvsx = &cvd->vdev_stat_ex;
4168
4169 vdev_get_stats_ex_impl(cvd, cvs, cvsx);
4170 if (vs)
4171 vdev_get_child_stat(cvd, vs, cvs);
4172 if (vsx)
4173 vdev_get_child_stat_ex(cvd, vsx, cvsx);
4174 }
4175 } else {
4176 /*
4177 * We're a leaf. Just copy our ZIO active queue stats in. The
4178 * other leaf stats are updated in vdev_stat_update().
4179 */
4180 if (!vsx)
4181 return;
4182
4183 memcpy(vsx, &vd->vdev_stat_ex, sizeof (vd->vdev_stat_ex));
4184
4185 for (t = 0; t < ARRAY_SIZE(vd->vdev_queue.vq_class); t++) {
4186 vsx->vsx_active_queue[t] =
4187 vd->vdev_queue.vq_class[t].vqc_active;
4188 vsx->vsx_pend_queue[t] = avl_numnodes(
4189 &vd->vdev_queue.vq_class[t].vqc_queued_tree);
4190 }
4191 }
4192}
4193
4194void
4195vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)

Callers 1

vdev_get_stats_exFunction · 0.85

Calls 5

memsetFunction · 0.85
vdev_get_child_statFunction · 0.85
vdev_get_child_stat_exFunction · 0.85
avl_numnodesFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected