* Get statistics for the given vdev. */
| 4146 | * Get statistics for the given vdev. |
| 4147 | */ |
| 4148 | static void |
| 4149 | vdev_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 | |
| 4194 | void |
| 4195 | vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx) |
no test coverage detected