initialize.c (ext2fs_initialize): If the user specifies a really

large number of inodes, then reduce the number of blocks
	per group until we find a workable set of filesystem
	parameters.

ext2_err.et.in (EXT2_ET_TOO_MANY_INODES): Add new error code.
bitmap-optimize
Theodore Ts'o 2003-01-19 21:01:22 -05:00
parent e34bf43aff
commit 4564c727e9
3 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2003-01-19 Theodore Ts'o <tytso@mit.edu>
* initialize.c (ext2fs_initialize): If the user specifies a really
large number of inodes, then reduce the number of blocks
per group until we find a workable set of filesystem
parameters.
* ext2_err.et.in (EXT2_ET_TOO_MANY_INODES): Add new error code.
2002-11-09 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.32

View File

@ -281,5 +281,8 @@ ec EXT2_ET_DIRHASH_UNSUPP,
ec EXT2_ET_BAD_EA_BLOCK_NUM,
"Illegal extended attribute block number"
ec EXT2_ET_TOO_MANY_INODES,
"Cannot create filesystem with requested number of inodes"
end

View File

@ -189,8 +189,17 @@ retry:
*/
ipg = (super->s_inodes_count + fs->group_desc_count - 1) /
fs->group_desc_count;
if (ipg > fs->blocksize * 8)
ipg = fs->blocksize * 8;
if (ipg > fs->blocksize * 8) {
if (super->s_blocks_per_group >= 256) {
/* Try again with slightly different parameters */
super->s_blocks_per_group -= 8;
super->s_blocks_count = param->s_blocks_count;
super->s_frags_per_group = super->s_blocks_per_group *
frags_per_block;
goto retry;
} else
return EXT2_ET_TOO_MANY_INODES;
}
if (ipg > EXT2_MAX_INODES_PER_GROUP(super))
ipg = EXT2_MAX_INODES_PER_GROUP(super);
@ -239,7 +248,11 @@ retry:
* being clever is tricky...
*/
overhead = (int) (3 + fs->desc_blocks + fs->inode_blocks_per_group);
/* This can only happen if the user requested too many inodes */
if (overhead > super->s_blocks_per_group)
return EXT2_ET_TOO_MANY_INODES;
/*
* See if the last group is big enough to support the
* necessary data structures. If not, we need to get rid of