]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
resize2fs: take s_first_data_block into account for resize2fs -M
authorJan Kara <jack@suse.cz>
Wed, 15 Feb 2012 23:41:33 +0000 (18:41 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Feb 2012 19:32:18 +0000 (14:32 -0500)
calculate_minimum_resize_size() forgot to account s_first_data_block
into minimum filesystem size. Thus in case the size of filesystem was
such that the last group had the minimal size (50 blocks + metadata
overhead), the code in adjust_fs_info() decided the group is unneeded,
removed it, and in some cases the resizing then failed with ENOSPC.

Fix the issue by properly accounting for s_first_data_block in
calculate_minimum_resize_size().

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
resize/resize2fs.c

index 06ce73e5420e4c12b93e9a9f8dfb7fa2ba5f5ff2..dc2805d9d905f2f0b5fe913ebebeb3a0fcc5f9e8 100644 (file)
@@ -2033,6 +2033,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs)
 
        if (ext2fs_bg_has_super(fs, groups-1))
                overhead += SUPER_OVERHEAD(fs);
+       overhead += fs->super->s_first_data_block;
 
        /*
         * since our last group doesn't have to be BLOCKS_PER_GROUP large, we