summaryrefslogtreecommitdiff
path: root/fs/f2fs/debug.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-07-15 17:29:49 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-08-05 08:08:06 -0700
commit727edac572034557d207b293a47de25145e3d58c (patch)
tree984e7ceae8a02605c0626375f26abab96126c440 /fs/f2fs/debug.c
parentd5e8f6c9800c382cc55d8df801775d51311f8f21 (diff)
f2fs: use atomic_t to record hit ratio info of extent cache
Variables for recording extent cache ratio info were updated without protection, this patch tries to alter them to atomic_t type for more accurate stat. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/debug.c')
-rw-r--r--fs/f2fs/debug.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 2aeaf4e214db..bc215fd6c402 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -33,8 +33,8 @@ static void update_general_status(struct f2fs_sb_info *sbi)
int i;
/* validation check of the segment numbers */
- si->hit_ext = sbi->read_hit_ext;
- si->total_ext = sbi->total_hit_ext;
+ si->hit_ext = atomic_read(&sbi->read_hit_ext);
+ si->total_ext = atomic_read(&sbi->total_hit_ext);
si->ext_tree = sbi->total_ext_tree;
si->ext_node = atomic_read(&sbi->total_ext_node);
si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES);
@@ -369,6 +369,9 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
si->sbi = sbi;
sbi->stat_info = si;
+ atomic_set(&sbi->total_hit_ext, 0);
+ atomic_set(&sbi->read_hit_ext, 0);
+
atomic_set(&sbi->inline_xattr, 0);
atomic_set(&sbi->inline_inode, 0);
atomic_set(&sbi->inline_dir, 0);