diff mbox

resize2fs: fix minimum size calculation

Message ID 1432436541-16990-1-git-send-email-psusi@ubuntu.com
State Accepted, archived
Headers show

Commit Message

Phillip Susi May 24, 2015, 3:02 a.m. UTC
The size calculation adds an initial number of block groups needed to hold
the inodes on the fs, then augments them with additional groups needed to
reach the minimum number of data blocks, and then calculates the size of
the last block group ( which should be a fraction of one block group ).  It
was calculating a last bg size of several block groups because when adding
the supplementary bgs, it only advanced the position of the start of the
last group by one group, even though it was adding multiple groups.  Add
the missing multiplier to move the last bg start position up to the correct
location, thus computing a proper fractional last bg size.
---
 resize/resize2fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Phillip Susi June 18, 2015, 12:55 a.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 05/23/2015 11:02 PM, Phillip Susi wrote:
> The size calculation adds an initial number of block groups needed
> to hold the inodes on the fs, then augments them with additional
> groups needed to reach the minimum number of data blocks, and then
> calculates the size of the last block group ( which should be a
> fraction of one block group ).  It was calculating a last bg size
> of several block groups because when adding the supplementary bgs,
> it only advanced the position of the start of the last group by one
> group, even though it was adding multiple groups.  Add the missing
> multiplier to move the last bg start position up to the correct 
> location, thus computing a proper fractional last bg size.

Bump.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBCgAGBQJVghcLAAoJENRVrw2cjl5Rc40H/3S52xJvxPV0f9cpXZT1qNLe
KEOi3O8B8FxQdfi3e3DjOk7OVl9t0wB+pob1QrOb8COp8wWEYr0dvQbq+fMLFOCx
8QehpD+q+0O9ZiptcNvhPEa65vNXTWE9Mo+nnK/eSPm+wXJ/XfGISIQfy7U0qzXP
ZJ0rsyqpFqkJKBOBIh3P9vxxaR+wDM+KuRERk0nc/shnH6Yg5Ud2PUzd+ZmGSYHY
DPxT0Gde3T/9whLOMBaD8NSTyqG5zPASBybqqqKHyeasAuWUqGEO8G79KsZvaeJ5
3LCG92vWO6wt7jQPzgf95Z6uj4CHVVufqA7DQwKKDgIE1JGFq7C76/pwfAranG0=
=nqrK
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 041ff75..3359a8f 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -2870,7 +2870,7 @@  blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 
 		/* ok we have to account for the last group */
 		overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
-		last_start += EXT2_BLOCKS_PER_GROUP(fs->super) - overhead;
+		last_start += (EXT2_BLOCKS_PER_GROUP(fs->super) * extra_grps) - overhead;
 
 		grp = flex_groups;
 		groups += extra_grps;