Lines Matching defs:weight
329 * worse weight but it can actually satisfy the allocation, we won't find it
331 * (and the true weight is better than we have calculated), or due to weight
336 * bucket, and therefore a lower weight).
345 static void metaslab_passivate(metaslab_t *msp, uint64_t weight);
1150 metaslab_group_sort_impl(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight)
1157 msp->ms_weight = weight;
1163 metaslab_group_sort(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight)
1166 * Although in principle the weight can be any value, in
1169 ASSERT(weight >= SPA_MINBLOCKSIZE || weight == 0);
1173 metaslab_group_sort_impl(mg, msp, weight);
2117 * Ensure that the metaslab's weight and fragmentation are consistent
2142 * Devices being removed always return a weight of 0 and leave
2153 * and thus the weight.
2175 uint64_t weight = msp->ms_weight;
2189 * should be active or not, we want to ensure that the actual weight
2202 * If the weight type changed then there is no point in doing
2208 msp->ms_weight = weight;
2213 VERIFY3U(msp->ms_weight, ==, weight);
2275 * because doing so could cause the metaslab's weight
2279 * currently active because they are high-weight
2471 * metaslab is loaded so we get the metaslab's real weight.
2474 * has not yet been converted to use segment-based weight, we
2475 * expect the new weight to be better or equal to the weight
2477 * because the old weight does not take into account the
2481 uint64_t weight = msp->ms_weight;
2484 if (!WEIGHT_IS_SPACEBASED(weight))
2485 ASSERT3U(weight, <=, msp->ms_weight);
2510 (u_longlong_t)weight, (u_longlong_t)msp->ms_weight);
2604 "ms_id %llu, weight %llx, "
2621 * We explicitly recalculate the metaslab's weight based on its space
2625 * [see metaslab_load()]. This way, the weight reflects the information
2776 * The metaslab's weight will also be initialized when we sync
3015 * Compute a weight -- a selection preference value -- for the given metaslab.
3024 uint64_t weight, space;
3029 * The baseline weight is the metaslab's free space.
3037 * down the baseline weight. We need to ensure that we
3054 weight = space;
3061 * higher weight to lower metaslabs (multiplier ranging from 2x to 1x).
3066 weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count;
3067 ASSERT(weight >= space && weight <= 2 * space);
3072 * weight to make it preferable to any inactive metaslab so
3078 weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK);
3081 WEIGHT_SET_SPACEBASED(weight);
3082 return (weight);
3086 * Return the weight of the specified metaslab, according to the segment-based
3094 uint64_t weight = 0;
3118 WEIGHT_SET_COUNT(weight, segments);
3119 WEIGHT_SET_INDEX(weight, i);
3120 WEIGHT_SET_ACTIVE(weight, 0);
3124 return (weight);
3128 * Calculate the weight based on the on-disk histogram. Should be applied
3147 * accurate weight.
3158 uint64_t weight = 0;
3165 WEIGHT_SET_COUNT(weight, count);
3166 WEIGHT_SET_INDEX(weight, i + sm->sm_shift);
3167 WEIGHT_SET_ACTIVE(weight, 0);
3171 return (weight);
3175 * Compute a segment-based weight for the specified metaslab. The weight
3177 * for the highest bucket is encoded into the weight value.
3183 uint64_t weight = 0;
3196 WEIGHT_SET_COUNT(weight, 1ULL);
3197 WEIGHT_SET_INDEX(weight, idx);
3199 WEIGHT_SET_COUNT(weight, 1ULL << (idx - max_idx));
3200 WEIGHT_SET_INDEX(weight, max_idx);
3202 WEIGHT_SET_ACTIVE(weight, 0);
3203 ASSERT(!WEIGHT_IS_SPACEBASED(weight));
3204 return (weight);
3210 * If the metaslab is fully allocated then just make the weight 0.
3216 * determine the weight. Otherwise, we rely on the space map information
3217 * to generate the weight.
3220 weight = metaslab_weight_from_range_tree(msp);
3222 weight = metaslab_weight_from_spacemap(msp);
3226 * If the metaslab was active the last time we calculated its weight
3228 * is associated with this weight.
3230 if (msp->ms_activation_weight != 0 && weight != 0)
3231 WEIGHT_SET_ACTIVE(weight, WEIGHT_GET_ACTIVE(msp->ms_weight));
3232 return (weight);
3240 * weight. For segment-based weighting we can determine the maximum
3242 * weights we rely on the entire weight (excluding the weight-type bit).
3271 * The metaslab segment weight indicates segments in the
3272 * range [2^i, 2^(i+1)), where i is the index in the weight.
3291 uint64_t weight;
3321 weight = metaslab_segment_weight(msp);
3323 weight = metaslab_space_weight(msp);
3325 return (weight);
3390 * requested activation weight. The metaslab could have started
3412 * that scenario, we recheck the weight of the metaslab
3416 * it was activated with a different activation weight (e.g.
3436 * If the metaslab has literally 0 space, it will have weight 0. In
3460 uint64_t weight)
3466 metaslab_group_sort(mg, msp, weight);
3486 metaslab_group_sort_impl(mg, msp, weight);
3491 metaslab_passivate(metaslab_t *msp, uint64_t weight)
3493 uint64_t size __maybe_unused = weight & ~METASLAB_WEIGHT_TYPE;
3503 ASSERT0(weight & METASLAB_ACTIVE_MASK);
3507 metaslab_passivate_allocator(msp->ms_group, msp, weight);
3533 * histogram; calculate the new weight based on that information.
3535 uint64_t weight = metaslab_weight_from_range_tree(msp);
3537 int current_idx = WEIGHT_GET_INDEX(weight);
3540 metaslab_passivate(msp, weight);
3964 * weight is updated too because we are not guaranteed
4690 * Find the metaslab with the highest weight that is less than what we've
4904 * another thread may have changed the weight while we
5043 * a new weight for this metaslab. Now that we have loaded
5050 * space weight that was calculated by metaslab_weight().
5055 * For segment-based metaslabs, determine the new weight
5057 * explicitly use the loaded segment weight (i.e. the range
5062 uint64_t weight;
5064 weight = metaslab_largest_allocatable(msp);
5065 WEIGHT_SET_SPACEBASED(weight);
5067 weight = metaslab_weight_from_range_tree(msp);
5071 metaslab_passivate(msp, weight);
5081 * uses metaslab_weight() to set the weight though
5085 weight |= msp->ms_weight & METASLAB_ACTIVE_MASK;
5086 metaslab_group_sort(mg, msp, weight);