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

Function vdev_mirror_open

freebsd/contrib/openzfs/module/zfs/vdev_mirror.c:387–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387static int
388vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize,
389 uint64_t *logical_ashift, uint64_t *physical_ashift)
390{
391 int numerrors = 0;
392 int lasterror = 0;
393
394 if (vd->vdev_children == 0) {
395 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
396 return (SET_ERROR(EINVAL));
397 }
398
399 vdev_open_children(vd);
400
401 for (int c = 0; c < vd->vdev_children; c++) {
402 vdev_t *cvd = vd->vdev_child[c];
403
404 if (cvd->vdev_open_error) {
405 lasterror = cvd->vdev_open_error;
406 numerrors++;
407 continue;
408 }
409
410 *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1;
411 *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1;
412 *logical_ashift = MAX(*logical_ashift, cvd->vdev_ashift);
413 *physical_ashift = MAX(*physical_ashift,
414 cvd->vdev_physical_ashift);
415 }
416
417 if (numerrors == vd->vdev_children) {
418 if (vdev_children_are_offline(vd))
419 vd->vdev_stat.vs_aux = VDEV_AUX_CHILDREN_OFFLINE;
420 else
421 vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS;
422 return (lasterror);
423 }
424
425 return (0);
426}
427
428static void
429vdev_mirror_close(vdev_t *vd)

Callers

nothing calls this directly

Calls 2

vdev_open_childrenFunction · 0.85

Tested by

no test coverage detected