]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkfs.minix: re-fix block count maths
authorSami Kerola <kerolasa@iki.fi>
Sat, 1 Aug 2015 18:01:00 +0000 (19:01 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Aug 2015 09:27:36 +0000 (11:27 +0200)
Error, that Joshua Hudson already pointed out, creapped back to commit
da41ff5 when changes were applied from mailbox rather than git remote, as
the corrected change had included some accidental rubbish.

Reference: http://www.spinics.net/lists/util-linux-ng/msg11764.html
Reference: http://www.spinics.net/lists/util-linux-ng/msg11848.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/mkfs.minix.c

index 16305b23fcdd361d8ee48a7c924fa5cb7f5859d8..2da0e687872d607bcde243845626875097c9d12a 100644 (file)
@@ -706,8 +706,8 @@ static void determine_device_blocks(struct fs_control *ctl, const struct stat *s
                errx(MKFS_EX_ERROR, _("%s: number of blocks too small"), ctl->device_name);
        if (fs_version == 1 && ctl->fs_blocks > MINIX_MAX_INODES)
                ctl->fs_blocks = MINIX_MAX_INODES;
-       if (ctl->fs_blocks > MINIX_MAX_INODES * BITS_PER_BLOCK)
-               ctl->fs_blocks = MINIX_MAX_INODES * BITS_PER_BLOCK;     /* Utter maximum: Clip. */
+       if (ctl->fs_blocks > (4 + ((MINIX_MAX_INODES - 4) * BITS_PER_BLOCK)))
+               ctl->fs_blocks = 4 + ((MINIX_MAX_INODES - 4) * BITS_PER_BLOCK); /* Utter maximum: Clip. */
 }
 
 static void check_user_instructions(struct fs_control *ctl)