summaryrefslogtreecommitdiff
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-04-18 19:23:39 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-04-19 11:00:44 -0700
commit001c584cca6fce8e91f19eca88781b8c16d1ea42 (patch)
treed5c7df8a2797882c41b95e3ffeebd0ee3c496fae /fs/f2fs/data.c
parentdf0f6b44dd59cd07aa3ff583dee04b3b563648d0 (diff)
f2fs: unlock cp_rwsem early for IPU writes
For IPU writes, there won't be any udpates in dnode page since we will reuse old block address instead of allocating new one, so we don't need to lock cp_rwsem during IPU IO submitting. Signed-off-by: Chao Yu <yuchao0@huawei.com>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index e984a42eabf4..32d5a3b38a3f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1357,6 +1357,8 @@ retry_encrypt:
!is_cold_data(page) &&
!IS_ATOMIC_WRITTEN_PAGE(page) &&
need_inplace_update(inode))) {
+ f2fs_unlock_op(F2FS_I_SB(inode));
+ fio->cp_rwsem_locked = false;
err = rewrite_data_page(fio);
set_inode_flag(inode, FI_UPDATE_WRITE);
trace_f2fs_do_write_data_page(page, IPU);
@@ -1392,6 +1394,7 @@ static int __write_data_page(struct page *page, bool *submitted,
.page = page,
.encrypted_page = NULL,
.submitted = false,
+ .cp_rwsem_locked = true,
};
trace_f2fs_writepage(page, DATA);
@@ -1449,7 +1452,8 @@ write:
err = do_write_data_page(&fio);
if (F2FS_I(inode)->last_disk_size < psize)
F2FS_I(inode)->last_disk_size = psize;
- f2fs_unlock_op(sbi);
+ if (fio.cp_rwsem_locked)
+ f2fs_unlock_op(sbi);
done:
if (err && err != -ENOENT)
goto redirty_out;