From 8c5b21a91beedcdbcc829e3121b26fb201b6a7ef Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Sun, 14 Sep 2025 23:54:06 +0100 Subject: [PATCH] Base inodes on blocks --- mke2fs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mke2fs.c b/mke2fs.c index 03772d7..789b5c2 100644 --- a/mke2fs.c +++ b/mke2fs.c @@ -659,8 +659,15 @@ int main (int argc, char **argv) { } + if ((nbinodes = nbblocks - EXT2_FIRST_INO - 1) < EXT2_FIRST_INO - 1) { + nbinodes = EXT2_FIRST_INO - 1; + } + nbresrvd = (nbblocks * 5) / 100; - nbinodes = EXT2_FIRST_INO - 1 + (nbresrvd ? 1 : 0); + + if (nbresrvd) { + nbinodes++; + } image_size += offset * SECTOR_SIZE; -- 2.34.1