summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/partition/repart.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index b430d2d463..e1608bd64d 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -977,14 +977,22 @@ static bool context_allocate_partitions(Context *context, uint64_t *ret_largest_
uint64_t required;
FreeArea *a = NULL;
- /* Skip partitions we already dropped or that already exist */
- if (p->dropped || PARTITION_EXISTS(p))
+ if (p->dropped || PARTITION_IS_FOREIGN(p))
continue;
/* How much do we need to fit? */
required = partition_min_size_with_padding(context, p);
assert(required % context->grain_size == 0);
+ /* For existing partitions, we should verify that they'll actually fit */
+ if (PARTITION_EXISTS(p)) {
+ if (p->current_size + p->current_padding < required)
+ return false; /* 😢 We won't be able to grow to the required min size! */
+
+ continue;
+ }
+
+ /* For new partitions, see if there's a free area big enough */
for (size_t i = 0; i < context->n_free_areas; i++) {
a = context->free_areas[i];