FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
/*
 * Calculate the amount of expandable space that is available in
 * this metaslab class. If a device is expanded then its expandable
 * space will be the amount of allocatable space that is currently not
 * part of this metaslab class.
 */
Calculate the amount of expandable space that is available in
this metaslab class. If a device is expanded then its expandable
space will be the amount of allocatable space that is currently not
part of this metaslab class.
Calculate the amount of expandable space that is available in this metaslab class . If a device is expanded then its expandable space will be the amount of allocatable space that is currently not part of this metaslab class .
uint64_t
metaslab_class_expandable_space(metaslab_class_t *mc)
{
	vdev_t *rvd = mc->mc_spa->spa_root_vdev;
	uint64_t space = 0;
	spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER);
	for (int c = 0; c < rvd->vdev_children; c++) {
		vdev_t *tvd = rvd->vdev_child[c];
		metaslab_group_t *mg = tvd->vdev_mg;
		if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 ||
		    mg->mg_class != mc) {
			continue;
		}
		space += tvd->vdev_max_asize - tvd->vdev_asize;
	}
	spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG);
	return (space);
}
uint64_t metaslab_class_expandable_space ( metaslab_class_t * mc ) { vdev_t * rvd = mc -> mc_spa -> spa_root_vdev ; uint64_t space = 0 ; spa_config_enter ( mc -> mc_spa , SCL_VDEV , FTAG , RW_READER ) ; for ( int c = 0 ; c < rvd -> vdev_children ; c ++ ) { vdev_t * tvd = rvd -> vdev_child [ c ] ; metaslab_group_t * mg = tvd -> vdev_mg ; if ( tvd -> vdev_ishole || tvd -> vdev_ms_shift == 0 || mg -> mg_class != mc ) { continue ; } space += tvd -> vdev_max_asize - tvd -> vdev_asize ; } spa_config_exit ( mc -> mc_spa , SCL_VDEV , FTAG ) ; return ( space ) ; }
Calculate the amount of expandable space that is available in
 this metaslab class.
Calculate the amount of expandable space that is available in this metaslab class .