]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Make use of partitions list being ordered by offsets while looping 42969/head
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 13 Jul 2026 14:37:56 +0000 (16:37 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Mon, 13 Jul 2026 16:24:27 +0000 (18:24 +0200)
Let's do the same thing we did above with the last commit here too and make use
of the partitions list being ordered by physical offsets. This makes the code a
little simpler.

src/repart/repart.c

index d245cab539fc9e8ede8f92c9e1de92e649fe4f5c..bc6df85b26f7cb76622155ad7d0ecc409013dd92 100644 (file)
@@ -1717,15 +1717,12 @@ static int context_grow_partitions_on_free_area(Context *context, FreeArea *a) {
                 Partition *last_partition = NULL;
 
                 LIST_FOREACH(partitions, p, context->partitions)
-                        if (p->allocated_to_area == a)
+                        if (p->allocated_to_area == a || p->padding_area == a)
                                 last_partition = p;
 
                 if (last_partition) {
                         assert(last_partition->new_padding != UINT64_MAX);
                         last_partition->new_padding += round_down_size(span, context->grain_size);
-                } else if (a->after) {
-                        assert(a->after->new_padding != UINT64_MAX);
-                        a->after->new_padding += round_down_size(span, context->grain_size);
                 }
         }