/*
* Calculate number of blocks to reserve
*/
- fs_param.s_r_blocks_count = e2p_percent(reserved_ratio,
- fs_param.s_blocks_count);
+ fs_param.s_r_blocks_count = (unsigned int) (reserved_ratio *
+ fs_param.s_blocks_count / 100.0);
}
int main (int argc, char *argv[])
printf (_("Setting interval between checks to %lu seconds\n"), interval);
}
if (m_flag) {
- sb->s_r_blocks_count = e2p_percent(reserved_ratio,
- sb->s_blocks_count);
+ sb->s_r_blocks_count = (unsigned int) (reserved_ratio *
+ sb->s_blocks_count / 100.0);
ext2fs_mark_super_dirty(fs);
printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"),
reserved_ratio, sb->s_r_blocks_count);
unsigned long new_desc_blocks;
ext2_filsys new_fs;
errcode_t retval;
+ double percent;
dgrp_t i;
blk_t size;
- int fd, r_frac, overhead;
+ int fd, overhead;
printf(_("Filesystem at %s is mounted on %s; "
"on-line resizing required\n"), fs->device_name, mtpt);
exit(1);
}
- r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count);
+ percent = (sb->s_r_blocks_count * 100.0) / sb->s_blocks_count;
retval = ext2fs_read_bitmaps(fs);
if (retval)
sb->s_first_data_block -
(i * sb->s_blocks_per_group);
}
- input.reserved_blocks = e2p_percent(r_frac,
- input.blocks_count);
+ input.reserved_blocks = (blk_t) (percent * input.blocks_count
+ / 100.0);
#if 0
printf("new block bitmap is at 0x%04x\n", input.block_bitmap);
unsigned int meta_bg, meta_bg_size;
int has_super;
unsigned long long new_inodes; /* u64 to check for overflow */
+ double percent;
fs->super->s_blocks_count = new_size;
/*
* Adjust the number of reserved blocks
*/
- blk = (__u64)old_fs->super->s_r_blocks_count * 100 /
+ percent = (old_fs->super->s_r_blocks_count * 100.0) /
old_fs->super->s_blocks_count;
- fs->super->s_r_blocks_count = e2p_percent(blk,
- fs->super->s_blocks_count);
+ fs->super->s_r_blocks_count = (unsigned int) (percent *
+ fs->super->s_blocks_count / 100.0);
/*
* Adjust the bitmaps for size
Filesystem OS type: Linux
Inode count: 1248
Block count: 9985
-Reserved block count: 399
+Reserved block count: 497
Free blocks: 8704
Free inodes: 1237
First block: 1
Filesystem OS type: Linux
Inode count: 2496
Block count: 19969
-Reserved block count: 599
+Reserved block count: 993
Free blocks: 18325
Free inodes: 2485
First block: 1
Filesystem OS type: Linux
Inode count: 3744
Block count: 29953
-Reserved block count: 599
+Reserved block count: 1489
Free blocks: 27946
Free inodes: 3733
First block: 1
Filesystem OS type: Linux
Inode count: 5024
Block count: 40000
-Reserved block count: 400
+Reserved block count: 1988
Free blocks: 37624
Free inodes: 5013
First block: 1
Filesystem OS type: Linux
Inode count: 16384
Block count: 65536
-Reserved block count: 2621
+Reserved block count: 3276
Free blocks: 61023
Free inodes: 16373
First block: 1
Filesystem OS type: Linux
Inode count: 4096
Block count: 16384
-Reserved block count: 655
+Reserved block count: 819
Free blocks: 14277
Free inodes: 4085
First block: 1
Filesystem OS type: Linux
Inode count: 41472
Block count: 165536
-Reserved block count: 4966
+Reserved block count: 8274
Free blocks: 157175
Free inodes: 41461
First block: 1