From: Yu Watanabe Date: Sun, 4 Sep 2022 09:51:55 +0000 (+0900) Subject: repart: anyway run loop at the end even if the loop will be restarted later X-Git-Tag: v252-rc1~222^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a503ad2a9c46e3867eae3d50c55e9077b5a0219;p=thirdparty%2Fsystemd.git 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). --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 02d7dc8e10b..b23d74bee4c 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) {