FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
/*
 * Determine if a given metaslab group should skip allocations. A metaslab
 * group should avoid allocations if its free capacity is less than the
 * zfs_mg_noalloc_threshold or its fragmentation metric is greater than
 * zfs_mg_fragmentation_threshold and there is at least one metaslab group
 * that can still handle allocations.
 */
Determine if a given metaslab group should skip allocations. A metaslab
group should avoid allocations if its free capacity is less than the
zfs_mg_noalloc_threshold or its fragmentation metric is greater than
zfs_mg_fragmentation_threshold and there is at least one metaslab group
that can still handle allocations.
Determine if a given metaslab group should skip allocations . A metaslab group should avoid allocations if its free capacity is less than the zfs_mg_noalloc_threshold or its fragmentation metric is greater than zfs_mg_fragmentation_threshold and there is at least one metaslab group that can still handle allocations .
static boolean_t
metaslab_group_allocatable(metaslab_group_t *mg)
{
	vdev_t *vd = mg->mg_vd;
	spa_t *spa = vd->vdev_spa;
	metaslab_class_t *mc = mg->mg_class;
	return ((mg->mg_free_capacity > zfs_mg_noalloc_threshold &&
	    (mg->mg_fragmentation == ZFS_FRAG_INVALID ||
	    mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)) ||
	    mc != spa_normal_class(spa) || mc->mc_alloc_groups == 0);
}
static boolean_t metaslab_group_allocatable ( metaslab_group_t * mg ) { vdev_t * vd = mg -> mg_vd ; spa_t * spa = vd -> vdev_spa ; metaslab_class_t * mc = mg -> mg_class ; return ( ( mg -> mg_free_capacity > zfs_mg_noalloc_threshold && ( mg -> mg_fragmentation == ZFS_FRAG_INVALID || mg -> mg_fragmentation <= zfs_mg_fragmentation_threshold ) ) || mc != spa_normal_class ( spa ) || mc -> mc_alloc_groups == 0 ) ; }
Determine if a given metaslab group should skip allocations.
Determine if a given metaslab group should skip allocations .
/*
	 * We use two key metrics to determine if a metaslab group is
	 * considered allocatable -- free space and fragmentation. If
	 * the free space is greater than the free space threshold and
	 * the fragmentation is less than the fragmentation threshold then
	 * consider the group allocatable. There are two case when we will
	 * not consider these key metrics. The first is if the group is
	 * associated with a slog device and the second is if all groups
	 * in this metaslab class have already been consider ineligible
	 * for allocations.
	 */