aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-04-18 19:23:39 +0800
committerMoyster <oysterized@gmail.com>2017-05-21 18:42:10 +0200
commitb0f326c977d071cd16aeb357a34b7f71014ff462 (patch)
tree79e0ed22b27e809c49ffa76283f3b092eb992785
parent4911c818f0d83613eb913b8cd01e13beab247cff (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>
-rw-r--r--fs/f2fs/data.c6
-rw-r--r--fs/f2fs/f2fs.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8a02e3a8d..6521b780f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1353,6 +1353,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);
@@ -1388,6 +1390,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);
@@ -1445,7 +1448,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;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 857703f64..ff0d4f807 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -892,6 +892,7 @@ struct f2fs_io_info {
struct page *page; /* page to be written */
struct page *encrypted_page; /* encrypted page */
bool submitted; /* indicate IO submission */
+ bool cp_rwsem_locked; /* indicate cp_rwsem is held */
};
#define is_read_io(rw) ((rw) == READ)