resize2fs: use old_fs to detect per-bg metadata blocks to free

When shrinking a filesystem, resize2fs wants to free per-bg metadata
blocks that are no longer needed.  This behavior is gated on whether
there's a superblock in the group as told by new_fs.  The check really
should be against old_fs, since we're effectively freeing blocks out
of old_fs in the transition to new_fs, but prior to sparse_super2 this
didn't matter since superblocks didn't move, so it didn't matter.

Under sparse_super2, however, there's a superblock in the last group,
so now we need to change the test to use old_fs as it should.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2014-12-14 21:09:29 -05:00 committed by Theodore Ts'o
parent 0698ecc1e2
commit 8e98899b2f
1 changed files with 1 additions and 1 deletions

View File

@ -1042,7 +1042,7 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
}
for (i = 0; i < max_groups; i++) {
if (!ext2fs_bg_has_super(fs, i)) {
if (!ext2fs_bg_has_super(old_fs, i)) {
group_blk += fs->super->s_blocks_per_group;
continue;
}