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

Function vdev_config_dirty

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

* Mark a top-level vdev's config as dirty, placing it on the dirty list * so that it will be written out next time the vdev configuration is synced. * If the root vdev is specified (vdev_top == NULL), dirty all top-level vdevs. */

Source from the content-addressed store, hash-verified

4566 * If the root vdev is specified (vdev_top == NULL), dirty all top-level vdevs.
4567 */
4568void
4569vdev_config_dirty(vdev_t *vd)
4570{
4571 spa_t *spa = vd->vdev_spa;
4572 vdev_t *rvd = spa->spa_root_vdev;
4573 int c;
4574
4575 ASSERT(spa_writeable(spa));
4576
4577 /*
4578 * If this is an aux vdev (as with l2cache and spare devices), then we
4579 * update the vdev config manually and set the sync flag.
4580 */
4581 if (vd->vdev_aux != NULL) {
4582 spa_aux_vdev_t *sav = vd->vdev_aux;
4583 nvlist_t **aux;
4584 uint_t naux;
4585
4586 for (c = 0; c < sav->sav_count; c++) {
4587 if (sav->sav_vdevs[c] == vd)
4588 break;
4589 }
4590
4591 if (c == sav->sav_count) {
4592 /*
4593 * We're being removed. There's nothing more to do.
4594 */
4595 ASSERT(sav->sav_sync == B_TRUE);
4596 return;
4597 }
4598
4599 sav->sav_sync = B_TRUE;
4600
4601 if (nvlist_lookup_nvlist_array(sav->sav_config,
4602 ZPOOL_CONFIG_L2CACHE, &aux, &naux) != 0) {
4603 VERIFY(nvlist_lookup_nvlist_array(sav->sav_config,
4604 ZPOOL_CONFIG_SPARES, &aux, &naux) == 0);
4605 }
4606
4607 ASSERT(c < naux);
4608
4609 /*
4610 * Setting the nvlist in the middle if the array is a little
4611 * sketchy, but it will work.
4612 */
4613 nvlist_free(aux[c]);
4614 aux[c] = vdev_config_generate(spa, vd, B_TRUE, 0);
4615
4616 return;
4617 }
4618
4619 /*
4620 * The dirty list is protected by the SCL_CONFIG lock. The caller
4621 * must either hold SCL_CONFIG as writer, or must be the sync thread
4622 * (which holds SCL_CONFIG as reader). There's only one sync thread,
4623 * so this is sufficient to ensure mutual exclusion.
4624 */
4625 ASSERT(spa_config_held(spa, SCL_CONFIG, RW_WRITER) ||

Callers 15

spa_activate_mos_featureFunction · 0.85
zfs_ioc_pool_syncFunction · 0.85
spa_config_updateFunction · 0.85
vdev_top_transferFunction · 0.85
vdev_dtl_reassessFunction · 0.85
vdev_dtl_syncFunction · 0.85
vdev_syncFunction · 0.85
vdev_expandFunction · 0.85
spa_change_guid_syncFunction · 0.85
spa_export_commonFunction · 0.85

Calls 10

spa_writeableFunction · 0.85
vdev_config_generateFunction · 0.85
spa_config_heldFunction · 0.85
dsl_pool_sync_contextFunction · 0.85
spa_get_dslFunction · 0.85
vdev_is_concreteFunction · 0.85
nvlist_freeFunction · 0.50
list_link_activeFunction · 0.50
list_insert_headFunction · 0.50

Tested by

no test coverage detected