From 8d7e83b025940330ad445112506bb14355ae7002 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 23 Sep 1998 00:27:26 +0000 Subject: [PATCH] ChangeLog, initialize.c: initialize.c (ext2fs_initialize): Make sure that we allocate enough inodes so that we can make a valid filesystem. --- lib/ext2fs/ChangeLog | 5 +++++ lib/ext2fs/initialize.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 2684d86c..5353ef96 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +1998-09-22 Theodore Ts'o + + * initialize.c (ext2fs_initialize): Make sure that we allocate + enough inodes so that we can make a valid filesystem. + 1998-09-02 Theodore Ts'o * rw_bitmaps.c: Fixed signed/unsigned warnings. diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index c97a5bb7..20c8161c 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -161,6 +161,13 @@ retry: set_field(s_inodes_count, super->s_blocks_count/(4096/fs->blocksize)); /* + * Make sure we have at least EXT2_FIRST_INO + 1 inodes, so + * that we have enough inodes for the filesystem(!) + */ + if (super->s_inodes_count < EXT2_FIRST_INO(super)+1) + super->s_inodes_count = EXT2_FIRST_INO(super)+1; + + /* * There should be at least as many inodes as the user * requested. Figure out how many inodes per group that * should be. But make sure that we don't allocate more than -- 2.11.0