Fix more rounding overflows for filesystems that have 2**32-1 blocks
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 94bdf2f..e87d7a8 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,9 @@
2006-08-30 Eric Sandeen <esandeen@redhat.com>
+ * pass1.c (handle_bad_fs_blocks): use blk_t, not int for first_block.
+
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
+
* unix.c (show_stats): use ext2_ino_t for inode containers.
2006-08-30 Eric Sandeen <esandeen@redhat.com>
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index e6778af..9a84b78 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1953,7 +1953,7 @@
{
ext2_filsys fs = ctx->fs;
dgrp_t i;
- int first_block;
+ blk_t first_block;
for (i = 0; i < fs->group_desc_count; i++) {
first_block = ext2fs_group_first_block(fs, i);
diff --git a/misc/ChangeLog b/misc/ChangeLog
index f59d471..93cd1ed 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,5 +1,9 @@
2006-08-30 Eric Sandeen <esandeen@redhat.com>
+ * mke2fs.c (PRS): Avoid overflow in megs calculation.
+
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
+
* mke2fs.c (PRS): Disallow > 2^32 inodes at mkfs time.
2006-08-30 Eric Sandeen <esandeen@redhat.com>
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 256c813..87ae687 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1260,7 +1260,7 @@
}
if (!fs_type) {
- int megs = fs_param.s_blocks_count *
+ int megs = (__u64)fs_param.s_blocks_count *
(EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024;
if (megs <= 3)
diff --git a/resize/ChangeLog b/resize/ChangeLog
index b740df0..bc4dd92 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,5 +1,11 @@
2006-08-30 Eric Sandeen <esandeen@redhat.com>
+ * online.c (online_resize_fs): use div_ceil for r_frac calculation.
+ * resize2fs.c (adjust_fs_info): avoid overflow in blk calculation
+ when figuring new reserved blocks count.
+
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
+
* resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time.
2006-08-30 Eric Sandeen <esandeen@redhat.com>
diff --git a/resize/online.c b/resize/online.c
index 26b263e..a1c19c3 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -59,8 +59,7 @@
exit(1);
}
- r_frac = ((100 * sb->s_r_blocks_count) + sb->s_blocks_count-1) /
- sb->s_blocks_count;
+ r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count);
retval = ext2fs_read_bitmaps(fs);
if (retval)
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 60180ab..e1057ec 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -250,7 +250,7 @@
/*
* Adjust the number of reserved blocks
*/
- blk = old_fs->super->s_r_blocks_count * 100 /
+ blk = (__u64)old_fs->super->s_r_blocks_count * 100 /
old_fs->super->s_blocks_count;
fs->super->s_r_blocks_count = e2p_percent(blk,
fs->super->s_blocks_count);