--- ext2fs/ialloc.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-)
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c index 73778bee..568d7eae 100644 --- a/ext2fs/ialloc.c +++ b/ext2fs/ialloc.c @@ -133,36 +133,18 @@ repeat: { avefreei = le32toh (sblock->s_free_inodes_count) / groups_count; -/* I am not yet convinced that this next bit is necessary. - i = inode_group_num(dir_inum); for (j = 0; j < groups_count; j++) { - tmp = group_desc (i); - if ((tmp->bg_used_dirs_count << 8) < tmp->bg_free_inodes_count) + tmp = group_desc (j); + if (le16toh (tmp->bg_free_inodes_count) + && le16toh (tmp->bg_free_inodes_count) >= avefreei) { - gdp = tmp; - break; - } - else - i = ++i % groups_count; - } - */ - - if (!gdp) - { - for (j = 0; j < groups_count; j++) - { - tmp = group_desc (j); - if (le16toh (tmp->bg_free_inodes_count) - && le16toh (tmp->bg_free_inodes_count) >= avefreei) + if (!gdp || + (le16toh (tmp->bg_free_blocks_count) > + le16toh (gdp->bg_free_blocks_count))) { - if (!gdp || - (le16toh (tmp->bg_free_blocks_count) > - le16toh (gdp->bg_free_blocks_count))) - { - i = j; - gdp = tmp; - } + i = j; + gdp = tmp; } } } -- 2.34.1