[PATCH] cldconfig: fix inconsistency in rounding percent values

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

 



The number of blocks calculated from a percent value given to the
-min-reclaimable-blocks command line parameter of nilfs-clean is rounded
up. The same percent value in the configuration file is not rounded up.
This patch fixes the inconsistency by rounding up both values.

Signed-off-by: Andreas Rohner <andreas.rohner@xxxxxxx>
---
 sbin/cleanerd/cldconfig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/cleanerd/cldconfig.c b/sbin/cleanerd/cldconfig.c
index bdd8c85..c8b197b 100644
--- a/sbin/cleanerd/cldconfig.c
+++ b/sbin/cleanerd/cldconfig.c
@@ -472,7 +472,8 @@ nilfs_convert_size_to_blocks_per_segment(struct nilfs *nilfs,
 	if (param->unit == NILFS_SIZE_UNIT_NONE) {
 		ret = param->num;
 	} else if (param->unit == NILFS_SIZE_UNIT_PERCENT) {
-		ret = (nilfs_get_blocks_per_segment(nilfs) * param->num) / 100;
+		ret = (nilfs_get_blocks_per_segment(nilfs) * param->num + 99)
+				/ 100;
 	} else {
 		block_size = nilfs_get_block_size(nilfs);
 		segment_size = block_size *
-- 
1.8.5.4

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




[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux