Commit 001c584c authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

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: default avatarChao Yu <yuchao0@huawei.com>
parent df0f6b44
...@@ -1357,6 +1357,8 @@ int do_write_data_page(struct f2fs_io_info *fio) ...@@ -1357,6 +1357,8 @@ int do_write_data_page(struct f2fs_io_info *fio)
!is_cold_data(page) && !is_cold_data(page) &&
!IS_ATOMIC_WRITTEN_PAGE(page) && !IS_ATOMIC_WRITTEN_PAGE(page) &&
need_inplace_update(inode))) { need_inplace_update(inode))) {
f2fs_unlock_op(F2FS_I_SB(inode));
fio->cp_rwsem_locked = false;
err = rewrite_data_page(fio); err = rewrite_data_page(fio);
set_inode_flag(inode, FI_UPDATE_WRITE); set_inode_flag(inode, FI_UPDATE_WRITE);
trace_f2fs_do_write_data_page(page, IPU); trace_f2fs_do_write_data_page(page, IPU);
...@@ -1392,6 +1394,7 @@ static int __write_data_page(struct page *page, bool *submitted, ...@@ -1392,6 +1394,7 @@ static int __write_data_page(struct page *page, bool *submitted,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
.submitted = false, .submitted = false,
.cp_rwsem_locked = true,
}; };
trace_f2fs_writepage(page, DATA); trace_f2fs_writepage(page, DATA);
...@@ -1449,6 +1452,7 @@ static int __write_data_page(struct page *page, bool *submitted, ...@@ -1449,6 +1452,7 @@ static int __write_data_page(struct page *page, bool *submitted,
err = do_write_data_page(&fio); err = do_write_data_page(&fio);
if (F2FS_I(inode)->last_disk_size < psize) if (F2FS_I(inode)->last_disk_size < psize)
F2FS_I(inode)->last_disk_size = psize; F2FS_I(inode)->last_disk_size = psize;
if (fio.cp_rwsem_locked)
f2fs_unlock_op(sbi); f2fs_unlock_op(sbi);
done: done:
if (err && err != -ENOENT) if (err && err != -ENOENT)
......
...@@ -793,6 +793,7 @@ struct f2fs_io_info { ...@@ -793,6 +793,7 @@ struct f2fs_io_info {
struct page *page; /* page to be written */ struct page *page; /* page to be written */
struct page *encrypted_page; /* encrypted page */ struct page *encrypted_page; /* encrypted page */
bool submitted; /* indicate IO submission */ bool submitted; /* indicate IO submission */
bool cp_rwsem_locked; /* indicate cp_rwsem is held */
}; };
#define is_read_io(rw) ((rw) == READ) #define is_read_io(rw) ((rw) == READ)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment