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

Function vdev_remove_child

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

Source from the content-addressed store, hash-verified

457}
458
459void
460vdev_remove_child(vdev_t *pvd, vdev_t *cvd)
461{
462 int c;
463 uint_t id = cvd->vdev_id;
464
465 ASSERT(cvd->vdev_parent == pvd);
466
467 if (pvd == NULL)
468 return;
469
470 ASSERT(id < pvd->vdev_children);
471 ASSERT(pvd->vdev_child[id] == cvd);
472
473 pvd->vdev_child[id] = NULL;
474 cvd->vdev_parent = NULL;
475
476 for (c = 0; c < pvd->vdev_children; c++)
477 if (pvd->vdev_child[c])
478 break;
479
480 if (c == pvd->vdev_children) {
481 kmem_free(pvd->vdev_child, c * sizeof (vdev_t *));
482 pvd->vdev_child = NULL;
483 pvd->vdev_children = 0;
484 }
485
486 if (cvd->vdev_ops->vdev_op_leaf) {
487 spa_t *spa = cvd->vdev_spa;
488 list_remove(&spa->spa_leaf_list, cvd);
489 spa->spa_leaf_list_gen++;
490 }
491
492 /*
493 * Walk up all ancestors to update guid sum.
494 */
495 for (; pvd != NULL; pvd = pvd->vdev_parent)
496 pvd->vdev_guid_sum -= cvd->vdev_guid_sum;
497}
498
499/*
500 * Remove any holes in the child array.

Callers 8

vdev_freeFunction · 0.85
vdev_add_parentFunction · 0.85
vdev_remove_parentFunction · 0.85
vdev_splitFunction · 0.85
spa_vdev_addFunction · 0.85
spa_vdev_attachFunction · 0.85
spa_vdev_detachFunction · 0.85

Calls 2

kmem_freeFunction · 0.50
list_removeFunction · 0.50

Tested by

no test coverage detected