提交 d5f66990 编写于 作者: J Jaegeuk Kim

f2fs: decrease the lock granularity during write_begin

This patch reduces the lock granularity during write_begin.
When the system is under memory pressure, it would be better to reduce
the locking time for the data pages.
Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
上级 bde44686
......@@ -909,6 +909,10 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
page = grab_cache_page_write_begin(mapping, index, flags);
if (!page)
return -ENOMEM;
/* to avoid latency during memory pressure */
unlock_page(page);
*pagep = page;
if (f2fs_has_inline_data(inode) && (pos + len) <= MAX_INLINE_DATA)
......@@ -920,10 +924,18 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
f2fs_unlock_op(sbi);
if (err) {
f2fs_put_page(page, 1);
f2fs_put_page(page, 0);
return err;
}
inline_data:
lock_page(page);
if (unlikely(page->mapping != mapping)) {
f2fs_put_page(page, 1);
goto repeat;
}
f2fs_wait_on_page_writeback(page, DATA);
if ((len == PAGE_CACHE_SIZE) || PageUptodate(page))
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册