aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-12-23 17:11:43 +0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:32:37 +0200
commitfa011e507b4e2bbb5abc9454dd72dbefba501f43 (patch)
treeecead03bdacadffb1426e92d3b09e975bc502030 /fs
parentbc15d648599c4caf5a1183b86140d120a7eefe1a (diff)
f2fs: reduce covered region of sbi->cp_rwsem in f2fs_map_blocks
Only cover sbi->cp_rwsem on one dnode page's allocation and modification instead of multiple's in f2fs_map_blocks, it can reduce the covered region of cp_rwsem, then we can avoid potential long time delay for concurrent checkpointer. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/data.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d329b8a61..28356b89a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -591,7 +591,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
}
if (create)
- f2fs_lock_op(F2FS_I_SB(inode));
+ f2fs_lock_op(sbi);
/* When reading holes, we need its node page */
set_new_dnode(&dn, inode, NULL, NULL, 0);
@@ -648,6 +648,11 @@ get_next:
allocated = false;
f2fs_put_dnode(&dn);
+ if (create) {
+ f2fs_unlock_op(sbi);
+ f2fs_lock_op(sbi);
+ }
+
set_new_dnode(&dn, inode, NULL, NULL, 0);
err = get_dnode_of_data(&dn, pgofs, mode);
if (err) {
@@ -703,7 +708,7 @@ put_out:
f2fs_put_dnode(&dn);
unlock_out:
if (create)
- f2fs_unlock_op(F2FS_I_SB(inode));
+ f2fs_unlock_op(sbi);
out:
trace_f2fs_map_blocks(inode, map, err);
return err;