diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-09-03 13:41:37 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-09-03 13:41:37 +0900 |
commit | 222cbdc4835f8151b886b049d6ad56b18f88d470 (patch) | |
tree | e691abcacb3c28bae55dfd8896e3a2662cd6936e /fs/f2fs/segment.h | |
parent | c34e333fd5ca41317c3dab69ed8a212acacd4aeb (diff) | |
download | linux-222cbdc4835f8151b886b049d6ad56b18f88d470.tar.gz linux-222cbdc4835f8151b886b049d6ad56b18f88d470.tar.bz2 linux-222cbdc4835f8151b886b049d6ad56b18f88d470.zip |
f2fs: avoid an overflow during utilization calculation
The current f2fs uses all the block counts with 32 bit numbers, which is able to
cover about 15TB volume.
But in calculation of utilization, f2fs multiplies the count by 100 which can
induce overflow.
This patch fixes this.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r-- | fs/f2fs/segment.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index cd9bd93212ad..e0d6d3abf396 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -471,7 +471,7 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, int freed) static inline int utilization(struct f2fs_sb_info *sbi) { - return div_u64(valid_user_blocks(sbi) * 100, sbi->user_block_count); + return div_u64((u64)valid_user_blocks(sbi) * 100, sbi->user_block_count); } /* |