summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-05-16 11:42:32 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2016-05-18 13:57:30 -0700
commit513c5f3735a9bd0bd8b58b6cdafbad5ef19f2159 (patch)
treecff1349dc68fd1119baad78b2f667f2719d8a166 /fs/f2fs/f2fs.h
parent41382ec43255b502321c3c27f1347efeb3279290 (diff)
downloadblackbird-obmc-linux-513c5f3735a9bd0bd8b58b6cdafbad5ef19f2159.tar.gz
blackbird-obmc-linux-513c5f3735a9bd0bd8b58b6cdafbad5ef19f2159.zip
f2fs: use percpu_counter for total_valid_inode_count
This patch uses percpu_counter to avoid stat_lock. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c8833c802ea9..02f0656cb2ab 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -801,7 +801,6 @@ struct f2fs_sb_info {
unsigned int total_sections; /* total section count */
unsigned int total_node_count; /* total node block count */
unsigned int total_valid_node_count; /* valid node block count */
- unsigned int total_valid_inode_count; /* valid inode count */
loff_t max_file_blocks; /* max block index of file */
int active_logs; /* # of active logs */
int dir_level; /* directory level */
@@ -818,6 +817,9 @@ struct f2fs_sb_info {
/* # of allocated blocks */
struct percpu_counter alloc_valid_block_count;
+ /* valid inode count */
+ struct percpu_counter total_valid_inode_count;
+
struct f2fs_mount_info mount_opt; /* mount options */
/* for cleaning operations */
@@ -1325,23 +1327,17 @@ static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi)
static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi)
{
- spin_lock(&sbi->stat_lock);
- f2fs_bug_on(sbi, sbi->total_valid_inode_count == sbi->total_node_count);
- sbi->total_valid_inode_count++;
- spin_unlock(&sbi->stat_lock);
+ percpu_counter_inc(&sbi->total_valid_inode_count);
}
static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi)
{
- spin_lock(&sbi->stat_lock);
- f2fs_bug_on(sbi, !sbi->total_valid_inode_count);
- sbi->total_valid_inode_count--;
- spin_unlock(&sbi->stat_lock);
+ percpu_counter_dec(&sbi->total_valid_inode_count);
}
-static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
+static inline s64 valid_inode_count(struct f2fs_sb_info *sbi)
{
- return sbi->total_valid_inode_count;
+ return percpu_counter_sum_positive(&sbi->total_valid_inode_count);
}
static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,
OpenPOWER on IntegriCloud