int csum_flag;
int bigalloc_flag;
int io_flags;
+ unsigned reserved_inos;
char *buf = 0;
char c;
free_blocks = 0;
csum_flag = EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
+ reserved_inos = super->s_first_ino;
for (i = 0; i < fs->group_desc_count; i++) {
/*
* Don't set the BLOCK_UNINIT group for the last group
EXT2_BG_BLOCK_UNINIT);
ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_UNINIT);
numblocks = super->s_inodes_per_group;
- if (i == 0)
- numblocks -= super->s_first_ino;
+ if (reserved_inos) {
+ if (numblocks > reserved_inos) {
+ numblocks -= reserved_inos;
+ reserved_inos = 0;
+ } else {
+ reserved_inos -= numblocks;
+ numblocks = 0;
+ }
+ }
ext2fs_bg_itable_unused_set(fs, i, numblocks);
}
numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map);