Lines Matching refs:weight

278 static void metaslab_passivate(metaslab_t *msp, uint64_t weight);
1015 metaslab_group_sort_impl(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight)
1020 msp->ms_weight = weight;
1026 metaslab_group_sort(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight)
1029 * Although in principle the weight can be any value, in
1032 ASSERT(weight >= SPA_MINBLOCKSIZE || weight == 0);
1036 metaslab_group_sort_impl(mg, msp, weight);
1596 * The metaslab's weight will also be initialized when we sync
1782 * Compute a weight -- a selection preference value -- for the given metaslab.
1791 uint64_t weight, space;
1797 * The baseline weight is the metaslab's free space.
1805 * down the baseline weight. We need to ensure that we
1822 weight = space;
1829 * higher weight to lower metaslabs (multiplier ranging from 2x to 1x).
1834 weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count;
1835 ASSERT(weight >= space && weight <= 2 * space);
1840 * weight to make it preferable to any inactive metaslab so
1846 weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK);
1849 WEIGHT_SET_SPACEBASED(weight);
1850 return (weight);
1854 * Return the weight of the specified metaslab, according to the segment-based
1862 uint64_t weight = 0;
1886 WEIGHT_SET_COUNT(weight, segments);
1887 WEIGHT_SET_INDEX(weight, i);
1888 WEIGHT_SET_ACTIVE(weight, 0);
1892 return (weight);
1896 * Calculate the weight based on the on-disk histogram. This should only
1903 uint64_t weight = 0;
1907 WEIGHT_SET_COUNT(weight,
1909 WEIGHT_SET_INDEX(weight, i +
1911 WEIGHT_SET_ACTIVE(weight, 0);
1915 return (weight);
1919 * Compute a segment-based weight for the specified metaslab. The weight
1921 * for the highest bucket is encoded into the weight value.
1927 uint64_t weight = 0;
1940 WEIGHT_SET_COUNT(weight, 1ULL);
1941 WEIGHT_SET_INDEX(weight, idx);
1943 WEIGHT_SET_COUNT(weight, 1ULL << (idx - max_idx));
1944 WEIGHT_SET_INDEX(weight, max_idx);
1946 WEIGHT_SET_ACTIVE(weight, 0);
1947 ASSERT(!WEIGHT_IS_SPACEBASED(weight));
1949 return (weight);
1955 * If the metaslab is fully allocated then just make the weight 0.
1961 * determine the weight. Otherwise, we rely on the space map information
1962 * to generate the weight.
1965 weight = metaslab_weight_from_range_tree(msp);
1967 weight = metaslab_weight_from_spacemap(msp);
1971 * If the metaslab was active the last time we calculated its weight
1973 * is associated with this weight.
1975 if (msp->ms_activation_weight != 0 && weight != 0)
1976 WEIGHT_SET_ACTIVE(weight, WEIGHT_GET_ACTIVE(msp->ms_weight));
1977 return (weight);
1985 * can accommodate based on the index encoded in the weight. If we're using
1986 * space-based weights then rely on the entire weight (excluding the weight
1999 * The metaslab segment weight indicates segments in the
2000 * range [2^i, 2^(i+1)), where i is the index in the weight.
2018 uint64_t weight;
2046 weight = metaslab_segment_weight(msp);
2048 weight = metaslab_space_weight(msp);
2050 return (weight);
2120 uint64_t weight)
2124 metaslab_group_sort(mg, msp, weight);
2142 metaslab_group_sort_impl(mg, msp, weight);
2147 metaslab_passivate(metaslab_t *msp, uint64_t weight)
2149 uint64_t size = weight & ~METASLAB_WEIGHT_TYPE;
2158 ASSERT0(weight & METASLAB_ACTIVE_MASK);
2161 metaslab_passivate_allocator(msp->ms_group, msp, weight);
2187 * histogram; calculate the new weight based on that information.
2189 uint64_t weight = metaslab_weight_from_range_tree(msp);
2191 int current_idx = WEIGHT_GET_INDEX(weight);
2194 metaslab_passivate(msp, weight);
3014 * Find the metaslab with the highest weight that is less than what we've
3154 * another thread may have changed the weight while we
3243 * a new weight for this metaslab. Now that we have loaded
3250 * space weight that was calculated by metaslab_weight().
3255 * For segment-based metaslabs, determine the new weight
3257 * explicitly use the loaded segment weight (i.e. the range
3263 uint64_t weight = metaslab_block_maxsize(msp);
3264 WEIGHT_SET_SPACEBASED(weight);
3265 metaslab_passivate(msp, weight);