diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-06-17 19:58:29 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-06-17 21:08:49 -0400 |
commit | 9ff8ece57d46a9419fc60057547810824881bb45 (patch) | |
tree | b92629e7841efa0a27648855369591207bbab251 /misc | |
parent | cc19b958602775ef48f347d16859ce6623a385da (diff) | |
download | e2fsprogs-9ff8ece57d46a9419fc60057547810824881bb45.tar.gz |
mke2fs, tune2fs, resize2fs: Use floating point to calculate percentages
When calculating the number reserved blocks, use floating point for
better accuracy, since for big filesystems it really makes a
difference. In addition, mke2fs and tune2fs accepts a floating point
number from the user, so they should provide that level of accuracy.
Addresses-Debian-Bug: #452639
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/mke2fs.c | 4 | ||||
-rw-r--r-- | misc/tune2fs.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index cf5e918e..10ac7820 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1562,8 +1562,8 @@ static void PRS(int argc, char *argv[]) /* * 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[]) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 4e731f5c..4c8a8342 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -973,8 +973,8 @@ 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); |