diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-03-20 19:10:08 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-03-20 22:10:11 +0900 |
commit | d928bfbfe77aa457b765c19e9db8cd4cc72b3c89 (patch) | |
tree | f56763175e0fbee1e2079c9a330f3d73f971bc5c /fs/f2fs/dir.c | |
parent | 58c410351eba3d24f741c85a0eb9eaf15c94047d (diff) |
f2fs: introduce fi->i_sem to protect fi's info
This patch introduces fi->i_sem to protect fi's info that includes xattr_ver,
pino, i_nlink.
This enables to remove i_mutex during f2fs_sync_file, resulting in performance
improvement when a number of fsync calls are triggered from many concurrent
threads.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r-- | fs/f2fs/dir.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 7c9b17c03675..972fd0ef230f 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -493,6 +493,7 @@ start: add_dentry: f2fs_wait_on_page_writeback(dentry_page, DATA); + down_write(&F2FS_I(inode)->i_sem); page = init_inode_metadata(inode, dir, name); if (IS_ERR(page)) { err = PTR_ERR(page); @@ -515,6 +516,8 @@ add_dentry: update_parent_metadata(dir, inode, current_depth); fail: + up_write(&F2FS_I(inode)->i_sem); + if (is_inode_flag_set(F2FS_I(dir), FI_UPDATE_DIR)) { update_inode_page(dir); clear_inode_flag(F2FS_I(dir), FI_UPDATE_DIR); @@ -559,6 +562,8 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, if (inode) { struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); + down_write(&F2FS_I(inode)->i_sem); + if (S_ISDIR(inode->i_mode)) { drop_nlink(dir); update_inode_page(dir); @@ -569,6 +574,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, drop_nlink(inode); i_size_write(inode, 0); } + up_write(&F2FS_I(inode)->i_sem); update_inode_page(inode); if (inode->i_nlink == 0) |