* Mark a top-level vdev's state as dirty, so that the next pass of * spa_sync() can convert this into vdev_config_dirty(). We distinguish * the state changes from larger config changes because they require * much less locking, and are often needed for administrative actions. */
| 4659 | * much less locking, and are often needed for administrative actions. |
| 4660 | */ |
| 4661 | void |
| 4662 | vdev_state_dirty(vdev_t *vd) |
| 4663 | { |
| 4664 | spa_t *spa = vd->vdev_spa; |
| 4665 | |
| 4666 | ASSERT(spa_writeable(spa)); |
| 4667 | ASSERT(vd == vd->vdev_top); |
| 4668 | |
| 4669 | /* |
| 4670 | * The state list is protected by the SCL_STATE lock. The caller |
| 4671 | * must either hold SCL_STATE as writer, or must be the sync thread |
| 4672 | * (which holds SCL_STATE as reader). There's only one sync thread, |
| 4673 | * so this is sufficient to ensure mutual exclusion. |
| 4674 | */ |
| 4675 | ASSERT(spa_config_held(spa, SCL_STATE, RW_WRITER) || |
| 4676 | (dsl_pool_sync_context(spa_get_dsl(spa)) && |
| 4677 | spa_config_held(spa, SCL_STATE, RW_READER))); |
| 4678 | |
| 4679 | if (!list_link_active(&vd->vdev_state_dirty_node) && |
| 4680 | vdev_is_concrete(vd)) |
| 4681 | list_insert_head(&spa->spa_state_dirty_list, vd); |
| 4682 | } |
| 4683 | |
| 4684 | void |
| 4685 | vdev_state_clean(vdev_t *vd) |
no test coverage detected