usr/src/uts/common/fs/zfs/spa_misc.c
/*
 * Lock the given spa_t for the purpose of changing vdev state.
 */
Lock the given spa_t for the purpose of changing vdev state.
Lock the given spa_t for the purpose of changing vdev state .
void
spa_vdev_state_enter(spa_t *spa, int oplocks)
{
	int locks = SCL_STATE_ALL | oplocks;
	if (spa_is_root(spa)) {
		int low = locks & ~(SCL_ZIO - 1);
		int high = locks & ~low;
		spa_config_enter(spa, high, spa, RW_WRITER);
		vdev_hold(spa->spa_root_vdev);
		spa_config_enter(spa, low, spa, RW_WRITER);
	} else {
		spa_config_enter(spa, locks, spa, RW_WRITER);
	}
	spa->spa_vdev_locks = locks;
}
void spa_vdev_state_enter ( spa_t * spa , int oplocks ) { int locks = SCL_STATE_ALL | oplocks ; if ( spa_is_root ( spa ) ) { int low = locks & ~ ( SCL_ZIO - 1 ) ; int high = locks & ~ low ; spa_config_enter ( spa , high , spa , RW_WRITER ) ; vdev_hold ( spa -> spa_root_vdev ) ; spa_config_enter ( spa , low , spa , RW_WRITER ) ; } else { spa_config_enter ( spa , locks , spa , RW_WRITER ) ; } spa -> spa_vdev_locks = locks ; }
Lock the given spa_t for the purpose of changing vdev state.
Lock the given spa_t for the purpose of changing vdev state .
/*
	 * Root pools may need to read of the underlying devfs filesystem
	 * when opening up a vdev.  Unfortunately if we're holding the
	 * SCL_ZIO lock it will result in a deadlock when we try to issue
	 * the read from the root filesystem.  Instead we "prefetch"
	 * the associated vnodes that we need prior to opening the
	 * underlying devices and cache them so that we can prevent
	 * any I/O when we are doing the actual open.
	 */