[PATCH] resize2fs: fix minimum size calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

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;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux