Base inodes on blocks
authorRobert Pengelly <robertapengelly@hotmail.com>
Sun, 14 Sep 2025 22:54:06 +0000 (23:54 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sun, 14 Sep 2025 22:54:06 +0000 (23:54 +0100)
mke2fs.c

index 03772d79480c4768876ee71db1b74d477fab583e..789b5c270746f2ea0088ecb2730593613a0c8a7f 100644 (file)
--- 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;