From: Lennart Poettering Date: Tue, 15 Jul 2025 12:06:08 +0000 (+0200) Subject: repart: do not enforce 10M min size for immutable file systems by default X-Git-Tag: v258-rc1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6c81cc80537c207709edd853777c1ba92284bb5;p=thirdparty%2Fsystemd.git repart: do not enforce 10M min size for immutable file systems by default --- diff --git a/src/repart/repart.c b/src/repart/repart.c index 352384bfc0d..181555ce387 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -955,7 +955,7 @@ static uint64_t partition_fstype_min_size(const Context *c, const Partition *p) } static uint64_t partition_min_size(const Context *context, const Partition *p) { - uint64_t sz, override_min; + uint64_t sz; assert(context); assert(p); @@ -997,9 +997,17 @@ static uint64_t partition_min_size(const Context *context, const Partition *p) { sz = d; } - override_min = p->suppressing ? MAX(p->size_min, p->suppressing->size_min) : p->size_min; + uint64_t min_size = p->size_min; + if (p->suppressing && (min_size == UINT64_MAX || p->suppressing->size_min > min_size)) + min_size = p->suppressing->size_min; + + /* Default to 10M min size, except if the file system is read-only, in which case let's not enforce a + * minimum size, because even if we wanted to we couldn't take possession of the extra space + * allocated. */ + if (min_size == UINT64_MAX) + min_size = (p->format && fstype_is_ro(p->format)) || p->verity != VERITY_OFF ? 1 : DEFAULT_MIN_SIZE; - return MAX(round_up_size(override_min != UINT64_MAX ? override_min : DEFAULT_MIN_SIZE, context->grain_size), sz); + return MAX(round_up_size(min_size, context->grain_size), sz); } static uint64_t partition_max_size(const Context *context, const Partition *p) {