diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-05-13 22:47:11 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-05-18 23:57:28 +0300 |
commit | 1beba1b3a953107c3ff5448ab4e4297db4619c76 (patch) | |
tree | 1a9cf68ea317f704650a51c97b89746032014dfe /fs/f2fs/super.c | |
parent | 523be8a6b3418eb7e0f0f042fe0490345eb5d516 (diff) | |
download | linux-1beba1b3a953107c3ff5448ab4e4297db4619c76.tar.xz |
f2fs: use percpu_counter for # of dirty pages in inode
This patch adds percpu_counter for # of dirty pages in inode.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 009a9f44205f..0ff862b08fb9 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -526,9 +526,13 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb) init_once((void *) fi); + if (percpu_counter_init(&fi->dirty_pages, 0, GFP_NOFS)) { + kmem_cache_free(f2fs_inode_cachep, fi); + return NULL; + } + /* Initialize f2fs-specific inode info */ fi->vfs_inode.i_version = 1; - atomic_set(&fi->dirty_pages, 0); fi->i_current_depth = 1; fi->i_advise = 0; init_rwsem(&fi->i_sem); @@ -603,6 +607,7 @@ static void f2fs_i_callback(struct rcu_head *head) static void f2fs_destroy_inode(struct inode *inode) { + percpu_counter_destroy(&F2FS_I(inode)->dirty_pages); call_rcu(&inode->i_rcu, f2fs_i_callback); } |