diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-12-08 19:08:20 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-12-08 10:54:59 -0800 |
commit | 03e14d522eb1fdf9c0ce37085cb56749342a842c (patch) | |
tree | 38c93ae568af7ce3ec44812db861faa0d4393158 /fs/f2fs/debug.c | |
parent | 51455b19384d26afac4f214fab2ad0a4f1964e30 (diff) | |
download | talos-op-linux-03e14d522eb1fdf9c0ce37085cb56749342a842c.tar.gz talos-op-linux-03e14d522eb1fdf9c0ce37085cb56749342a842c.zip |
f2fs: use atomic for counting inode with inline_{dir,inode} flag
As inline_{dir,inode} stat is increased/decreased concurrently by multi threads,
so the value is not so accurate, let's use atomic type for counting accurately.
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.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 4e2e39c0ba69..91e8f699ab30 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -46,8 +46,8 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->valid_count = valid_user_blocks(sbi); si->valid_node_count = valid_node_count(sbi); si->valid_inode_count = valid_inode_count(sbi); - si->inline_inode = sbi->inline_inode; - si->inline_dir = sbi->inline_dir; + si->inline_inode = atomic_read(&sbi->inline_inode); + si->inline_dir = atomic_read(&sbi->inline_dir); si->utilization = utilization(sbi); si->free_segs = free_segments(sbi); @@ -329,6 +329,9 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi) si->sbi = sbi; sbi->stat_info = si; + atomic_set(&sbi->inline_inode, 0); + atomic_set(&sbi->inline_dir, 0); + mutex_lock(&f2fs_stat_mutex); list_add_tail(&si->stat_list, &f2fs_stat_list); mutex_unlock(&f2fs_stat_mutex); |