[PATCH 3/3] minix: calculate s_firstdatazone to support more inodes
From: Jori Koolstra
Date: Mon Nov 17 2025 - 17:06:12 EST
We can potentially ignore the on-disk s_firstdatazone and calculate the
value on the fly instead. Since this field is only a u16, this allows
more inodes to be handled. The mfs implementation in the minix OS does
roughly the same. Currently there is no support for s_firstdatazone=0 in
utils-linux.
Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
---
fs/minix/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 8eb26ff91adf..d4a43bc86890 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -272,6 +272,15 @@ static int minix_fill_super(struct super_block *s, struct fs_context *fc)
} else
goto out_no_fs;
+ /* We can potentially ignore the on-disk s_firstdatazone and instead
+ * calculate the value on the fly. Since this field is only a u16,
+ * this allows more inodes to be handled.
+ */
+ if (sbi->s_firstdatazone == 0) {
+ sbi->s_firstdatazone = 2 + sbi->s_imap_blocks + sbi->s_zmap_blocks +
+ minix_blocks_needed(sbi->s_ninodes, s->s_blocksize);
+ }
+
if (!minix_check_superblock(s))
goto out_illegal_sb;
--
2.51.2