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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user