diff options
author | 2015-09-23 09:25:43 +0800 | |
---|---|---|
committer | 2015-10-09 16:20:53 -0700 | |
commit | 1d7e10d58a1f62c8c44668cca1cff6a2dd57d7d9 (patch) | |
tree | 6773fb3abdc0a00e722ddfffa0654301baf4c562 | |
parent | f2fs: introduce __try_update_largest_extent (diff) | |
download | linux-1d7e10d58a1f62c8c44668cca1cff6a2dd57d7d9.tar.gz linux-1d7e10d58a1f62c8c44668cca1cff6a2dd57d7d9.tar.bz2 linux-1d7e10d58a1f62c8c44668cca1cff6a2dd57d7d9.zip |
f2fs: fix incorrect bimodal calculation
In update_sit_info, we use div_u64 to handle 'u64 divide u64' case, but
div_u64 can only handle 32-bits divisor, so our divisor with u64 type
passed to div_u64 will overflow, result in the wrong calculation when
show debug info of f2fs as below:
BDF: 464, avg. vblocks: 23509
(BDF should never exceed 100)
So change to use div64_u64 to handle this case correctly.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/debug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index ebfcc4039057..615a307a7871 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -118,7 +118,7 @@ static void update_sit_info(struct f2fs_sb_info *sbi) } } dist = div_u64(MAIN_SECS(sbi) * hblks_per_sec * hblks_per_sec, 100); - si->bimodal = div_u64(bimodal, dist); + si->bimodal = div64_u64(bimodal, dist); if (si->dirty_count) si->avg_vblocks = div_u64(total_vblocks, ndirty); else |