repart: anyway run loop at the end even if the loop will be restarted later

The order of the partitions processed in each phase does not change
result for the first two phase (PHASE_OVERCHARGE and PHASE_UNDERCHARGE).
This commit is contained in:
Yu Watanabe
2022-09-09 05:35:41 +09:00
parent 0245e15afe
commit 2a503ad2a9
+5 -9
View File
@@ -736,6 +736,8 @@ static bool context_grow_partitions_phase(
uint64_t *span,
uint64_t *weight_sum) {
bool try_again = false;
assert(context);
assert(a);
assert(span);
@@ -753,8 +755,8 @@ static bool context_grow_partitions_phase(
continue;
if (p->new_size == UINT64_MAX) {
bool charge = false, try_again = false;
uint64_t share, rsz, xsz;
bool charge = false;
/* Calculate how much this space this partition needs if everyone would get
* the weight based share */
@@ -798,14 +800,11 @@ static bool context_grow_partitions_phase(
*span = charge_size(context, *span, p->new_size);
*weight_sum = charge_weight(*weight_sum, p->weight);
}
if (try_again)
return false; /* try again */
}
if (p->new_padding == UINT64_MAX) {
bool charge = false, try_again = false;
uint64_t share, rsz, xsz;
bool charge = false;
share = scale_by_weight(*span, p->padding_weight, *weight_sum);
@@ -827,13 +826,10 @@ static bool context_grow_partitions_phase(
*span = charge_size(context, *span, p->new_padding);
*weight_sum = charge_weight(*weight_sum, p->padding_weight);
}
if (try_again)
return false; /* try again */
}
}
return true; /* done */
return !try_again;
}
static void context_grow_partition_one(Context *context, FreeArea *a, Partition *p, uint64_t *span) {