1632 * If space < SPA_MINBLOCKSIZE, then we will not allocate from
1633 * this metaslab again. The fragmentation metric may have
1634 * decreased the space to something smaller than
1635 * SPA_MINBLOCKSIZE, so reset the space to SPA_MINBLOCKSIZE
1636 * so that we can consume any remaining space.
1637 */
1638 if (space > 0 && space < SPA_MINBLOCKSIZE)
1639 space = SPA_MINBLOCKSIZE;
1640 }
1641 weight = space;
1642
1643 /*
1644 * Modern disks have uniform bit density and constant angular velocity.
1645 * Therefore, the outer recording zones are faster (higher bandwidth)
1646 * than the inner zones by the ratio of outer to inner track diameter,
1647 * which is typically around 2:1. We account for this by assigning
1648 * higher weight to lower metaslabs (multiplier ranging from 2x to 1x).
1649 * In effect, this means that we'll select the metaslab with the most
1650 * free bandwidth rather than simply the one with the most free space.
1651 */
1652 if (metaslab_lba_weighting_enabled) {
1653 weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count;
1654 ASSERT(weight >= space && weight <= 2 * space);
1655 }
1656
1657 /*
1658 * If this metaslab is one we're actively using, adjust its
1659 * weight to make it preferable to any inactive metaslab so
1660 * we'll polish it off. If the fragmentation on this metaslab
1661 * has exceed our threshold, then don't mark it active.
1662 */
1663 if (msp->ms_loaded && msp->ms_fragmentation != ZFS_FRAG_INVALID &&
1664 msp->ms_fragmentation <= zfs_metaslab_fragmentation_threshold) {
1665 weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK);
1666 }
1667
1668 WEIGHT_SET_SPACEBASED(weight);
1669 return (weight);
1670 }
1671
1672 /*
|
1632 * If space < SPA_MINBLOCKSIZE, then we will not allocate from
1633 * this metaslab again. The fragmentation metric may have
1634 * decreased the space to something smaller than
1635 * SPA_MINBLOCKSIZE, so reset the space to SPA_MINBLOCKSIZE
1636 * so that we can consume any remaining space.
1637 */
1638 if (space > 0 && space < SPA_MINBLOCKSIZE)
1639 space = SPA_MINBLOCKSIZE;
1640 }
1641 weight = space;
1642
1643 /*
1644 * Modern disks have uniform bit density and constant angular velocity.
1645 * Therefore, the outer recording zones are faster (higher bandwidth)
1646 * than the inner zones by the ratio of outer to inner track diameter,
1647 * which is typically around 2:1. We account for this by assigning
1648 * higher weight to lower metaslabs (multiplier ranging from 2x to 1x).
1649 * In effect, this means that we'll select the metaslab with the most
1650 * free bandwidth rather than simply the one with the most free space.
1651 */
1652 if (!vd->vdev_nonrot && metaslab_lba_weighting_enabled) {
1653 weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count;
1654 ASSERT(weight >= space && weight <= 2 * space);
1655 }
1656
1657 /*
1658 * If this metaslab is one we're actively using, adjust its
1659 * weight to make it preferable to any inactive metaslab so
1660 * we'll polish it off. If the fragmentation on this metaslab
1661 * has exceed our threshold, then don't mark it active.
1662 */
1663 if (msp->ms_loaded && msp->ms_fragmentation != ZFS_FRAG_INVALID &&
1664 msp->ms_fragmentation <= zfs_metaslab_fragmentation_threshold) {
1665 weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK);
1666 }
1667
1668 WEIGHT_SET_SPACEBASED(weight);
1669 return (weight);
1670 }
1671
1672 /*
|