diff --git a/src/partition/repart.c b/src/partition/repart.c index 02d7dc8e10..b23d74bee4 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -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) {